Browse Source

Quelques changements

master
P-E_R 10 months ago
parent
commit
abe81f1f47
3 changed files with 42 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. BIN
      __pycache__/config.cpython-37.pyc
  3. +41
    -0
      main.py

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
config.py

BIN
__pycache__/config.cpython-37.pyc View File


+ 41
- 0
main.py View File

@@ -0,0 +1,41 @@
import discord
from discord.ext import commands
from config import *

bot = commands.Bot(command_prefix=bot_prefix, description="C'est un bot développé pour le serveur Discord")

# Events
@bot.event
async def on_ready():
activity = discord.Activity(name='Nothing', type=discord.ActivityType.playing)
await bot.change_presence(activity=activity)

print("Name's bot :", bot.user.name, "\nBot's guilds :", len(bot.guilds))

@bot.event
async def on_member_join(member):
channel = bot.get_channel(631128273077927951)
await channel.send(f"Bienvenue à <@{member.id}> !")

@bot.event
async def on_member_remove(member):
channel = bot.get_channel(631128273077927951)
member_join = discord.Embed(title=None, description=f":wave: Bienvenue à {member.name} !")
member_join.color()

await channel.send(f"Au revoir à <@{member.id}> !")


# Commands
@bot.command()
async def ping(ctx):
await ctx.send(':ping_pong: !')

@bot.command()
async def test(ctx):
embed = discord.Embed(title="title", description="description")
embed.add_field(name="name of first field", value="value of first field", inline=True)
embed.set_footer(text="This is text")
await ctx.send(embed=embed)

bot.run(bot_token)

Loading…
Cancel
Save