1
1
import random
2
-
3
2
import discord
4
3
from discord .ext import commands
5
4
6
- # your token here, inside the ""
5
+ # Your token here, inside the ""
7
6
TOKEN = ""
8
- # channel to send welcome messages to
7
+ # Channel to send welcome messages to
9
8
WELCOME_CHANNEL = "welcome"
10
- # all the nicknames for the random_nickname command
9
+ # All the nicknames for the random_nickname command
11
10
NICKS = ["example1" , "example2" , "example3" ]
12
11
13
- # you can change the prefix here
12
+ # You can change the prefix here
14
13
bot = commands .Bot (command_prefix = "!" )
15
14
16
15
17
16
@bot .event
18
17
async def on_ready ():
19
- print ("bot started" )
18
+ print ("Bot started" )
20
19
21
20
22
21
@bot .event
23
22
async def on_member_join (member ):
24
- welcome_channel = discord .utils .get (member .guild .channels ,
25
- name = WELCOME_CHANNEL )
26
- # feel free to change this message!
27
- await welcome_channel .send (
28
- f"welcome { member .mention } , please read our rules and have a great time!"
29
- )
23
+ welcome_channel = discord .utils .get (member .guild .channels , name = WELCOME_CHANNEL )
24
+ # Feel free to change this message!
25
+ await welcome_channel .send (f"Welcome { member .mention } ! Please read our rules and have a great time!" )
30
26
31
27
32
28
@commands .has_permissions (ban_members = True )
33
29
@bot .command ()
34
30
async def ban (ctx , user : discord .Member ):
35
31
"""Ban the given user"""
36
32
await ctx .guild .ban (user , delete_message_days = 0 )
37
- await ctx .send (f"banned { user } " )
33
+ await ctx .send (f"Banned { user } " )
38
34
39
35
40
36
@commands .has_permissions (ban_members = True )
41
37
@bot .command ()
42
38
async def unban (ctx , user : discord .User ):
43
- "Unban the given user"
39
+ """ Unban the given user"" "
44
40
await ctx .guild .unban (user )
45
- await ctx .send (f"unbanned { user } " )
41
+ await ctx .send (f"Unbanned { user } " )
46
42
47
43
48
44
@commands .has_permissions (kick_members = True )
49
45
@bot .command ()
50
46
async def kick (ctx , user : discord .User ):
51
- "Kick the given user"
47
+ """ Kick the given user"" "
52
48
await ctx .guild .kick (user )
53
- await ctx .send (f"kicked { user } " )
49
+ await ctx .send (f"Kicked { user } " )
54
50
55
51
56
52
@bot .command (aliases = ["rnick" ])
@@ -64,9 +60,9 @@ async def random_nick(ctx):
64
60
@commands .has_permissions (manage_nicknames = True )
65
61
@bot .command (aliases = ["change_name" ])
66
62
async def change_nick (ctx , user : discord .Member , * , new_nick ):
67
- """Change somebody elses nickname. """
63
+ """Change somebody else's nickname"""
68
64
await user .edit (nick = new_nick )
69
- await ctx .send (f"Changed the nick of { user .mention } to `{ new_nick } `" )
65
+ await ctx .send (f"Changed the nickname of { user .mention } to `{ new_nick } `" )
70
66
71
67
72
68
if __name__ == "__main__" :
0 commit comments