def get_prefix(client, message): if message.guild: prefix = client.configurations.get(message.guild.id, {}).get("admin", {}).get("prefix", "!") # logging.debug(f'[get_prefix] {message.guild}: {prefix}') return prefix else: return "!" # init yata bot bot = YataBot(configurations=configurations, command_prefix=get_prefix, bot_id=bot_id, main_server_id=main_server_id, github_token=github_token) bot.remove_command('help') # load classes bot.add_cog(Admin(bot)) if int(bot_id) in [1, 3]: bot.add_cog(Verify(bot)) bot.add_cog(Loot(bot)) bot.add_cog(Stocks(bot)) bot.add_cog(Racket(bot)) bot.add_cog(Revive(bot)) bot.add_cog(Crimes(bot)) bot.add_cog(API(bot))
def get_prefix(client, message): if message.guild: prefix = client.configurations.get(message.guild.id, {}).get("admin", {}).get("prefix", "!") return prefix else: return "!" # init yata bot bot = YataBot(configurations=configurations, command_prefix=get_prefix, bot_id=bot_id, main_server_id=main_server_id, github_token=github_token, master_key=master_key, database=database, intents=intents) bot.remove_command('help') # load classes bot.add_cog(Admin(bot)) # bot ids: # 1: Chappie (dev bot) # 2: Marvin (YATA server administrator) # 3: YATA (the public bot) # 4: JFK if int(bot_id) in [1]:
from cogs.revive import Revive from cogs.misc import Misc from cogs.crimes import Crimes # import includes from includes.yata_db import load_configurations # get basic config bot_id = os.environ.get("YATA_ID", 1) prefix = os.environ.get("BOT_PREFIX", "!") # get configurations from YATA's database token, configs, administrators = load_configurations(bot_id) # init yata bot bot = YataBot(configs=json.loads(configs), administrators=json.loads(administrators), command_prefix=prefix, bot_id=bot_id) bot.remove_command('help') # load classes bot.add_cog(Verify(bot)) bot.add_cog(Loot(bot)) bot.add_cog(Stocks(bot)) bot.add_cog(API(bot)) bot.add_cog(Chain(bot)) bot.add_cog(Admin(bot)) bot.add_cog(Revive(bot)) bot.add_cog(Misc(bot)) bot.add_cog(Crimes(bot)) # run bot bot.run(token)
prefix = os.environ.get("BOT_PREFIX", "!") # get configurations from YATA's database if os.environ.get("DB_CREDENTIALS", False): db_cred = json.loads(os.environ.get("DB_CREDENTIALS")) con = psycopg2.connect(**db_cred) cur = con.cursor() cur.execute(f"SELECT * FROM bot_discordapp WHERE id = {bot_id};") _, token, configs, _ = cur.fetchone() cur.close() con.close() # get custom configs (skipping YATA databse configurations) else: configs = os.environ.get("YATA_CONFIGS") token = os.environ.get("BOT_TOKEN") # init yata bot bot = YataBot(configs=json.loads(configs), command_prefix=prefix) # load classes bot.add_cog(Verify(bot)) bot.add_cog(Loot(bot)) bot.add_cog(Stocks(bot)) bot.add_cog(Misc(bot)) bot.add_cog(Repository(bot)) bot.add_cog(Chain(bot)) # run bot bot.run(token)