File tree 5 files changed +103
-0
lines changed
5 files changed +103
-0
lines changed Original file line number Diff line number Diff line change
1
+ .env
2
+ .venv
Original file line number Diff line number Diff line change
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import discord
4
+
5
+ load_dotenv ()
6
+ token = os .getenv ("BOT_DISCORD" )
7
+
8
+ intents = discord .Intents .all ()
9
+ client = discord .Client (intents = intents )
10
+
11
+ client .run (token = token )
Original file line number Diff line number Diff line change
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import discord
4
+
5
+ load_dotenv ()
6
+
7
+ intents = discord .Intents .all ()
8
+ client = discord .Client (intents = intents )
9
+
10
+ @client .event
11
+ async def on_ready ():
12
+ print (f"Le bot discord est prêt { client .user } " )
13
+
14
+
15
+ @client .event
16
+ async def on_message (message ):
17
+ if message .author == client .user :
18
+ return
19
+ elif message .content .startswith ('!bonjour' ):
20
+ await message .channel .send ('Bonjour !' )
21
+
22
+
23
+ @client .event
24
+ async def on_member_join (member ):
25
+ welcome_channel_id = os .getenv ("WELCOME_CHANNEL_ID" )
26
+ channel = client .get_partial_messageable (welcome_channel_id )
27
+ await channel .send (f"Bienvenue { member .name } " )
28
+
29
+
30
+ token = os .getenv ("BOT_DISCORD" )
31
+ client .run (token = token )
Original file line number Diff line number Diff line change
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import discord
4
+ from discord .ext import commands
5
+
6
+ load_dotenv ()
7
+
8
+ intents = discord .Intents .all ()
9
+ client = discord .Client (intents = intents )
10
+
11
+ bot = commands .Bot (command_prefix = "!" , intents = intents )
12
+
13
+ @bot .command ()
14
+ async def ping (context ):
15
+ await context .send ("Pong" )
16
+
17
+
18
+ @bot .command ()
19
+ async def aide (context ):
20
+ embed = discord .Embed (
21
+ title = "Commandes" ,
22
+ description = "Une liste des commandes du serveur" ,
23
+ colour = discord .Colour .random ()
24
+ )
25
+ embed .set_thumbnail (url = "https://www.commentcoder.com/favicon.ico" )
26
+ embed .add_field (name = "!ping" , value = "Répond Pong" )
27
+ await context .send (embed = embed )
28
+
29
+
30
+ token = os .getenv ("BOT_DISCORD" )
31
+ bot .run (token = token )
Original file line number Diff line number Diff line change
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import discord
4
+ from discord .ext import commands
5
+
6
+ load_dotenv ()
7
+
8
+ intents = discord .Intents .all ()
9
+ client = discord .Client (intents = intents )
10
+
11
+ bot = commands .Bot (command_prefix = "!" , intents = intents )
12
+
13
+ @bot .command ()
14
+ #async def kick(context, member):
15
+ async def kick (context , member : discord .Member ):
16
+ #await context.guild.kick(member)
17
+ await context .guild .kick (member , reason = "Raison" )
18
+
19
+ @bot .command ()
20
+ async def ban (context , member ):
21
+ pass
22
+
23
+ @bot .command ()
24
+ async def unban (context , member ):
25
+ pass
26
+
27
+ token = os .getenv ("BOT_DISCORD" )
28
+ bot .run (token = token )
You can’t perform that action at this time.
0 commit comments