bot: Log with name instead of ID
All checks were successful
Build Docker / Build Docker (push) Successful in 19s
All checks were successful
Build Docker / Build Docker (push) Successful in 19s
This commit is contained in:
parent
8d5b04a7e8
commit
b8b372c1d2
15
bot.py
15
bot.py
@ -18,16 +18,13 @@ logChannel=1139449826287824996
|
||||
# Commands
|
||||
@tree.command(name="ping", description="Check bot connection")
|
||||
async def ping(ctx):
|
||||
channel = client.get_channel(logChannel)
|
||||
await channel.send("User: " + str(ctx.user.id) + " used ping command")
|
||||
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")
|
||||
async def shortlink(ctx, link: str, name: str = None):
|
||||
if (ctx.user.id != 892672018917519370):
|
||||
# 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 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)
|
||||
else:
|
||||
APIKEY=os.getenv('LINK_API_KEY')
|
||||
@ -47,8 +44,7 @@ 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):
|
||||
channel=client.get_channel(logChannel)
|
||||
await channel.send("User: " + str(ctx.user.id) + " tried to use the botstatus command")
|
||||
await log("User: " + str(ctx.user.name) + " 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
|
||||
@ -61,6 +57,11 @@ async def botstatus(ctx, message: str, statusmethod: str = None):
|
||||
updateStatus()
|
||||
await ctx.response.send_message("Status updated",ephemeral=True)
|
||||
|
||||
|
||||
async def log(message):
|
||||
channel=client.get_channel(logChannel)
|
||||
await channel.send(message)
|
||||
|
||||
def updateStatus():
|
||||
global activityMessage
|
||||
global statusType
|
||||
|
Loading…
Reference in New Issue
Block a user