"Je suis" feature
This commit is contained in:
parent
b82d1bbf86
commit
94299e0336
24
main.py
24
main.py
|
@ -42,12 +42,28 @@ class MyClient(commands.Bot):
|
||||||
print(f"Admins : {', '.join([m.name for m in team.members])}")
|
print(f"Admins : {', '.join([m.name for m in team.members])}")
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
async def on_message(self, msg):
|
async def on_message(self, msg: discord.Message):
|
||||||
p = re.compile("[qQ]uoi[ \\.!?;\"»]*$")
|
# quoicoubot
|
||||||
print(f"{msg!r}")
|
quoi = re.compile("[qQ]uoi[ \\.!?;\"»]*$")
|
||||||
if p.search(msg.content) is not None:
|
if quoi.search(msg.content) is not None:
|
||||||
await msg.reply("Quoicoubeh !")
|
await msg.reply("Quoicoubeh !")
|
||||||
|
|
||||||
|
# je suis
|
||||||
|
je_suis = "je suis "
|
||||||
|
if msg.content.lower().startswith(je_suis): # détection
|
||||||
|
words = msg.content[len(je_suis):].split(' ')
|
||||||
|
new_pseudo = "" # pseudo creation (do not split a word)
|
||||||
|
for word in words:
|
||||||
|
if (len(new_pseudo) + len(word) + 1) > 32:
|
||||||
|
break
|
||||||
|
new_pseudo += " " + word
|
||||||
|
if new_pseudo != "":
|
||||||
|
member = msg.author
|
||||||
|
try:
|
||||||
|
await member.edit(nick=new_pseudo, reason="Il est " + new_pseudo)
|
||||||
|
except discord.Forbidden:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
client = MyClient()
|
client = MyClient()
|
||||||
|
|
Loading…
Reference in New Issue