I use Python 3.7
import discord
client=discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author==client.user:
return
if message.content.startswith('Hi'):
wait message.channel.send('hello')
client.run ("Token")
User
class ment
can be used.Below is a sample code.
@client.event
async def on_message(message):
if message.author==client.user:
return
if message.content.startswith('Hi'):
msg = f "{message.author.ment} Hello!"
wait message.channel.send(msg)
f"..."
is the format string, verified to work with Python 3.7.2, discord.py 1.0.0a1691+gf686924.
© 2024 OneMinuteCode. All rights reserved.