|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import os
- import discord
-
- TOKEN = ""
-
- 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('!reaction'):
- await message.channel.send('Je place une reaction sur le message auteur')
- await message.add_reaction(':smile:662985629256122378')
-
-
- 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 un bot magnifique')
- except discord.errors.HTTPException :
- await message.channel.send('Discord vient de bloquer le changement d avatar')
-
- @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)
|