async def action(self, message, *args, **kwargs): print("Registering") user = message.author conn = self.bot.conn if not member_exists(conn, user.id): insert_member(conn, self.bot, user) else: return message_data(message.channel, "User already registered") return message_data(message.channel, "User registered")
async def action(self, message, *args, **kwargs): user = message.author conn = self.bot.conn table = get_table(self.bot.debug) if not member_exists(conn, user.id, self.bot.debug): return message_data( message.channel, "User not registered. Use $register to register.") cur = conn.cursor() db_sql = f"""DELETE FROM {table} WHERE id = {user.id}""" dbfunc_run(db_sql, cur, conn) conn.commit() insert_member(conn, self.bot, user) return message_data(message.channel, "User registration reset")
async def action(self, message, *args, **kwargs): content = message.content l = " ".join(content.split()[1:]) opts = l.split("; ") if len(opts) < 2 or ";" not in content: return message_data( message.channel, message="Usage: `$choose choice1; choice2[; choice3...]`") chosen_opt = opts[random.randint(0, len(opts) - 1)] return message_data(message.channel, message="", embed={ "title": ":thinking:", "description": chosen_opt, "color": 53380 })
async def action(self, message, *args, **kwargs): content = message.content if len(message.channel_mentions) > 0: await self.remove_message(message) return message_data(message.channel_mentions[0], content[content.find('>') + 1:], args=[message])
async def action(self, message, *args, **kwargs): if isinstance(message.channel, (discord.DMChannel, discord.GroupChannel)): return message_data( message.channel, "I do not reply to private messages. If you have any questions, please message one of the mods." ) return None
async def action(self, message, *args, **kwargs): user = message.author content = message.content if len(content.split()) < 2: return message_data( message.channel, "No nickname requested, usage is $nickname [new nickname]") nickname = " ".join(content.split()[1:]) if len(nickname) > 32: return message_data(message.channel, "Nickname requested is too long") requests_channel = self.bot.client.get_channel( self.bot.config["requests_channel"]) message = await requests_channel.send( "Member {} is requesting a nickname change\nNew nickname: {}". format(user.display_name, nickname)) await self.nickname_request(message, user, nickname) return
async def debug_action(self, message, *args, **kwargs): m_a = message_author(message.content, message.author, self.bot.debug) cycle(self.bot.repeated_messages_dict[message.channel.id], m_a, self.bot.repeat_n) if is_repeat(self.bot.repeated_messages_dict[message.channel.id], self.bot.repeat_n): send = self.bot.repeated_messages_dict[ message.channel.id][-1].message flush(self.bot.repeated_messages_dict[message.channel.id]) return message_data(message.channel, send)
async def debug_action(self, message, *args, **kwargs): conn = self.bot.conn debug = self.bot.debug if not member_exists(conn, message.author.id, debug): return message_data( message.channel, "You aren't registered in my memory yet. Please register with $register first" ) await message.author.send("See you later!") return
async def action(self, user): conn = self.bot.conn if member_exists(conn, user.id): roles = sorted(self.bot.roles.items(), key=lambda x: x[1]) member = fetch_member_roles(conn, user.id, roles, self.bot.debug) member_roles = [ self.bot.client.get_guild(int( self.bot.config["server_id"])).get_role(role) for role in member ] nickname = fetch_member_nickname(conn, user.id, self.bot.debug) await restore_roles(user, member_roles, nickname) return message_data(user, "Your roles have been restored")
async def action(self, message, *args, **kwargs): if message.content.lower().strip() == "unsubscribe": return message_data(message.channel, get_catfact())
async def action(self, message, *args, **kwargs): return message_data(message.channel, get_catfact())