nuno 已修改 1 month ago. 還原成這個修訂版本
1 file changed, 25 insertions
poll.ts(檔案已創建)
| @@ -0,0 +1,25 @@ | |||
| 1 | + | export function createVoteEntry( | |
| 2 | + | userId: string, | |
| 3 | + | member: GuildMember, | |
| 4 | + | usermapKey: string | null, | |
| 5 | + | discordUsername: string | |
| 6 | + | ): Omit<VoteEntry, "votedAt" | "previousYesAt" | "previousNoAt" | "publicMessage"> { | |
| 7 | + | const serverNickname = member.nickname ?? null; | |
| 8 | + | const globalNickname = member.user.globalName ?? null; | |
| 9 | + | const displayName = serverNickname ?? globalNickname ?? discordUsername; | |
| 10 | + | ||
| 11 | + | const { getEffectiveCharacter } = require("./borrow"); | |
| 12 | + | const { char, borrowedFrom: bf } = usermapKey | |
| 13 | + | ? getEffectiveCharacter(usermapKey) | |
| 14 | + | : { char: null, borrowedFrom: null }; | |
| 15 | + | ||
| 16 | + | return { | |
| 17 | + | usermapKey: usermapKey ?? (undefined as any), | |
| 18 | + | displayName, | |
| 19 | + | characterName: char?.name, | |
| 20 | + | characterClass: char?.class, | |
| 21 | + | characterLevel: char?.level, | |
| 22 | + | characterNation: char?.nation ?? (resolveNation(member, usermapKey) ?? undefined), | |
| 23 | + | borrowedFrom: bf ?? undefined, | |
| 24 | + | }; | |
| 25 | + | } | |
上一頁
下一頁