Merge branch 'master' into Discord_Verify
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from functions import checks
|
||||
from functions import checks, bannedWords, embeds
|
||||
|
||||
|
||||
class ModCommands(commands.Cog):
|
||||
@@ -15,15 +15,51 @@ class ModCommands(commands.Cog):
|
||||
# Delete the original message
|
||||
await ctx.message.delete()
|
||||
|
||||
# Attach the server icon as a file
|
||||
file = discord.File("files/images/server_icon.png", filename="icon.png")
|
||||
|
||||
# Set up the embed
|
||||
embed = discord.Embed(colour=discord.Colour.orange())
|
||||
embed.set_author(name=ctx.author.display_name, icon_url="attachment://icon.png")
|
||||
embed, file = embeds.modEmbed(ctx.author.display_name)
|
||||
embed.description = arg
|
||||
await ctx.send(embed=embed, file=file)
|
||||
|
||||
@commands.command(name="Blacklist", aliases=["Bl"])
|
||||
@commands.check(checks.isModPlus)
|
||||
async def blacklist(self, ctx, word=None):
|
||||
if word is None:
|
||||
return await ctx.send("You did not provide a word to blacklist.")
|
||||
|
||||
if not bannedWords.ban_word(word):
|
||||
await ctx.message.add_reaction("❌")
|
||||
return await ctx.send("This word has already been blacklisted.")
|
||||
|
||||
await ctx.message.add_reaction("✅")
|
||||
self.client.banned_words.append(word.lower())
|
||||
return await ctx.send("Blacklisted **{}**.".format(word))
|
||||
|
||||
@commands.command(name="Whitelist", aliases=["Wl"])
|
||||
async def whitelist(self, ctx, word=None):
|
||||
if word is None:
|
||||
return await ctx.send("You did not provide a word to whitelist.")
|
||||
|
||||
if not bannedWords.remove_word(word):
|
||||
await ctx.message.add_reaction("❌")
|
||||
return await ctx.send("This word has not been blacklisted.")
|
||||
|
||||
await ctx.message.add_reaction("✅")
|
||||
self.client.banned_words.remove(word.lower())
|
||||
return await ctx.send("Whitelisted **{}**.".format(word))
|
||||
|
||||
@commands.command(name="Blacklisted", aliases=["Words"])
|
||||
async def bannedwords(self, ctx):
|
||||
embed, file = embeds.modEmbed("Blacklisted Words")
|
||||
|
||||
banned = sorted(self.client.banned_words)
|
||||
|
||||
# Can't send empty embed
|
||||
if not banned:
|
||||
embed.description = "No words have been blacklisted yet."
|
||||
else:
|
||||
embed.description = " - ".join(banned)
|
||||
|
||||
return await ctx.send(embed=embed, file=file)
|
||||
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(ModCommands(client))
|
||||
client.add_cog(ModCommands(client))
|
||||
|
||||
Reference in New Issue
Block a user