|
|
|
|
|
|
|
|
import time |
|
|
import time |
|
|
import discord |
|
|
import discord |
|
|
import datetime |
|
|
import datetime |
|
|
from discord.ext.commands import bot, group, guild_only, bot_has_permissions, has_permissions |
|
|
|
|
|
|
|
|
from discord.ext import commands |
|
|
|
|
|
from discord.ext.commands import bot |
|
|
|
|
|
|
|
|
from Roxbot import checks |
|
|
from Roxbot import checks |
|
|
from Roxbot.settings import guild_settings as gs |
|
|
from Roxbot.settings import guild_settings as gs |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
@guild_only() |
|
|
|
|
|
|
|
|
@commands.guild_only() |
|
|
@checks.is_admin_or_mod() |
|
|
@checks.is_admin_or_mod() |
|
|
@bot_has_permissions(manage_messages=True) |
|
|
|
|
|
|
|
|
@commands.bot_has_permissions(manage_messages=True) |
|
|
@bot.command() |
|
|
@bot.command() |
|
|
async def slowmode(self, ctx, time): |
|
|
async def slowmode(self, ctx, time): |
|
|
"""Puts the current channel in slowmode. |
|
|
"""Puts the current channel in slowmode. |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
@commands.has_permissions(manage_messages=True) |
|
|
|
|
|
@commands.bot_has_permissions(manage_messages=True, read_message_history=True) |
|
|
|
|
|
@commands.cooldown(1, 5) |
|
|
|
|
|
@bot.command() |
|
|
|
|
|
async def purge(self, ctx, limit=0,*, author: discord.Member = None): |
|
|
|
|
|
"""Purges messages from the text channel. |
|
|
|
|
|
Limit = Limit of messages to be deleted |
|
|
|
|
|
Author (optional) = If given, Roxbot will selectively only delete this user's messages.""" |
|
|
|
|
|
if author: |
|
|
|
|
|
predicate = lambda message: message.author.id == author.id |
|
|
|
|
|
else: |
|
|
|
|
|
predicate = None |
|
|
|
|
|
messages = await ctx.channel.purge(limit=limit, check=predicate) |
|
|
|
|
|
return await ctx.send("{} message(s) purged from chat.".format(len(messages))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@checks.is_admin_or_mod() |
|
|
@checks.is_admin_or_mod() |
|
|
@group() |
|
|
|
|
|
|
|
|
@commands.group() |
|
|
async def warn(self, ctx): |
|
|
async def warn(self, ctx): |
|
|
"""Group of commands handling warnings""" |
|
|
"""Group of commands handling warnings""" |
|
|
if ctx.invoked_subcommand is None: |
|
|
if ctx.invoked_subcommand is None: |
|
|
|
|
|
|
|
|
except KeyError: |
|
|
except KeyError: |
|
|
return await ctx.send("Could not find user in warning list.") |
|
|
return await ctx.send("Could not find user in warning list.") |
|
|
|
|
|
|
|
|
@has_permissions(kick_members=True) |
|
|
|
|
|
@bot_has_permissions(kick_members=True) |
|
|
|
|
|
|
|
|
@commands.has_permissions(kick_members=True) |
|
|
|
|
|
@commands.bot_has_permissions(kick_members=True) |
|
|
@bot.command() |
|
|
@bot.command() |
|
|
async def kick(self, ctx, member:discord.Member, *, reason = ""): |
|
|
async def kick(self, ctx, member:discord.Member, *, reason = ""): |
|
|
"""Kicks mentioned user. Allows you to give a reason.""" |
|
|
"""Kicks mentioned user. Allows you to give a reason.""" |
|
|
|
|
|
|
|
|
except discord.Forbidden: |
|
|
except discord.Forbidden: |
|
|
return await ctx.send("I can't kick the owner or users higher or equal to me.") |
|
|
return await ctx.send("I can't kick the owner or users higher or equal to me.") |
|
|
|
|
|
|
|
|
@has_permissions(ban_members=True) |
|
|
|
|
|
@bot_has_permissions(ban_members=True) |
|
|
|
|
|
|
|
|
@commands.has_permissions(ban_members=True) |
|
|
|
|
|
@commands.bot_has_permissions(ban_members=True) |
|
|
@bot.command() |
|
|
@bot.command() |
|
|
async def ban(self, ctx, member:discord.Member, *, reason = ""): |
|
|
async def ban(self, ctx, member:discord.Member, *, reason = ""): |
|
|
"""Bans mentioned user. Allows you to give a reason.""" |
|
|
"""Bans mentioned user. Allows you to give a reason.""" |
|
|
|
|
|
|
|
|
except discord.Forbidden: |
|
|
except discord.Forbidden: |
|
|
return await ctx.send("I can't kick the owner or users higher or equal to me.") |
|
|
return await ctx.send("I can't kick the owner or users higher or equal to me.") |
|
|
|
|
|
|
|
|
@has_permissions(ban_members=True) |
|
|
|
|
|
@bot_has_permissions(ban_members=True) |
|
|
|
|
|
|
|
|
@commands.has_permissions(ban_members=True) |
|
|
|
|
|
@commands.bot_has_permissions(ban_members=True) |
|
|
@bot.command() |
|
|
@bot.command() |
|
|
async def unban(self, ctx, member:discord.Member, *, reason = ""): |
|
|
async def unban(self, ctx, member:discord.Member, *, reason = ""): |
|
|
"""Unbans mentioned user. Allows you to give a reason.""" |
|
|
"""Unbans mentioned user. Allows you to give a reason.""" |