Procházet zdrojové kódy

first commit

master
Cinabre před 5 měsíci
revize
9628540cb7
1 změnil soubory, kde provedl 42 přidání a 0 odebrání
  1. +42
    -0
      bot.py

+ 42
- 0
bot.py Zobrazit soubor

@@ -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)

Načítá se…
Zrušit
Uložit