async def setup(self, ctx, args: str = None): guild = Guild(ctx.guild, self.bot) await guild.get_data() if args is None: await ctx.send("Welcome to setup manager") # TODO: make into embed desc = f"guild id: {guild.guild.id}\n\nstaff: {guild.staff}" await ctx.send(desc)
async def prefix(self, ctx): """Manage the prefix of the bot in the guild""" guild = Guild(ctx.guild, self.bot) await guild.get_data() prefixes = guild.prefix desc = "" for index, prefix in enumerate(prefixes): desc += f"{index+1}. {prefix}\n" await ctx.send(f"```{desc}```")
async def remove(self, ctx, rm: str): """remove a prefix from the bot""" guild = Guild(ctx.guild, self.bot) await guild.get_data() if rm in guild.prefix: guild.prefix.remove(rm) await guild.set_attribute("prefix", guild.prefix) await ctx.send(f"{rm} removed") else: await ctx.send("I do not have this prefix registered.")
async def add(self, ctx, new: str): """Add a prefix for the bot""" guild = Guild(ctx.guild, self.bot) await guild.get_data() if new in guild.prefix: await ctx.send("that's already a prefix :/") return else: await guild.set_attribute("prefix", guild.prefix + [new]) await ctx.send(f"added {new} to prefix")
async def is_staff(ctx): guild = Guild(ctx.guild, ctx.cog.bot) await guild.get_data() if guild.staff is None: raise GuildNotSetup( f" The guild {guild.guild.name} is not setup. Setup with {guild.prefix[0]}setup" ) if not guild.verified: return False if set([role.id for role in ctx.author.roles]) & set(guild.staff): return True else: return False
async def verify(self, ctx, verified: bool = True): guild = Guild(ctx.guild, self.bot) await guild.set_attribute("verified", verified) await ctx.send( f"{'Unv' if not verified else 'V'}erified {ctx.guild.name}")
async def staff(self, ctx, staff: discord.Role): """Set the staff role for the guild""" guild = Guild(ctx.guild, self.bot) await guild.get_data() await guild.set_attribute('staff', [staff.id]) await ctx.send(f"Successfully set staff role to {staff.name}")
async def set(self, ctx, prefix: str): guild = Guild(ctx.guild, self.bot) await guild.set_attribute("prefix", [prefix]) await ctx.send(f"Prefix for this server is now {prefix}")