bot: Fixed errors with int types
All checks were successful
Build Docker / Build Docker (push) Successful in 20s

This commit is contained in:
Nathan Woodburn 2023-08-12 17:05:35 +10:00
parent 2b0477aee2
commit a6717f597c
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 11 additions and 4 deletions

View File

@ -3,7 +3,14 @@ Discord bot for the Woodburn server.
This bot adds some Handshake related commands to the server. This bot adds some Handshake related commands to the server.
## Commands ## Commands
- `/shortlink <url>` - Shorten a URL using Kutt.it (requires a Kutt API key) only allowed for specied user
- `/ping` - Check if the bot is online
- `/dig <domain>` - Get the DNS records for a domain
- `/curl <url>` - Get the HTTPS response headers for a URL
- `/shortlink <url>` - Shorten a URL using Kutt.it (requires a Kutt API key & admin role)
- `/botstatus` - Update the bot status (requires admin role)
- `/invite` - Get an invite link for the Bot (not implemented properly dynamically yet)
# Setup # Setup

6
bot.py
View File

@ -7,10 +7,10 @@ import dns.resolver
load_dotenv() load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN') TOKEN = os.getenv('DISCORD_TOKEN')
ADMINID = os.getenv('ADMIN_ID') ADMINID = int(os.getenv('ADMIN_ID'))
KUTT_APIKEY=os.getenv('LINK_API_KEY') KUTT_APIKEY=os.getenv('LINK_API_KEY')
KUTT_URL=os.getenv('LINK_URL') KUTT_URL=os.getenv('LINK_URL')
LOG_CHANNEL = os.getenv('LOG_CHANNEL') LOG_CHANNEL = int(os.getenv('LOG_CHANNEL'))
intents = discord.Intents.default() intents = discord.Intents.default()
client = discord.Client(intents=intents) client = discord.Client(intents=intents)
@ -31,7 +31,7 @@ async def shortlink(ctx, link: str, name: str = None):
await log("User: " + str(ctx.user.name) + " tried to use the shortlink command") await log("User: " + str(ctx.user.name) + " tried to use the shortlink command")
await ctx.response.send_message("You don't have permission to use this command",ephemeral=True) await ctx.response.send_message("You don't have permission to use this command",ephemeral=True)
else: else:
url=f"https://{KUTT_URL}/api/v2/links" url=f"{KUTT_URL}/api/v2/links"
headers = {'X-API-KEY' : KUTT_APIKEY} headers = {'X-API-KEY' : KUTT_APIKEY}
data = {'target' : link, 'customurl' : name} data = {'target' : link, 'customurl' : name}