Пример #1
0
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}
Пример #2
0
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}
Пример #3
0
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}