go: discord/modules: Add limits to change trust

master
Luther Wen Xu 2019-10-16 12:47:36 +07:00
parent b118fbd477
commit 68c0afd97c
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
2 changed files with 24 additions and 0 deletions

@ -132,6 +132,8 @@ const ChangeTrustSuccessTitle = "成功更新玩家评分 Update Player Score Su
const ChangeTrustSuccessDescription = "你对这名玩家的分数改变已被记录。\nThe score has been updated." const ChangeTrustSuccessDescription = "你对这名玩家的分数改变已被记录。\nThe score has been updated."
const ErrorChangeTrustTitle = "调整信誉分错误 Change Trust Error" const ErrorChangeTrustTitle = "调整信誉分错误 Change Trust Error"
const ErrorChangeTrustTargetNotFound = "无法寻找到改变目标。\nCannot find the target user." const ErrorChangeTrustTargetNotFound = "无法寻找到改变目标。\nCannot find the target user."
const ErrorChangeTrustSelf = "无法改变自己的分数。\nCannot set your own score."
const ErrorChangeTrustNotMember = "目标用户不是伺服器成员。\nTarget user is not a server member."
const ErrorChangeTrustRecentlyChanged = "你在一个月内设定过该名玩家的分数。你这次的更动没有被记录。\nYou have already changed your score for this player within the previous month. Your change was not recorded." const ErrorChangeTrustRecentlyChanged = "你在一个月内设定过该名玩家的分数。你这次的更动没有被记录。\nYou have already changed your score for this player within the previous month. Your change was not recorded."
const VoteSuggestionUsage = "!votesuggest <种类custom> <内容>\n!votesuggest <type: custom> <content>" const VoteSuggestionUsage = "!votesuggest <种类custom> <内容>\n!votesuggest <type: custom> <content>"

@ -26,6 +26,28 @@ var changeTrust = enforceDM(memberFilter(true, enforceArgumentCount(
return return
} }
if member.User.ID == m.Author.ID {
message.InitNewEmbed(
config.ErrorChangeTrustTitle,
config.ErrorChangeTrustSelf,
config.ErrorColour,
).Send(s, m.ChannelID)
}
isMember := false
for _, v := range member.Roles {
if v == config.MemberRoleID {
isMember = true
}
}
if !isMember {
message.InitNewEmbed(
config.ErrorChangeTrustTitle,
config.ErrorChangeTrustNotMember,
config.ErrorColour,
).Send(s, m.ChannelID)
}
embed := message.NewEmbed(). embed := message.NewEmbed().
SetTitle(config.ChangeTrustPromptTitle). SetTitle(config.ChangeTrustPromptTitle).
SetColour(config.ChangeTrustPromptColour). SetColour(config.ChangeTrustPromptColour).