async def autorole_remove(self, ctx, role: discord.Role): """Remove an autorole from the list""" if str(ctx.guild.id) not in self.data: if self.data == {}: return await ctx.send("Error retrieving data. Please try again in a minute.") return await ctx.send("This guild has no auto-roles!") if str(role.id) not in self.data[str(ctx.guild.id)].keys(): return await ctx.send(f"That role is not in your autoroles!\nrun `{ctx.prefix}autorole` to get a list.") del self.data[str(ctx.guild.id)][str(role.id)] json.handle_modify('./data/autorole.json', newdata=self.data, indent=1, backup=True) await ctx.send(f"Removed {role.id} from autoroles. it may take up to 10 seconds to apply.")
def setup(self, guild_id: str): data = json_mngr.read('./data/logs.json') data[guild_id] = { "warns": {}, "mutes": {}, "unmutes": {}, "kicks": {}, "bans": {}, 'id': 0 } json_mngr.handle_modify('./data/logs.json', newdata=data, indent=2, backup=True)
async def gcunban(self, ctx, user: discord.User): """ban someone from using the global chat""" data = json_mngr.read('./data/gcb.json') if str(user.id) not in data.keys(): return await ctx.send( f"that user is not banned! are they just locked?") del data[str(user.id)] json_mngr.handle_modify('./data/gcb.json', newdata=data, indent=2, backup=True) await ctx.message.add_reaction(self.success)
async def gcban(self, ctx, user: discord.User, *, reason: commands.clean_content): """ban someone from using the global chat""" data = json_mngr.read('./data/gcb.json') if str(user.id) in data.keys(): return await ctx.send( f"that user is already banned, for {data[str(user.id)][0]}") data[str(user.id)] = [reason, ctx.author.id] json_mngr.handle_modify('./data/gcb.json', newdata=data, indent=2, backup=True) await ctx.message.add_reaction(self.success)
async def addemoji_add(self, ctx, emoji: discord.Emoji): """Add an emoji to the emojis to be able to use that emoji idfk it adds the emoji for the base command""" data = json_mngr().read('./data/emojis.json') if str(emoji.id) in data.keys(): return await ctx.send("We already have that emoji!") data[str(emoji.id)] = { "id": emoji.id, "url": str(emoji.url), "name": emoji.name, "guild": ctx.guild.name, 'submitter': str(ctx.author) } json_mngr.handle_modify('./data/emojis.json', newdata=data, backup=True) await ctx.send("Added to the list.")