我只需要一件事-您可以帮助重写此简单代码(并立即给出现成的答案)。这段代码对我来说很重要,但是我不了解很多事情,我只能为您希望
我尽力了
# welcome-bot
## this bot will send a welcome message and assign a role
# import all necessary commands and libraries
import discord
import asyncio
client=discord.Client()
@client.event
async def on_ready():
print('logged in as')
print(client.user.name)
print(client.user.id)
print('-----')
newUserMessage = """ # customise this to the message you want to send new users
You
can
put
your
multiline
message
here!
"""
@client.event
async def on_member_join(member):
print("Recognised that a member called " + member.name + " joined")
await message.channel.send(member, newUserMessage)
print("Sent message to " + member.name)
# give member the steam role here
## to do this the bot must have 'Manage Roles' permission on server, and role to add must be lower than bot's top role
role = discord.utils.get(member.server.roles, name="name-of-your-role")
await message.channel.sends(member, role)
print("Added role '" + role.name + "' to " + member.name)
client.run('here token, i knew')
NameError:未定义名称“消息”