import discord from discord.ext import commands from functions import checks, bannedWords, embeds class ModCommands(commands.Cog): def __init__(self, client): self.client = client def cog_check(self, ctx): return checks.isModPlus(ctx) @commands.command(name="Say") async def say(self, ctx, *, arg): # Delete the original message await ctx.message.delete() 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))