【发布时间】:2022-01-20 07:10:49
【问题描述】:
我既是 Discord 又是 Golang 新手,遇到了问题。
我正在尝试帮助某人创建自定义命令,以让 Discord 的 YAGPDB.xyz 机器人将消息从一个线程移动到另一个线程。主脚本执行实际工作,但输出有点错误:我们希望它输出消息的实际所有者(和时间戳),但它声明我(运行命令的人)是所有者。
我已将其范围缩小到这样一个事实,即当我将消息 ID 作为参数时,它保持为 int,我需要获取/实例化消息,以便我可以访问其属性,如作者,根据对此: https://docs.yagpdb.xyz/commands/custom-commands#the-message-template 似乎没有“消息”类型的特定参数,尽管有诸如 channel 和 member 之类的东西: https://docs.yagpdb.xyz/commands/custom-commands#require-arguments
所以我创建了一个测试脚本只是为了获取消息的作者详细信息:
{{$args := parseArgs 1 "Syntax is : '!getauthor (.MessageID to move)'"
(carg "int" "message ID")}}
{{$message:= ($args.Get 0)}}
{{$message.Author}}
这是输出:
An error caused the execution of the custom command template to stop:
Failed executing CC #9, line 5, row 10: executing "CC #9" at <$message.Author>: can't evaluate field Author in type int
4 {{$message:= ($args.Get 0)}}
5 {{$message.Author}}
任何帮助表示赞赏。
【问题讨论】:
标签: discord