how to get message author discord.py code example
Example 1: discord bot status python
await bot.change_presence(activity=discord.Game(name="a game"))
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
Example 2: discord.py
Docs = "https://discordpy.readthedocs.io/en/latest/"
PyPI = "pip install -U discord.py"
import discord
from discord.ext import commands
client = commands.Bot(comand_prefix='bot prefix here')
@client.event()
async def on_ready():
print(f"Bot online and logged in as {client.user}")
@client.command(aliases=["ms", "aliases!"])
async def ping(ctx, a_variable):
await ctx.send(f"Pong! {round(client.latency * 1000)}ms. Your input was {a_variable}")
client.run('your token here')
Example 3: how to get the author on discord.py
ctx.author
ctx.author.id