feat: add new permissions (#1411)

This commit is contained in:
Earlopain 2024-06-22 16:53:03 +02:00 committed by GitHub
parent 5f7833673e
commit 28f8d4252d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 158 additions and 43 deletions

View file

@ -35,7 +35,7 @@ func init() {
var ( var (
integerOptionMinValue = 1.0 integerOptionMinValue = 1.0
dmPermission = false dmPermission = false
defaultMemberPermissions int64 = discordgo.PermissionManageServer defaultMemberPermissions int64 = discordgo.PermissionManageGuild
commands = []*discordgo.ApplicationCommand{ commands = []*discordgo.ApplicationCommand{
{ {

View file

@ -2392,60 +2392,175 @@ type Poll struct {
// Constants for the different bit offsets of text channel permissions // Constants for the different bit offsets of text channel permissions
const ( const (
// Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels // Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels
PermissionReadMessages = 0x0000000000000400 PermissionReadMessages = 1 << 10
PermissionSendMessages = 0x0000000000000800
PermissionSendTTSMessages = 0x0000000000001000 // Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads).
PermissionManageMessages = 0x0000000000002000 PermissionSendMessages = 1 << 11
PermissionEmbedLinks = 0x0000000000004000
PermissionAttachFiles = 0x0000000000008000 // Allows for sending of /tts messages.
PermissionReadMessageHistory = 0x0000000000010000 PermissionSendTTSMessages = 1 << 12
PermissionMentionEveryone = 0x0000000000020000
PermissionUseExternalEmojis = 0x0000000000040000 // Allows for deletion of other users messages.
PermissionUseSlashCommands = 0x0000000080000000 PermissionManageMessages = 1 << 13
PermissionManageThreads = 0x0000000400000000
PermissionCreatePublicThreads = 0x0000000800000000 // Links sent by users with this permission will be auto-embedded.
PermissionCreatePrivateThreads = 0x0000001000000000 PermissionEmbedLinks = 1 << 14
PermissionUseExternalStickers = 0x0000002000000000
PermissionSendMessagesInThreads = 0x0000004000000000 // Allows for uploading images and files.
PermissionAttachFiles = 1 << 15
// Allows for reading of message history.
PermissionReadMessageHistory = 1 << 16
// Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel.
PermissionMentionEveryone = 1 << 17
// Allows the usage of custom emojis from other servers.
PermissionUseExternalEmojis = 1 << 18
// Deprecated: PermissionUseSlashCommands has been replaced by PermissionUseApplicationCommands
PermissionUseSlashCommands = 1 << 31
// Allows members to use application commands, including slash commands and context menu commands.
PermissionUseApplicationCommands = 1 << 31
// Allows for deleting and archiving threads, and viewing all private threads.
PermissionManageThreads = 1 << 34
// Allows for creating public and announcement threads.
PermissionCreatePublicThreads = 1 << 35
// Allows for creating private threads.
PermissionCreatePrivateThreads = 1 << 36
// Allows the usage of custom stickers from other servers.
PermissionUseExternalStickers = 1 << 37
// Allows for sending messages in threads.
PermissionSendMessagesInThreads = 1 << 38
// Allows sending voice messages.
PermissionSendVoiceMessages = 1 << 46
// Allows sending polls.
PermissionSendPolls = 1 << 49
// Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server.
PermissionUseExternalApps = 1 << 50
) )
// Constants for the different bit offsets of voice permissions // Constants for the different bit offsets of voice permissions
const ( const (
PermissionVoicePrioritySpeaker = 0x0000000000000100 // Allows for using priority speaker in a voice channel.
PermissionVoiceStreamVideo = 0x0000000000000200 PermissionVoicePrioritySpeaker = 1 << 8
PermissionVoiceConnect = 0x0000000000100000
PermissionVoiceSpeak = 0x0000000000200000 // Allows the user to go live.
PermissionVoiceMuteMembers = 0x0000000000400000 PermissionVoiceStreamVideo = 1 << 9
PermissionVoiceDeafenMembers = 0x0000000000800000
PermissionVoiceMoveMembers = 0x0000000001000000 // Allows for joining of a voice channel.
PermissionVoiceUseVAD = 0x0000000002000000 PermissionVoiceConnect = 1 << 20
PermissionVoiceRequestToSpeak = 0x0000000100000000
PermissionUseActivities = 0x0000008000000000 // Allows for speaking in a voice channel.
PermissionVoiceSpeak = 1 << 21
// Allows for muting members in a voice channel.
PermissionVoiceMuteMembers = 1 << 22
// Allows for deafening of members in a voice channel.
PermissionVoiceDeafenMembers = 1 << 23
// Allows for moving of members between voice channels.
PermissionVoiceMoveMembers = 1 << 24
// Allows for using voice-activity-detection in a voice channel.
PermissionVoiceUseVAD = 1 << 25
// Allows for requesting to speak in stage channels.
PermissionVoiceRequestToSpeak = 1 << 32
// Deprecated: PermissionUseActivities has been replaced by PermissionUseEmbeddedActivities.
PermissionUseActivities = 1 << 39
// Allows for using Activities (applications with the EMBEDDED flag) in a voice channel.
PermissionUseEmbeddedActivities = 1 << 39
// Allows for using soundboard in a voice channel.
PermissionUseSoundboard = 1 << 42
// Allows the usage of custom soundboard sounds from other servers.
PermissionUseExternalSounds = 1 << 45
) )
// Constants for general management. // Constants for general management.
const ( const (
PermissionChangeNickname = 0x0000000004000000 // Allows for modification of own nickname.
PermissionManageNicknames = 0x0000000008000000 PermissionChangeNickname = 1 << 26
PermissionManageRoles = 0x0000000010000000
PermissionManageWebhooks = 0x0000000020000000 // Allows for modification of other users nicknames.
PermissionManageEmojis = 0x0000000040000000 PermissionManageNicknames = 1 << 27
PermissionManageEvents = 0x0000000200000000
// Allows management and editing of roles.
PermissionManageRoles = 1 << 28
// Allows management and editing of webhooks.
PermissionManageWebhooks = 1 << 29
// Deprecated: PermissionManageEmojis has been replaced by PermissionManageGuildExpressions.
PermissionManageEmojis = 1 << 30
// Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users.
PermissionManageGuildExpressions = 1 << 30
// Allows for editing and deleting scheduled events created by all users.
PermissionManageEvents = 1 << 33
// Allows for viewing role subscription insights.
PermissionViewCreatorMonetizationAnalytics = 1 << 41
// Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user.
PermissionCreateGuildExpressions = 1 << 43
// Allows for creating scheduled events, and editing and deleting those created by the current user.
PermissionCreateEvents = 1 << 44
) )
// Constants for the different bit offsets of general permissions // Constants for the different bit offsets of general permissions
const ( const (
PermissionCreateInstantInvite = 0x0000000000000001 // Allows creation of instant invites.
PermissionKickMembers = 0x0000000000000002 PermissionCreateInstantInvite = 1 << 0
PermissionBanMembers = 0x0000000000000004
PermissionAdministrator = 0x0000000000000008 // Allows kicking members.
PermissionManageChannels = 0x0000000000000010 PermissionKickMembers = 1 << 1
PermissionManageServer = 0x0000000000000020
PermissionAddReactions = 0x0000000000000040 // Allows banning members.
PermissionViewAuditLogs = 0x0000000000000080 PermissionBanMembers = 1 << 2
PermissionViewChannel = 0x0000000000000400
PermissionViewGuildInsights = 0x0000000000080000 // Allows all permissions and bypasses channel permission overwrites.
PermissionModerateMembers = 0x0000010000000000 PermissionAdministrator = 1 << 3
// Allows management and editing of channels.
PermissionManageChannels = 1 << 4
// Deprecated: PermissionManageServer has been replaced by PermissionManageGuild.
PermissionManageServer = 1 << 5
// Allows management and editing of the guild.
PermissionManageGuild = 1 << 5
// Allows for the addition of reactions to messages.
PermissionAddReactions = 1 << 6
// Allows for viewing of audit logs.
PermissionViewAuditLogs = 1 << 7
// Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.
PermissionViewChannel = 1 << 10
// Allows for viewing guild insights.
PermissionViewGuildInsights = 1 << 19
// Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels.
PermissionModerateMembers = 1 << 40
PermissionAllText = PermissionViewChannel | PermissionAllText = PermissionViewChannel |
PermissionSendMessages | PermissionSendMessages |