async def _customs(self, ctx, *args): """adds youngling and removes chirper roles""" roles = ["chirper", "chirper2", "chirper3", "chirper4"] users = get_users(ctx.message, *args) for user in users: await user.add_roles(self.bot.roles["youngling"]) await remove_roles(user, roles) msg = f"Removed access to rules/chirper for {user.mention}" await ctx.send(msg)
async def _thaw(self, ctx, *args): """Unfreezes a user""" users = get_users(ctx.message, *args) for user in users: await self.restore_roles(user) await remove_roles(user, ["freeze"]) msg = f"Unfroze user: {user.mention}" user_roles = await store_roles(user, 0) await ctx.send(msg)
async def _mod_logs(self, ctx, *args): users = get_users(ctx.message, *args) for user in users: try: log_count = self.execute(self.sql["MOD_LOGS"], (user.id, )).fetchone()[1] except Exception as exc: log_count = 0 msg = f"{user.mention} has {log_count} modlog(s)" await self.bot.logs.send(msg)
async def _freeze(self, ctx, *args): del_roles = ["chirper", "chirper2", "chirper3", "chirper4"] users = get_users(ctx.message, *args) for user in users: if (self.bot.roles["freeze"] in user.roles): msg = "{user_mention} is already frozen!".format( user_mention=user.mention) else: await user.add_roles(self.bot.roles["freeze"]) await store_roles(user, 1) await remove_roles(user, del_roles) msg = f"Froze user: {user.mention}" await ctx.send(msg)
async def _cool(self, ctx, *args): """cool a user and then add task to remove cool role""" if not self.can_cool(ctx): return users = get_users(ctx.message, *args) for user in users: if (self.bot.fun_roles["burning"] in user.roles): msg = "I can't cool {} they're burning".format(user.mention) await ctx.send(msg) return if not await self._change_temperature(ctx, user, "cool"): return coolin = create_task( self.temp_decay(user, self.bot.fun_roles["cold"]))
async def _warm(self, ctx, *args): """warm a user and then add task to remove warm role""" if not self.can_warm(ctx): return users = get_users(ctx.message, *args) for user in users: if (self.bot.fun_roles["permafrost"] in user.roles): msg = "I can't warm {} they're permafrozen".format( user.mention) await ctx.send(msg) return if not await self._change_temperature(ctx, user, "warm"): return # add role to user and start timer, remove role after timer # expires. warmin = create_task( self.temp_decay(user, self.bot.fun_roles["warm"]))
async def _warn(self, msg): args = msg.content.lower().split(" ")[1:] users = get_users(msg, *args) message = msg for index, user in enumerate(users): try: mod_log = (message.id + index, message.author.id, message.channel.id, message.channel.name, message.guild.id, message.clean_content, message.created_at, user.id, 0) last_row_id = self.execute(self.sql["ADD_MODLOG"], mod_log) mod_logs = self.execute(self.sql["MOD_LOGS"], (user.id, )).fetchone()[1] except IntegrityError: mod_log = (self.bot.last_row_id + index, message.author.id, message.channel.id, message.channel.name, message.guild.id, message.clean_content, message.created_at, user.id, 0) last_row_id = self.execute(self.sql["ADD_MODLOG"], mod_log) if mod_logs % 5 == 0: msg = f"{user.mention} has {mod_logs} modlog(s)" await self.bot.logs.send(msg)
async def _passport(self, ctx, *args): users = get_users(ctx.message, *args) for user in users: await user.remove_roles(self.bot.roles["youngling"]) msg = f"Granted access to rules for {user.mention}" await ctx.send(msg)