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 = """
|
ABOUT = """
|
||||||
Ce bot a été développé par {user}
|
Ce bot a été développé par {user}
|
||||||
Code Source : https://gitlab.epicsparrow.com/Anselme/perefouras
|
Code Source : https://gitlab.epicsparrow.com/Anselme/perefouras
|
||||||
@ -95,15 +102,17 @@ class FourasModule(BaseModule):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if clue:
|
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
|
current_riddle["index"] + 1, formatted_riddle, clue
|
||||||
)
|
)
|
||||||
else:
|
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
|
current_riddle["index"] + 1, formatted_riddle
|
||||||
)
|
)
|
||||||
|
|
||||||
async def handle_message(self, message):
|
async def handle_message(self, message):
|
||||||
|
if message.author == self._client.user:
|
||||||
|
return
|
||||||
message_content = message.content.lower()
|
message_content = message.content.lower()
|
||||||
|
|
||||||
# command fouras
|
# command fouras
|
||||||
@ -128,6 +137,25 @@ class FourasModule(BaseModule):
|
|||||||
await message.channel.send(self.new_riddle(message.channel, index))
|
await message.channel.send(self.new_riddle(message.channel, index))
|
||||||
return
|
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
|
# command reload
|
||||||
if message_content == "reload_riddles":
|
if message_content == "reload_riddles":
|
||||||
self.load()
|
self.load()
|
||||||
@ -137,7 +165,7 @@ class FourasModule(BaseModule):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if message_content == "about fouras":
|
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(
|
await message.channel.send(
|
||||||
ABOUT.format(user=author_user.mention, url=API_URL)
|
ABOUT.format(user=author_user.mention, url=API_URL)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user