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):
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():
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)
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():