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())
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))
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)
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
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)
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()))
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'])
def setup(bot: commands.Bot): cog = OneWordStory(bot) bot.add_cog(cog)
def setup(bot: commands.Bot): bot.add_cog(Gpt2(bot))
async def setup(bot: commands.Bot): cog = Purpose(bot) #data_manager.load_bundled_data(cog, __file__) bot.add_cog(cog)
def setup(bot: commands.Bot): cog = Countdown_Tagger(bot) bot.add_cog(cog)
def setup(bot: commands.Bot): cog = Audio(bot) bot.add_cog(cog)
def setup(bot: commands.Bot): bot.add_cog(Rainbow(bot))
def setup(bot: commands.Bot): bot.add_cog(Braacket(bot))
async def setup(bot: commands.Bot): cog = TestCog(bot) data_manager.load_bundled_data(cog, __file__) bot.add_cog(cog)
async def setup(bot: commands.Bot): cog = Audio(bot) await cog.initialize() bot.add_cog(cog)
def setup(bot: commands.Bot): cog = Screw(bot) bot.add_cog(cog)