commit
d4fb600d9a
4 changed files with 20 additions and 11 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
.env
|
||||
env
|
||||
env
|
||||
__pycache__
|
||||
5
bot.py
5
bot.py
|
|
@ -7,10 +7,7 @@ client = commands.Bot(command_prefix= 'd!')
|
|||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
print(f'{client.user.name} is ready.')
|
||||
# print(f'Bot is in {len(client.guilds)} guilds.')
|
||||
# print(f'Guilds have {len(client.users)} members.')
|
||||
await client.change_presence(activity=discord.Streaming(name="Click the link!", url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"))
|
||||
print(f'{client.user.name} is online.')
|
||||
|
||||
@client.command()
|
||||
async def load(ctx, extension):
|
||||
|
|
|
|||
|
|
@ -10,9 +10,21 @@ class ModerationCog(commands.Cog):
|
|||
@commands.command()
|
||||
@commands.has_permissions(kick_members = True)
|
||||
async def kick(self, ctx, member : discord.Member, *, reason="No reason provided."):
|
||||
await ctx.send(member.mention + " has been kicked.")
|
||||
await member.send("You have been kicked from the server because: " + reason)
|
||||
await member.kick(reason=reason)
|
||||
try:
|
||||
await member.kick(reason=reason)
|
||||
await ctx.send(member.mention + " has been kicked.")
|
||||
except:
|
||||
await ctx.send(f"Unable to kick {member.mention}.\nIs {member.mention} at the same role level or higher than {self.client.user.name}?")
|
||||
|
||||
|
||||
@commands.command()
|
||||
@commands.has_permissions(ban_members = True)
|
||||
async def ban(self, ctx, member : discord.Member, *, reason="No reason provided."):
|
||||
try:
|
||||
await member.ban(reason=reason)
|
||||
await ctx.send(member.mention + " has been banned.")
|
||||
except:
|
||||
await ctx.send(f"Unable to ban {member.mention}.\nIs {member.mention} at the same role level or higher than {self.client.user.name}?")
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(ModerationCog(client))
|
||||
|
|
@ -9,8 +9,7 @@ class PingCog(commands.Cog):
|
|||
# Commands
|
||||
@commands.command(aliases=['latency'])
|
||||
async def ping(self, ctx):
|
||||
# await ctx.send(f'Pong! {client.latency}ms')
|
||||
await ctx.send('Pong!')
|
||||
|
||||
await ctx.send(f'Pong! {round(self.client.latency * 1000)}ms')
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(PingCog(client))
|
||||
Loading…
Add table
Add a link
Reference in a new issue