QoL: Automatically create bot invite URLs (#74)

* Automatically create an invite_url

* Change invite url log message
This commit is contained in:
TSRBerry 2023-09-11 21:24:23 +02:00 committed by GitHub
parent 351b9655e3
commit 3aa1149b10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -257,9 +257,20 @@ for wanted_json in wanted_jsons:
async def main(): async def main():
async with bot: async with bot:
if len(config.guild_whitelist) == 1:
invite_url = discord.utils.oauth_url(
config.client_id,
guild=discord.Object(config.guild_whitelist[0]),
disable_guild_select=True,
)
else:
invite_url = discord.utils.oauth_url(config.client_id)
log.info(f"\nInvite URL: {invite_url}\n")
for cog in config.initial_cogs: for cog in config.initial_cogs:
try: try:
await bot.load_extension(cog) await bot.load_extension(f"robocop_ng.{cog}")
except Exception as e: except Exception as e:
log.exception(f"Failed to load cog {cog}:", e) log.exception(f"Failed to load cog {cog}:", e)
await bot.start(config.token) await bot.start(config.token)

View file

@ -3,6 +3,7 @@ import hashlib
# Basic bot config, insert your token here, update description if you want # Basic bot config, insert your token here, update description if you want
prefixes = [".", "!"] prefixes = [".", "!"]
client_id = 0
token = "token-goes-here" token = "token-goes-here"
bot_description = "Robocop-NG, the moderation bot of ReSwitched." bot_description = "Robocop-NG, the moderation bot of ReSwitched."