added BottomJoke

This commit is contained in:
jsl12
2022-01-28 12:49:45 -06:00
parent 7a6ccf1721
commit ec78038d28
3 changed files with 18 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import re
import nextcord as discord
from nextcord import Message, Client
class Joke:
@@ -8,15 +8,15 @@ class Joke:
def regex(self) -> re.Pattern:
raise NotImplementedError
def scan(self, message: discord.Message) -> re.Match:
def scan(self, message: Message) -> re.Match:
return self.regex.search(message.content)
async def respond(self, message: discord.Message, client: discord.Client, match: re.Match):
async def respond(self, message: Message, client: Client, match: re.Match):
raise NotImplementedError
class GifJoke(Joke):
url: str
async def respond(self, message: discord.Message, client: discord.Client, match: re.Match):
async def respond(self, message: Message, client: Client, match: re.Match):
await message.reply(self.url)

View File

@@ -68,6 +68,15 @@ class BlackJoke(base.Joke):
await msg.add_reaction(utils.get(client.emojis, name='kaylon'))
class BottomJoke(base.Joke):
@property
def regex(self) -> re.Pattern:
return re.compile('(?:\A|[^\w])bottom', re.IGNORECASE)
async def respond(self, message: Message, client: Client, match: re.Match):
await message.add_reaction(utils.get(client.emojis, name='kaylon'))
class AssJoke(base.Joke):
@property
def regex(self) -> re.Pattern: