Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2717a2c

Browse files
Merge pull request avinashkranjan#1567 from slayerrr12/master
Update main.py
2 parents 88bbc0d + 9b65c5c commit 2717a2c

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

‎Discord-Bot/main.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,52 @@
11
import random
2-
32
import discord
43
from discord.ext import commands
54

6-
# your token here, inside the ""
5+
# Your token here, inside the ""
76
TOKEN = ""
8-
# channel to send welcome messages to
7+
# Channel to send welcome messages to
98
WELCOME_CHANNEL = "welcome"
10-
# all the nicknames for the random_nickname command
9+
# All the nicknames for the random_nickname command
1110
NICKS = ["example1", "example2", "example3"]
1211

13-
# you can change the prefix here
12+
# You can change the prefix here
1413
bot = commands.Bot(command_prefix="!")
1514

1615

1716
@bot.event
1817
async def on_ready():
19-
print("bot started")
18+
print("Bot started")
2019

2120

2221
@bot.event
2322
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!")
3026

3127

3228
@commands.has_permissions(ban_members=True)
3329
@bot.command()
3430
async def ban(ctx, user: discord.Member):
3531
"""Ban the given user"""
3632
await ctx.guild.ban(user, delete_message_days=0)
37-
await ctx.send(f"banned {user}")
33+
await ctx.send(f"Banned {user}")
3834

3935

4036
@commands.has_permissions(ban_members=True)
4137
@bot.command()
4238
async def unban(ctx, user: discord.User):
43-
"Unban the given user"
39+
"""Unban the given user"""
4440
await ctx.guild.unban(user)
45-
await ctx.send(f"unbanned {user}")
41+
await ctx.send(f"Unbanned {user}")
4642

4743

4844
@commands.has_permissions(kick_members=True)
4945
@bot.command()
5046
async def kick(ctx, user: discord.User):
51-
"Kick the given user"
47+
"""Kick the given user"""
5248
await ctx.guild.kick(user)
53-
await ctx.send(f"kicked {user}")
49+
await ctx.send(f"Kicked {user}")
5450

5551

5652
@bot.command(aliases=["rnick"])
@@ -64,9 +60,9 @@ async def random_nick(ctx):
6460
@commands.has_permissions(manage_nicknames=True)
6561
@bot.command(aliases=["change_name"])
6662
async def change_nick(ctx, user: discord.Member, *, new_nick):
67-
"""Change somebody elses nickname."""
63+
"""Change somebody else's nickname"""
6864
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}`")
7066

7167

7268
if __name__ == "__main__":

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /