commit 9628540cb76f302adf4583c21e15f32b058cf6c0 Author: Cinabre Date: Thu Jul 9 11:16:22 2020 +0200 first commit diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..844fc34 --- /dev/null +++ b/bot.py @@ -0,0 +1,42 @@ +import os +import discord + +TOKEN = "NzMwMTY4NjQwOTM4MTgwNjA4.XwYZ6A.jEH4JV6anoCO9un5KMxB4JKuFFs" + +client = discord.Client() + +@client.event +async def on_member_join(member): + await member.create_dm() + await member.dm_channel.send('Hi {member.name}, welcome to my Discord server!' ) + +@client.event +async def on_message(message): + #Si jamais l'autheur = le bot, ne pas repondre et quitter la fonction(return) + if message.author == client.user: + print("Ne pas repondre, auteur = bot") + return + # Exemple : si "happy birthday" est contenu dans le message = repondre + if 'Happy birthday' in message.content.lower(): + await message.channel.send('Happy Birthday!') + + if message.content.startswith('!adrien'): + await message.channel.send('La prison, la prison cheh') + + if message.content.startswith('!relooking'): + with open('../original.jpg', 'rb') as f: + try: + await client.user.edit(avatar=f.read()) + await message.channel.send('je suis la plus belle maintenant') + except discord.errors.HTTPException : + await message.channel.send('te chauffe pas, discord aime pas que tu changes d avatar aussi rapidement') + +@client.event +async def on_ready(): + print('Logged in as') + print(client.user.name) + print(client.user.id) + print('------') + await client.change_presence(activity=discord.Streaming(name="Watching Adrien Sleeping...", url='https://nyan.cat')) + await client.user.edit(username="Adrien's Nightmare") +client.run(TOKEN)