I\'m trying to code a simple bot using discord.py so i started with the fun commands like just to get the hang of the api
import discord
import asyncio
clien
While OP's issue is long resolved (and likely forgotten) -- If you're building a Discord bot in Python, it's still a bit difficult to find this information - hopefully this helps someone. If you're trying to use the @bot.command method - the following will work (in python3):
@bot.command(name='ping', help='Ping the bot to text name')
async def ping(ctx):
await ctx.send('Pong ' + format(ctx.author))
print("debug: " + dir(ctx.author))
If you want to display the nickname of the "author" (who called the command) you can use this instead":
@bot.command(name='ping', help='Ping the bot to text name')
async def ping(ctx):
# await ctx.send('Pong {0}'.format(ctx.author))
await ctx.send('Pong ' + format(ctx.author.display_name))
print("debug: " + dir(ctx.author))
Another helpful tip:
You can use dir(ctx.author) to see the attributes of the ctx.author object.