Ejemplo n.º 1
0
async def setup(bot: commands.Bot):
    cog = Audio(bot)
    if not await cog.config.use_external_lavalink():
        await maybe_download_lavalink(bot.loop, cog)
        await start_lavalink_server(bot.loop)

    bot.add_cog(cog)
    bot.loop.create_task(cog.disconnect_timer())
    bot.loop.create_task(cog.init_config())
Ejemplo n.º 2
0
async def setup(bot: commands.Bot):
    cog = Soundboard(bot)

    await maybe_download_lavalink(bot.loop, cog)
    await start_lavalink_server(bot.loop)

    await cog.initialize()

    bot.add_cog(Soundboard(bot))
Ejemplo n.º 3
0
async def setup(bot: commands.Bot):
    cog = Audio(bot)
    if not await cog.config.use_external_lavalink():
        await maybe_download_lavalink(bot.loop, cog)
        await start_lavalink_server(bot.loop)

    await cog.initialize()

    bot.add_cog(cog)
Ejemplo n.º 4
0
    def from_json(cls, data: dict, bot: commands.Bot = None):
        ret = cls(data["name"], data["command"], data["creator"], global_=data["global"])

        if bot:
            ret.has_real_data = True
            ret.creator = bot.get_user(int(data["creator"]))
            guild = bot.get_guild(int(data["guild"]))
            ret.guild = guild
        else:
            ret.guild = data["guild"]

        ret.uses = data.get("uses", 0)
        return ret
Ejemplo n.º 5
0
 async def from_record(cls, bot: commands.Bot, config, record: dict):
     channel = bot.get_channel(record['channel_id'])
     message = await channel.fetch_message(record['message_id'])
     guild = channel.guild
     author = bot.get_user(record['author_id'])
     end_time = datetime.datetime.fromtimestamp(record['end_time'])
     return cls(bot=bot,
                config=config,
                message=message,
                channel=channel,
                author=author,
                title=record['title'],
                ending_message=record['ending_message'],
                end_time=end_time)
Ejemplo n.º 6
0
def txt_channel_finder(bot: commands.Bot,
                       chaninfo: str) -> List[discord.TextChannel]:
    """
    custom text channel finder
    """
    _id_regex = re.compile(r"([0-9]{15,21})$")

    def _get_id_match(argument):
        return _id_regex.match(argument)

    match = _get_id_match(chaninfo) or re.match(r"<#?([0-9]+)>$", chaninfo)

    if match is not None:

        def txt_check(c):
            assert match is not None, "mypy, removed from optimized..."  # nosec
            return isinstance(c, discord.TextChannel) and c.id == int(
                match.group(1))

    else:

        def txt_check(c):
            return isinstance(c, discord.TextChannel) and c.name == chaninfo

    return list(filter(txt_check, bot.get_all_channels()))
Ejemplo n.º 7
0
    def from_json(cls, data: dict, bot: commands.Bot = None):
        ret = cls(data["name"],
                  data["command"],
                  data["creator"],
                  global_=data["global"])

        if bot:
            ret.has_real_data = True
            ret.creator = bot.get_user(int(data["creator"]))
            guild = bot.get_guild(int(data["guild"]))
            ret.guild = guild
        else:
            ret.guild = data["guild"]

        ret.uses = data.get("uses", 0)
        return ret
Ejemplo n.º 8
0
 async def from_record(cls, bot: commands.Bot, config, record: dict):
     channel = bot.get_channel(record['channel_id'])
     message = await channel.fetch_message(record['message_id'])
     guild = channel.guild
     author = bot.get_user(record['author_id'])
     end_time = datetime.datetime.fromtimestamp(record['end_time'])
     roles = [guild.get_role(role)
              for role in record['roles']] if record['roles'] else None
     return cls(bot=bot,
                config=config,
                message=message,
                channel=channel,
                author=author,
                item=record['item'],
                ending_message=record['ending_message'],
                end_time=end_time,
                roles=roles,
                join_days=record['join_days'],
                winners=record['winners'])
Ejemplo n.º 9
0
def setup(bot: commands.Bot):
    cog = OneWordStory(bot)
    bot.add_cog(cog)
Ejemplo n.º 10
0
def setup(bot: commands.Bot):
    bot.add_cog(Gpt2(bot))
Ejemplo n.º 11
0
async def setup(bot: commands.Bot):
    cog = Purpose(bot)
    #data_manager.load_bundled_data(cog, __file__)
    bot.add_cog(cog)
Ejemplo n.º 12
0
def setup(bot: commands.Bot):

    cog = Countdown_Tagger(bot)
    bot.add_cog(cog)
Ejemplo n.º 13
0
def setup(bot: commands.Bot):
    cog = Audio(bot)
    bot.add_cog(cog)
Ejemplo n.º 14
0
def setup(bot: commands.Bot):
    bot.add_cog(Rainbow(bot))
Ejemplo n.º 15
0
def setup(bot: commands.Bot):
    bot.add_cog(Braacket(bot))
Ejemplo n.º 16
0
async def setup(bot: commands.Bot):
    cog = TestCog(bot)
    data_manager.load_bundled_data(cog, __file__)
    bot.add_cog(cog)
Ejemplo n.º 17
0
async def setup(bot: commands.Bot):
    cog = Audio(bot)
    await cog.initialize()
    bot.add_cog(cog)
Ejemplo n.º 18
0
def setup(bot: commands.Bot):
    cog = Screw(bot)
    bot.add_cog(cog)