bot: Auto get admin id
All checks were successful
Build Docker / Build Docker (push) Successful in 20s

This commit is contained in:
Nathan Woodburn 2023-08-12 17:14:55 +10:00
parent a6717f597c
commit be888fac87
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
DISCORD_TOKEN=MYTOKEN
LINK_URL=https://l.woodburn.au
LINK_API_KEY=MYAPIKEY
ADMIN_ID=DISCORDID
LOG_CHANNEL=MYCHANNELID

View File

@ -17,7 +17,7 @@ This bot adds some Handshake related commands to the server.
## Docker
The easiest way to run this bot is to use Docker. You can use the following command to run the bot:
```bash
docker run -d -e DISCORD_TOKEN=<YOUR-BOT-TOKEN> -e LINK_API_KEY=<KUTT-API-KEY> -e LINK_URL=<KUTT-URL> -e ADMIN=<your-discord-userid> -e LOG_CHANNEL=<DISCORD-CHANNEL-ID> git.woodburn.au/nathanwoodburn/woodburn-bot:latest
docker run -d -e DISCORD_TOKEN=<YOUR-BOT-TOKEN> -e LINK_API_KEY=<KUTT-API-KEY> -e LINK_URL=<KUTT-URL> -e LOG_CHANNEL=<DISCORD-CHANNEL-ID> git.woodburn.au/nathanwoodburn/woodburn-bot:latest
```
## Manual

8
bot.py
View File

@ -7,7 +7,7 @@ import dns.resolver
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
ADMINID = int(os.getenv('ADMIN_ID'))
ADMINID = 0
KUTT_APIKEY=os.getenv('LINK_API_KEY')
KUTT_URL=os.getenv('LINK_URL')
LOG_CHANNEL = int(os.getenv('LOG_CHANNEL'))
@ -22,7 +22,6 @@ statusType="watching"
# Commands
@tree.command(name="ping", description="Check bot connection")
async def ping(ctx):
await log("User: " + str(ctx.user.name) + " used the ping command")
await ctx.response.send_message("Pong!",ephemeral=True)
@tree.command(name="shortlink", description="Shorten a link")
@ -123,8 +122,11 @@ def updateStatus():
# When the bot is ready
@client.event
async def on_ready():
global ADMINID
ADMINID = client.application.owner.id
await log("Bot is starting...")
await tree.sync()
print("Ready!")
updateStatus()
await log("Bot is ready")
client.run(TOKEN)