added broadcast and bug commands
This commit is contained in:
parent
b71b3ffb2e
commit
a48d4ec273
@ -11,6 +11,13 @@ API_URL = "".join(
|
||||
]
|
||||
)
|
||||
|
||||
MAINTAINER_ID = 151626081458192384
|
||||
|
||||
BUG_REPORT = """
|
||||
BUG REPORT from {user}:
|
||||
```{message}```
|
||||
"""
|
||||
|
||||
ABOUT = """
|
||||
Ce bot a été développé par {user}
|
||||
Code Source : https://gitlab.epicsparrow.com/Anselme/perefouras
|
||||
@ -95,15 +102,17 @@ class FourasModule(BaseModule):
|
||||
)
|
||||
|
||||
if clue:
|
||||
return "Énigme {0}:\n{1}\nQui suis-je ?\n{2}".format(
|
||||
return "Énigme {0}:\n{1}\n> Qui suis-je ?\n{2}".format(
|
||||
current_riddle["index"] + 1, formatted_riddle, clue
|
||||
)
|
||||
else:
|
||||
return "Énigme {0}:\n{1}\nQui suis-je ?".format(
|
||||
return "Énigme {0}:\n{1}\n> Qui suis-je ?".format(
|
||||
current_riddle["index"] + 1, formatted_riddle
|
||||
)
|
||||
|
||||
async def handle_message(self, message):
|
||||
if message.author == self._client.user:
|
||||
return
|
||||
message_content = message.content.lower()
|
||||
|
||||
# command fouras
|
||||
@ -128,6 +137,25 @@ class FourasModule(BaseModule):
|
||||
await message.channel.send(self.new_riddle(message.channel, index))
|
||||
return
|
||||
|
||||
if message_content.startswith("bug"):
|
||||
author_user = await self._client.fetch_user(MAINTAINER_ID)
|
||||
await author_user.send(
|
||||
BUG_REPORT.format(user=message.author.mention, message=message_content, json=self.save())
|
||||
)
|
||||
await message.channel.send(f'Rapport de bug envoyé à {author_user.mention}\nMerci de ton feedback !')
|
||||
return
|
||||
|
||||
broadcast_match = re.match(r"^broadcast\s+(\d+) (.*)", message_content)
|
||||
if broadcast_match and message.author.id == MAINTAINER_ID:
|
||||
index = int(broadcast_match.group(1))
|
||||
broadcast_message = broadcast_match.group(2)
|
||||
channel = await self._client.fetch_channel(index)
|
||||
if channel:
|
||||
await channel.send(broadcast_message)
|
||||
else:
|
||||
await message.channel.send(f'Invalid channel id : {index}')
|
||||
return
|
||||
|
||||
# command reload
|
||||
if message_content == "reload_riddles":
|
||||
self.load()
|
||||
@ -137,7 +165,7 @@ class FourasModule(BaseModule):
|
||||
return
|
||||
|
||||
if message_content == "about fouras":
|
||||
author_user = await self._client.fetch_user(151626081458192384)
|
||||
author_user = await self._client.fetch_user(MAINTAINER_ID)
|
||||
await message.channel.send(
|
||||
ABOUT.format(user=author_user.mention, url=API_URL)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user