Exemple #1
0
    def __init__(self, bot: Bot):
        self.bot = bot
        self.config = SubRedis(bot.db, "events")

        self.errorlog = bot.errorlog

        self.awbw = bot.get_guild(313453805150928906)  # AWBW Guild
        self.channel = bot.get_channel(313453805150928906)  # AWBW General
        self.notifchannel = bot.get_channel(
            637877898560143363)  # BattleMaps-Notifs

        if self.awbw:
            self.sad_andy = get(self.awbw.emojis,
                                id=325608374526017536)  # :sad_andy: emoji
Exemple #2
0
    async def _init_timed_events(self, client: Bot):
        """Create a event task with a tick-rate of 1s

        Event will be dispatched every second with the
        number of seconds passed since cog load"""

        await self.bot.wait_until_ready()  # Wait for the bot to launch first
        client.secs = 0

        secs = 0  # Count number secs
        while True:
            client.dispatch("timer_update", secs)
            secs += 1
            client.secs = secs
            await sleep(1)
Exemple #3
0
    def __init__(self, bot: Bot):
        self.bot = bot

        # Store the currently loaded implementation of HelpCommand
        self._original_help_command = bot.help_command

        # Replace currently loaded help_command with ours and set this cog as cog so it's not uncategorized
        bot.help_command = HelpCommand(dm_help=self.bot.dm_help,
                                       field_limit=6,
                                       time_limit=120)
        bot.help_command.cog = self

        # Make send_help_for available as a coroutine method of Bot
        bot.send_help_for = bot.help_command.send_help_for

        # Dict to store active help sessions with paginated output
        self.active_help = dict()
Exemple #4
0
    def __init__(self, bot: Bot):
        self.bot = bot
        self.config = SubRedis(bot.db, "selfroles")

        self.errorlog = bot.errorlog

        self._selfroles = {g.id: [] for g in bot.guilds}

        for key in self.config.scan_iter(match=f"{self.config}:*"):
            guild = bot.get_guild(int(key.split(":")[-1]))
            if not guild:
                continue
            self._selfroles[guild.id] = []
            r_ids = [int(r_id) for r_id in self.config.smembers(key)]
            for role in guild.roles:
                if role.id in r_ids:
                    self._selfroles[guild.id].append(role.id)
Exemple #5
0
def setup(bot: Bot):
    """AdvanceWars"""
    bot.add_cog(AdvanceWars(bot))
Exemple #6
0
def setup(bot: Bot):
    """Poll"""
    bot.add_cog(Poll(bot))
Exemple #7
0
def setup(bot: Bot):
    """ModLogs"""
    bot.add_cog(ModLogs(bot))
Exemple #8
0
def setup(bot: Bot):
    bot.add_cog(Events(bot))
Exemple #9
0
def setup(bot: Bot):
    """Moderation"""
    bot.add_cog(Moderation(bot))
Exemple #10
0
def setup(bot: Bot):
    bot.add_cog(MiscCommands(bot))
Exemple #11
0
def setup(bot: Bot):
    """Admin"""
    bot.add_cog(Admin(bot))
Exemple #12
0
if DATA_CLOUD:
    db.update(user_data)
else:
    with open("Files/user_data.json", "w") as f:
        dump(user_data, f)

intents = Intents.default()
intents.presences = True

bot = Bot(
    description="Create server-specific avatars.",
    owner_ids=[331551368789622784],  # Ilexis
    status=Status.idle,
    activity=Activity(type=ActivityType.playing, name="with the mirror."),
    command_prefix="var:",
    config=config_data,
    database=db,
    user_data=user_data,
    defaults=DATA_DEFAULTS,
    auth=db["Tokens"],
    use_firebase=DATA_CLOUD)

# If a custom help command is created:
bot.remove_command("help")

print(f"[BOT INIT] Running in: {bot.cwd}\n"
      f"[BOT INIT] Discord API version: {__version__}")


@bot.event
async def on_ready():
Exemple #13
0
def setup(bot: Bot):
    """ConnectFour"""
    bot.add_cog(ConnectFour(bot))
Exemple #14
0
def setup(bot: Bot):
    bot.add_cog(ClosetCommands(bot))
Exemple #15
0
def setup(bot: Bot):
    bot.add_cog(VanityCommands(bot))
Exemple #16
0
def setup(bot: Bot):
    bot.add_cog(ModerationCommands(bot))
Exemple #17
0
    prefix = [prefix_config["default_prefix"]]
    if prefix_config["when_mentioned"]:
        prefix.extend(when_mentioned(client, msg))

    # If in a guild, check for guild-specific prefix
    if isinstance(msg.channel, TextChannel):
        guild_prefix = config.hget("prefix:guild", msg.channel.guild.id)
        if guild_prefix:
            prefix.append(guild_prefix)

    return prefix


bot = Bot(db=db,
          app_name=APP_NAME,
          command_prefix=command_prefix,
          **config.hgetall("instance"))


@bot.event
async def on_ready():
    """Coroutine called when bot is logged in and ready to receive commands"""

    # "Loading" status message
    loading = "around, setting up shop."
    await bot.change_presence(activity=Activity(name=loading, type=0))

    # Bot account metadata such as bot user ID and owner identity
    bot.app_info = await bot.application_info()
    bot.owner = bot.get_user(bot.app_info.owner.id)
Exemple #18
0
def setup(bot: Bot):
    """Timer"""
    bot.add_cog(Timer(bot))
Exemple #19
0
def setup(bot: Bot):
    """Events"""
    bot.add_cog(Events(bot))
Exemple #20
0
def setup(bot: Bot):
    """SelfRoles"""
    bot.add_cog(SelfRoles(bot))
Exemple #21
0
if DATA_CLOUD:
    db.update(user_data)
else:
    with open("Files/user_data.json", "w") as f:
        dump(user_data, f)

intents = Intents.default()

bot = Bot(
    description="Search, overview, and read doujins in Discord.",
    owner_ids=[331551368789622784],  # Ilexis
    status=Status.idle,
    activity=Activity(type=ActivityType.watching, name="hentai before work"),
    command_prefix="n!",
    config=config_data,
    database=db,
    user_data=user_data,
    defaults=DATA_DEFAULTS,
    auth=user_data["Tokens"],
    use_firebase=DATA_CLOUD,
    intents=intents)

# If a custom help command is created:
bot.remove_command("help")

print(f"[BOT INIT] Running in: {bot.cwd}\n"
      f"[BOT INIT] Discord API version: {__version__}")

mypath = "Storage"
for root, dirs, files in walk(mypath):
Exemple #22
0
found_data = deepcopy(config_data)  # Duplicate to avoid RuntimeError exception
for key in found_data:
    if key not in CONFIG_DEFAULTS:
        config_data.pop(key)  # Remove redundant data
        print(f"[REDUNDANCY] Invalid config \'{key}\' found. "
              f"Removed key from file.")

del found_data  # Remove variable from namespace

print("[] Configurations loaded from Serialized/bot_config.pkl")

bot = Bot(
    description="Change your profile picture for a specific server.",
    owner_ids=[331551368789622784,
               125435062127820800],  # DocterBotnikM500, SirThane
    activity=Activity(type=ActivityType.watching, name=f"Just woke up."),
    status=Status.idle,
    command_prefix="vpr:" if os.name == "posix" else "[:>",

    # Configurable via [p]bot
    config=config_data)

# To be replaced by custom help command
# TODO: Move to `help.py` when done
bot.remove_command("help")

print(f"[BOT INIT] Running in: {bot.cwd}\n"
      f"[BOT INIT] Discord API version: {__version__}")


@bot.event
async def on_ready():
Exemple #23
0
def setup(bot: Bot):
    """Help"""
    bot.add_cog(Help(bot))
Exemple #24
0
def setup(bot: Bot):
    """CogName"""
    bot.add_cog(GitHub(bot))
Exemple #25
0
def setup(bot: Bot):
    bot.add_cog(BlacklistCommands(bot))
Exemple #26
0
def setup(bot: Bot):
    bot.add_cog(REPL(bot))
Exemple #27
0
def setup(bot: Bot):
    """REPL"""
    bot.add_cog(REPL(bot))
Exemple #28
0
def setup(bot: Bot):
    """Player"""
    bot.add_cog(Player(bot))
Exemple #29
0
def setup(bot: Bot):
    bot.add_cog(BackgroundTasks(bot))
Exemple #30
0
def setup(bot: Bot) -> None:
    """REPL"""
    bot.add_cog(REPL(bot))