bot: Log to discord channel
All checks were successful
Build Docker / Build Docker (push) Successful in 19s

This commit is contained in:
Nathan Woodburn 2023-08-11 16:49:20 +10:00
parent 756374d5f7
commit 8d5b04a7e8
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

11
bot.py
View File

@ -13,17 +13,21 @@ client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
activityMessage="over the server"
statusType="watching"
logChannel=1139449826287824996
# Commands
@tree.command(name="ping", description="Check bot connection")
async def ping(ctx):
print("Ping")
channel = client.get_channel(logChannel)
await channel.send("User: " + str(ctx.user.id) + " used ping command")
await ctx.response.send_message("Pong!",ephemeral=True)
@tree.command(name="shortlink", description="Shorten a link")
async def shortlink(ctx, link: str, name: str = None):
if (ctx.user.id != 892672018917519370):
print("User: " + str(ctx.user.id) + " tried to use the link command")
# Send a message in the log channel
channel = client.get_channel(logChannel)
await channel.send("User: " + str(ctx.user.id) + " tried to use the shortlink command")
await ctx.response.send_message("You don't have permission to use this command",ephemeral=True)
else:
APIKEY=os.getenv('LINK_API_KEY')
@ -43,7 +47,8 @@ async def shortlink(ctx, link: str, name: str = None):
@tree.command(name="botstatus", description="Set the bot status")
async def botstatus(ctx, message: str, statusmethod: str = None):
if (ctx.user.id != 892672018917519370):
print("User: " + str(ctx.user.id) + " tried to use the botstatus command")
channel=client.get_channel(logChannel)
await channel.send("User: " + str(ctx.user.id) + " tried to use the botstatus command")
await ctx.response.send_message("You don't have permission to use this command",ephemeral=True)
else:
global activityMessage