文件: 78573462558784356
#这是一个ID
异步定义:
def module = sh(script: """awk -F',' '{ print \$2 "," \$3 "," \$4 }' releaseModules.txt | sort -u """, returnStdout: true).trim()
echo module
List lines = module.split( '\n' ).findAll { !it.startsWith( ',' ) }
def buildid
def Modname
lines.each {
List det1 = it.split(',')
buildid=det1[1].trim()
Modname = det1[0].trim()
tag= det1[2].trim()
echo Modname
echo buildid
echo tag
}
答案 0 :(得分:0)
1您需要的只是用户的ID。
2如果需要获取变量discord.User,请使用bot.get_user(id)。
3如果需要获取变量discord.Member,则使用message.guild.get_member(id)。
其中message.guild是发送消息的服务器
P.S每次需要将str(),int()或其他内容转换为机器人可以读取的变量时,都需要使用bot.get_或guild.get_。全部都有get _:https://discordpy.readthedocs.io/en/latest/search.html?q=get_&check_keywords=yes&area=default
答案 1 :(得分:0)
您可以使用discord.utils.get()
来吸引用户。
@bot.event
async def on_raw_reaction_add(payload):
with open("createteam.txt", "r", encoding = "utf-8") as file:
author_id = file.read()
member = discord.utils.get(payload.message.guild.members, id=int(author_id))
因此,您可以使用member
做任何您想做的事情。