Add kick command
This commit is contained in:
parent
552fa1ba93
commit
5261a52002
@ -2,7 +2,7 @@
|
|||||||
# -*- coding: <encoding name> -*-
|
# -*- coding: <encoding name> -*-
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import os
|
import discord
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
class Upload:
|
class Upload:
|
||||||
@ -82,11 +82,28 @@ class Upload:
|
|||||||
await ctx.send(f'Loaded `{extension}`.')
|
await ctx.send(f'Loaded `{extension}`.')
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def err(self, ctx):
|
async def kick(self, ctx, member: discord.Member = None):
|
||||||
"""triggers error to test traceback"""
|
"""
|
||||||
await ctx.send(a)
|
Kick a discord member from your server.
|
||||||
|
Only contributors can use this command
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
- kick <discord.member>
|
||||||
|
|
||||||
|
"""
|
||||||
|
await ctx.trigger_typing()
|
||||||
|
if ctx.author.id not in self.bot.ownerlist:
|
||||||
|
return await ctx.send('Only my contributors can use me like this :blush:', delete_after=10)
|
||||||
|
|
||||||
|
if member is None:
|
||||||
|
await ctx.send('Are you sure you are capable of this command?')
|
||||||
|
try:
|
||||||
|
await member.kick()
|
||||||
|
await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
await ctx.send('You may not use this command you do not have permission in server:\n\n**`{ctx.guild.name}`**'
|
||||||
|
f'\n\n```py\n{e}\n```')
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Upload(bot))
|
bot.add_cog(Upload(bot))
|
||||||
Loading…
x
Reference in New Issue
Block a user