async def searchemoji(self, opcode, args): emotes = [] for guild in self.bot.guilds: for emoji in guild.emojis: if rockutils.regex_text(emoji.name, [args]): emotes.append([ str(emoji.guild_id), str(emoji.id), emoji.animated, emoji.name ]) return {"success": True, "data": emotes}
async def userfind(self, opcode, args): search_type = args[0] term = args[1] results = [] if search_type == 0: guild = self.bot.get_user(term) if guild: results = self.bot.serialiser.guild(guild) elif search_type == 1: for user in self.bot.users: if rockutils.regex_text(user.name, [term]): results.append(self.bot.serializer.user(user)) return {"success": True, "results": results}
async def guildsfind(self, opcode, args): print(f"opcode: {opcode}") print(f"args: {args}") search_type = args[0] term = args[1] results = [] if search_type == 0: guild = self.bot.get_guild(term) if guild: results = self.bot.serialiser.guild(guild) elif search_type == 1: for guild in self.bot.guilds: if rockutils.regex_text(guild.name, [term]): results.append(self.bot.serialiser.guild(guild)) return {"success": True, "results": results}