aboutsummaryrefslogtreecommitdiff
path: root/modules/execute.py
diff options
context:
space:
mode:
authorRoman Gräf <roman.graef@gmail.com>2019-04-28 14:21:29 +0200
committerGitHub <noreply@github.com>2019-04-28 14:21:29 +0200
commitb1cb6d2bd26776319699ff0212887f0f1d794399 (patch)
treed47b8ed92a76ce2e2b851566e018b60822ab952e /modules/execute.py
parent55c6967967c91a3259e9af67ba61dcfdaaff5f9e (diff)
parent044142eb95301b70bc1fb2dab158b952f2badb09 (diff)
downloadevalbot-b1cb6d2bd26776319699ff0212887f0f1d794399.tar.gz
evalbot-b1cb6d2bd26776319699ff0212887f0f1d794399.tar.bz2
evalbot-b1cb6d2bd26776319699ff0212887f0f1d794399.zip
Merge pull request #1 from NoirPi/masterHEADmaster
Updated Bot to latest github.com Version of discord.py
Diffstat (limited to 'modules/execute.py')
-rw-r--r--modules/execute.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/execute.py b/modules/execute.py
index 21e8fa3..bdc4d3f 100644
--- a/modules/execute.py
+++ b/modules/execute.py
@@ -3,13 +3,15 @@ from collections import defaultdict
from datetime import datetime, timedelta
from typing import Pattern
-from discord import Embed, Message, Guild, TextChannel, Member
+from discord import Embed, Guild, Member, Message, TextChannel
+from discord.ext import commands
from discord.ext.commands import Bot
from compile_api import execute
CODE_BLOCK_REGEX: Pattern = re.compile("```(?P<lang>.*)\n(?P<code>[\\s\\S]*?)```")
-INPUT_BLOCK_REGEX: Pattern = re.compile("input[: \t\n]*```(?P<lang>.*)?\n(?P<text>[\\s\\S]*?)```", re.IGNORECASE)
+INPUT_BLOCK_REGEX: Pattern = \
+ re.compile("input[: \t\n]*```(?P<lang>.*)?\n(?P<text>[\\s\\S]*?)```", re.IGNORECASE)
PYTHON_3 = 24
NODEJS = 17
@@ -56,12 +58,13 @@ languages = {
}
-class ExecuteCog(object):
+class ExecuteCog(commands.Cog):
def __init__(self, bot: Bot):
self.bot: Bot = bot
self.last_messaged = defaultdict(lambda: datetime.fromtimestamp(0))
# noinspection PyMethodMayBeStatic
+ @commands.Cog.listener()
async def on_message(self, message: Message):
if message.guild is None:
return