async def leader(self, ctx, *raid_leader): """Sets the role to be used as raid leader in this guild.""" if not ctx.author.guild_permissions.administrator: await ctx.send( _("You must be an admin to change the raid leader role.")) return raid_leader = " ".join(raid_leader) delete = _("delete") reset = _("reset") default = _("default") if raid_leader in [delete, reset, default, ""]: res = remove_setting(self.conn, 'raid_leader', ctx.guild.id) if res: self.conn.commit() await ctx.send( _("Raid Leader role reset to `{0}`.").format( self.raid_leader_name)) else: await ctx.send(_("An error occurred.")) return res = add_setting(self.conn, 'raid_leader', ctx.guild.id, raid_leader) if res: self.conn.commit() await ctx.send( _("Raid Leader role set to `{0}`.").format(raid_leader)) else: await ctx.send(_("An error occurred.")) return
async def prefix(ctx, prefix): """Sets the command prefix to be used in this guild.""" if not ctx.author.guild_permissions.administrator: await ctx.send(_("You must be an admin to change the command prefix.")) return delete = _("delete") reset = _("reset") default = _("default") if prefix in [delete, reset, default]: res = remove_setting(conn, 'prefix', ctx.guild.id) if res: conn.commit() prefixes[ctx.guild.id] = default_prefix await ctx.send( _("Command prefix reset to `{0}`.").format(default_prefix)) else: await ctx.send(_("An error occurred.")) return res = add_setting(conn, 'prefix', ctx.guild.id, prefix) if res: conn.commit() prefixes[ctx.guild.id] = prefix await ctx.send(_("Command prefix set to `{0}`.").format(prefix)) else: await ctx.send(_("An error occurred.")) return
async def update_calendar(self, guild_id): res = select_one(self.conn, 'Settings', 'calendar', guild_id, 'guild_id') if not res: return result = res.split("/") chn_id = int(result[0]) msg_id = int(result[1]) chn = self.bot.get_channel(chn_id) try: msg = await chn.fetch_message(msg_id) except (AttributeError, discord.NotFound): logger.warning("Calendar post not found.") res = remove_setting(self.conn, 'calendar', guild_id) self.conn.commit() return embed = self.calendar_embed(guild_id) await msg.edit(embed=embed) await chn.send(_("A new run has been posted!"), delete_after=3600)