Setup Cooldowns & Msg Clean Up
This commit is contained in:
parent
323a5b1e9e
commit
b0169ec68d
@ -24,7 +24,8 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
|||||||
#twitch_message.chat.send("test acknowledged")
|
#twitch_message.chat.send("test acknowledged")
|
||||||
|
|
||||||
diceRoll: str = ""
|
diceRoll: str = ""
|
||||||
await discord_message.channel.send("Rolling Dice...")
|
await bot.send_message(discord_message, "Rolling Dice...")
|
||||||
|
#await discord_message.channel.send("Rolling Dice...")
|
||||||
print("Rolling Dice...")
|
print("Rolling Dice...")
|
||||||
|
|
||||||
temp_preParsedMessage = discord_message.content.split("+")
|
temp_preParsedMessage = discord_message.content.split("+")
|
||||||
@ -70,4 +71,5 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
|||||||
|
|
||||||
diceRoll = discord_message.author.mention + " rolled: " + diceRoll
|
diceRoll = discord_message.author.mention + " rolled: " + diceRoll
|
||||||
print(diceRoll)
|
print(diceRoll)
|
||||||
await discord_message.channel.send(diceRoll)
|
await bot.send_message(discord_message, diceRoll)
|
||||||
|
#await discord_message.channel.send(diceRoll)
|
||||||
|
|||||||
@ -17,12 +17,17 @@ import discord
|
|||||||
import discord.message
|
import discord.message
|
||||||
import discord.channel
|
import discord.channel
|
||||||
|
|
||||||
|
from cooldowns import Cooldown_Module
|
||||||
|
|
||||||
class Discord_Module(discord.Client):
|
class Discord_Module(discord.Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.dbCredential: credentials.DB_Credential
|
self.dbCredential: credentials.DB_Credential
|
||||||
self.discordCredential: credentials.Discord_Credential
|
self.discordCredential: credentials.Discord_Credential
|
||||||
|
|
||||||
|
self.cooldownModule:Cooldown_Module = Cooldown_Module()
|
||||||
|
self.cooldownModule.setupCooldown("discordRateLimit", 10, 1)
|
||||||
|
|
||||||
self.commands = command_loader.load_commands()
|
self.commands = command_loader.load_commands()
|
||||||
|
|
||||||
self.tts_enabled: bool = False
|
self.tts_enabled: bool = False
|
||||||
@ -70,6 +75,11 @@ class Discord_Module(discord.Client):
|
|||||||
print(e)
|
print(e)
|
||||||
pass # we don't care
|
pass # we don't care
|
||||||
|
|
||||||
|
async def send_message(self, message, response):
|
||||||
|
if self.cooldownModule.isCooldownActive("discordRateLimit") == False:
|
||||||
|
await message.channel.send(response)
|
||||||
|
self.cooldownModule.actionTrigger("discordRateLimit")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ class Twitch_Module():
|
|||||||
|
|
||||||
# Default Twitch Chat limit is 20 per 30 seconds
|
# Default Twitch Chat limit is 20 per 30 seconds
|
||||||
# If Mod or Op, Twitch Chat limit is 100 per 30 seconds
|
# If Mod or Op, Twitch Chat limit is 100 per 30 seconds
|
||||||
self.twitchChat_cooldown:Cooldown_Module = Cooldown_Module()
|
self.cooldownModule:Cooldown_Module = Cooldown_Module()
|
||||||
self.twitchChat_cooldown.setupCooldown("twitchChat", 20, 32)
|
self.cooldownModule.setupCooldown("twitchChat", 20, 32)
|
||||||
|
|
||||||
def join_channel(self, credential: credentials.Twitch_Credential, channel_name:str):
|
def join_channel(self, credential: credentials.Twitch_Credential, channel_name:str):
|
||||||
channel_name = "#" + channel_name
|
channel_name = "#" + channel_name
|
||||||
@ -60,9 +60,9 @@ class Twitch_Module():
|
|||||||
self.chat.irc.socket.close()
|
self.chat.irc.socket.close()
|
||||||
|
|
||||||
def send_message(self, message):
|
def send_message(self, message):
|
||||||
if self.twitchChat_cooldown.isCooldownActive("twitchChat") == False:
|
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
||||||
self.chat.send(message)
|
self.chat.send(message)
|
||||||
self.twitchChat_cooldown.actionTrigger("twitchChat")
|
self.cooldownModule.actionTrigger("twitchChat")
|
||||||
|
|
||||||
def send_whisper(self, user, message):
|
def send_whisper(self, user, message):
|
||||||
pass
|
pass
|
||||||
@ -73,7 +73,7 @@ class Twitch_Module():
|
|||||||
if message.channel == "thecuriousnerd":
|
if message.channel == "thecuriousnerd":
|
||||||
|
|
||||||
if not self.isSenderBot(message):
|
if not self.isSenderBot(message):
|
||||||
if self.twitchChat_cooldown.isCooldownActive("twitchChat") == False:
|
if self.cooldownModule.isCooldownActive("twitchChat") == False:
|
||||||
self.eval_commands(message)
|
self.eval_commands(message)
|
||||||
#elif message.channel == message.sender:
|
#elif message.channel == message.sender:
|
||||||
#self.eval_commands(message)
|
#self.eval_commands(message)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user