Allow creating admins from interaction menu
This commit is contained in:
parent
75140a5b58
commit
8a6b8ee32a
1 changed files with 8 additions and 1 deletions
|
@ -82,6 +82,10 @@ async function* _interact({data, guild_id}, {api}) {
|
||||||
label: "Moderator",
|
label: "Moderator",
|
||||||
value: "moderator",
|
value: "moderator",
|
||||||
default: userPower >= 50 && userPower < 100
|
default: userPower >= 50 && userPower < 100
|
||||||
|
}, {
|
||||||
|
label: "Admin (you cannot undo this!)",
|
||||||
|
value: "admin",
|
||||||
|
default: userPower === 100
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -103,7 +107,10 @@ async function* _interactEdit({data, guild_id, message}, {api}) {
|
||||||
assert(mxid)
|
assert(mxid)
|
||||||
|
|
||||||
const permission = data.values[0]
|
const permission = data.values[0]
|
||||||
const power = permission === "moderator" ? 50 : 0
|
const power =
|
||||||
|
( permission === "admin" ? 100
|
||||||
|
: permission === "moderator" ? 50
|
||||||
|
: 0)
|
||||||
|
|
||||||
yield {createInteractionResponse: {
|
yield {createInteractionResponse: {
|
||||||
type: DiscordTypes.InteractionResponseType.UpdateMessage,
|
type: DiscordTypes.InteractionResponseType.UpdateMessage,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue