added moderation and fixed sar
This commit is contained in:
parent
d16087139f
commit
6d03a04853
@ -3,3 +3,4 @@ contributors
|
|||||||
code
|
code
|
||||||
git
|
git
|
||||||
fun
|
fun
|
||||||
|
moderation
|
||||||
|
|||||||
@ -81,29 +81,5 @@ class Upload:
|
|||||||
else:
|
else:
|
||||||
await ctx.send(f'Loaded `{extension}`.')
|
await ctx.send(f'Loaded `{extension}`.')
|
||||||
|
|
||||||
@commands.command()
|
|
||||||
async def kick(self, ctx, member: discord.Member = None):
|
|
||||||
"""
|
|
||||||
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))
|
||||||
44
src/cogs/moderation.py
Normal file
44
src/cogs/moderation.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: <encoding name> -*-
|
||||||
|
|
||||||
|
from discord.ext import commands
|
||||||
|
import discord
|
||||||
|
|
||||||
|
class Moderation:
|
||||||
|
"""
|
||||||
|
Moderation Commands
|
||||||
|
"""
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def sar(self, ctx):
|
||||||
|
"""Assign or remove self assigned roles"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def kick(self, ctx, member: discord.Member = None):
|
||||||
|
"""
|
||||||
|
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):
|
||||||
|
bot.add_cog(Moderation(bot))
|
||||||
@ -26,7 +26,8 @@ exports.run = async function(client, message, args) {
|
|||||||
.setDescription("Usage: `S!sar [ get | remove | list ] [ number ]`")
|
.setDescription("Usage: `S!sar [ get | remove | list ] [ number ]`")
|
||||||
.addField("1. Heroku Helper", "S!sar get 2", true)
|
.addField("1. Heroku Helper", "S!sar get 2", true)
|
||||||
.addField("2. JS Helper", "S!sar get 3", true)
|
.addField("2. JS Helper", "S!sar get 3", true)
|
||||||
.addField("3. Rewrite Helper", "S!sar get 4", true);
|
.addField("3. Rewrite Helper", "S!sar get 4", true)
|
||||||
|
.setColor("AQUA");
|
||||||
|
|
||||||
return message.channel.send({
|
return message.channel.send({
|
||||||
embed: embed
|
embed: embed
|
||||||
@ -49,10 +50,12 @@ exports.run = async function(client, message, args) {
|
|||||||
|
|
||||||
case "get":
|
case "get":
|
||||||
message.member.addRole(roles[choice]);
|
message.member.addRole(roles[choice]);
|
||||||
|
message.channel.send("Added the role you specified!"); // confirmation message
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "remove":
|
case "remove":
|
||||||
message.member.removeRole(roles[choice]);
|
message.member.removeRole(roles[choice]);
|
||||||
|
message.channel.send("Removed the role you specified!"); // confirmation message
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -61,6 +64,4 @@ exports.run = async function(client, message, args) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message.channel.send("Added the role you wanted!"); // confirmation message
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user