Documentation
¶
Index ¶
- type DiscordAllowedMentions
- type DiscordAttachment
- type DiscordChannelUnit
- func (self *DiscordChannelUnit) Discord() IDiscordUnit
- func (self *DiscordChannelUnit) FetchMessage(messageId string) (IDiscordMessageUnit, error)
- func (self *DiscordChannelUnit) FetchMessages(limit int) ([]IDiscordMessageUnit, error)
- func (self *DiscordChannelUnit) Flags() discordgo.ChannelFlags
- func (self *DiscordChannelUnit) GetLastMessage() (IDiscordMessageUnit, error)
- func (self *DiscordChannelUnit) Guild() (IDiscordGuildUnit, error)
- func (self *DiscordChannelUnit) Id() string
- func (self *DiscordChannelUnit) NSFW() bool
- func (self *DiscordChannelUnit) Name() string
- func (self *DiscordChannelUnit) Native() *discordgo.Channel
- func (self *DiscordChannelUnit) Position() int
- func (self *DiscordChannelUnit) SendMessage(message string) (IDiscordMessageUnit, error)
- func (self *DiscordChannelUnit) SendMessageOptions(options DiscordMessageSend) (IDiscordMessageUnit, error)
- func (self *DiscordChannelUnit) SendTyping() error
- func (self *DiscordChannelUnit) Snowflake() string
- func (self *DiscordChannelUnit) Topic() string
- func (self *DiscordChannelUnit) Type() discordgo.ChannelType
- type DiscordEmbed
- type DiscordEmbedField
- type DiscordEmbedFooter
- type DiscordEmbedImage
- type DiscordGuildUnit
- func (self *DiscordGuildUnit) Description() string
- func (self *DiscordGuildUnit) Discord() IDiscordUnit
- func (self *DiscordGuildUnit) GetChannel(channelId string) (IDiscordChannelUnit, error)
- func (self *DiscordGuildUnit) GetChannels() ([]IDiscordChannelUnit, error)
- func (self *DiscordGuildUnit) GetMemberCount() (int, error)
- func (self *DiscordGuildUnit) Icon() string
- func (self *DiscordGuildUnit) Id() string
- func (self *DiscordGuildUnit) IsOwner() bool
- func (self *DiscordGuildUnit) Name() string
- func (self *DiscordGuildUnit) Native() *discordgo.Guild
- func (self *DiscordGuildUnit) Region() string
- func (self *DiscordGuildUnit) Snowflake() string
- type DiscordInteractionUnit
- func (self *DiscordInteractionUnit) CommandName() string
- func (self *DiscordInteractionUnit) DeferReply() error
- func (self *DiscordInteractionUnit) Discord() IDiscordUnit
- func (self *DiscordInteractionUnit) DispatchEvent(name string, callback IDiscordCommandFn) bool
- func (self *DiscordInteractionUnit) EditReply(message *string) error
- func (self *DiscordInteractionUnit) IsCommandName(name string) bool
- func (self *DiscordInteractionUnit) Native() *discordgo.InteractionCreate
- func (self *DiscordInteractionUnit) Reply(message string) error
- func (self *DiscordInteractionUnit) User() IDiscordUserUnit
- type DiscordMentionType
- type DiscordMessageEdit
- type DiscordMessageSend
- type DiscordMessageUnit
- func (self *DiscordMessageUnit) Author() IDiscordUserUnit
- func (self *DiscordMessageUnit) Channel() IDiscordChannelUnit
- func (self *DiscordMessageUnit) Content() string
- func (self *DiscordMessageUnit) Crosspost() error
- func (self *DiscordMessageUnit) Delete() error
- func (self *DiscordMessageUnit) Discord() IDiscordUnit
- func (self *DiscordMessageUnit) Edit(message string) error
- func (self *DiscordMessageUnit) EditOptions(options DiscordMessageEdit) error
- func (self *DiscordMessageUnit) EditedTimestamp() *time.Time
- func (self *DiscordMessageUnit) Id() string
- func (self *DiscordMessageUnit) Mentions() []IDiscordUserUnit
- func (self *DiscordMessageUnit) Native() *discordgo.Message
- func (self *DiscordMessageUnit) Reply(message string) (IDiscordMessageUnit, error)
- func (self *DiscordMessageUnit) Snowflake() string
- func (self *DiscordMessageUnit) Timestamp() time.Time
- type DiscordUnit
- func (self *DiscordUnit) BotId() string
- func (self *DiscordUnit) BotSnowflake() string
- func (self *DiscordUnit) BotUser() IDiscordUserUnit
- func (self *DiscordUnit) GetChannel(channelId string) (IDiscordChannelUnit, error)
- func (self *DiscordUnit) GetGuild(guildId string) (IDiscordGuildUnit, error)
- func (self *DiscordUnit) GetUser(userId string) (IDiscordUserUnit, error)
- func (self *DiscordUnit) NewInteractionUnit(interaction *discordgo.InteractionCreate) IDiscordInteractionUnit
- func (self *DiscordUnit) OnMessageCreate(callback func(IDiscordUnit, IDiscordMessageUnit))
- func (self *DiscordUnit) OnSlashCommand(callback func(IDiscordUnit, IDiscordInteractionUnit))
- func (self *DiscordUnit) Session() *discordgo.Session
- func (self *DiscordUnit) Start(commands []*discordgo.ApplicationCommand) error
- func (self *DiscordUnit) Stop()
- type DiscordUserUnit
- func (self *DiscordUserUnit) Discord() IDiscordUnit
- func (self *DiscordUserUnit) Discriminator() string
- func (self *DiscordUserUnit) GlobalName() string
- func (self *DiscordUserUnit) HasMFAEnabled() bool
- func (self *DiscordUserUnit) Id() string
- func (self *DiscordUserUnit) IsAnyNitro() bool
- func (self *DiscordUserUnit) IsBot() bool
- func (self *DiscordUserUnit) IsNitro() bool
- func (self *DiscordUserUnit) IsNitroBasic() bool
- func (self *DiscordUserUnit) IsNitroClassic() bool
- func (self *DiscordUserUnit) IsSystem() bool
- func (self *DiscordUserUnit) IsVerified() bool
- func (self *DiscordUserUnit) Native() *discordgo.User
- func (self *DiscordUserUnit) Snowflake() string
- func (self *DiscordUserUnit) Username() string
- type IDiscordChannelUnit
- type IDiscordCommandFn
- type IDiscordGuildUnit
- type IDiscordInteractionUnit
- type IDiscordMessageUnit
- type IDiscordUnit
- type IDiscordUserUnit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscordAllowedMentions ¶
DiscordAllowedMentions contains options used for DiscordMessageSend and [DiscordMesageEdit].
See: parent DiscordMessageSend or DiscordMessageEdit
func (*DiscordAllowedMentions) Build ¶
func (self *DiscordAllowedMentions) Build() *discordgo.MessageAllowedMentions
Build turns DiscordAllowedMentions into discordgo.MessageAllowedMentions.
type DiscordAttachment ¶
DiscordAttachment contains options used for DiscordMessageSend.
See: parent DiscordMessageSend See: io.Reader
func (*DiscordAttachment) Build ¶
func (self *DiscordAttachment) Build() *discordgo.File
Build turns DiscordAttachment into discordgo.File.
See: discordgo.File
type DiscordChannelUnit ¶
type DiscordChannelUnit struct {
// contains filtered or unexported fields
}
DiscordChannelUnit is the wrapper for the Channel object
See: discordgo.Channel
func (*DiscordChannelUnit) Discord ¶
func (self *DiscordChannelUnit) Discord() IDiscordUnit
Discord returns the parent DiscordUnit object, the root of ktncordgo.
See: DiscordUnit
func (*DiscordChannelUnit) FetchMessage ¶
func (self *DiscordChannelUnit) FetchMessage(messageId string) (IDiscordMessageUnit, error)
FetchMessage finds and returns a single message sent in the channel.
Parameters:
messageId - The ID of the message to look for.
Returns the DiscordMessageUnit of the message if found, otherwise an error.
See: DiscordMessageUnit See: discordgo.Session.ChannelMessage
func (*DiscordChannelUnit) FetchMessages ¶
func (self *DiscordChannelUnit) FetchMessages(limit int) ([]IDiscordMessageUnit, error)
FetchMessages finds and returns the latest X messages in the channel.
Parameters:
limit - The amount of channels to find. Min: 1. Max: 100.
Returns a slice of the found messages on success, otherwise an error.
See: DiscordMessageUnit See: discordgo.Session.ChannelMessages
func (*DiscordChannelUnit) Flags ¶
func (self *DiscordChannelUnit) Flags() discordgo.ChannelFlags
Flags returns the flags of the channel.
func (*DiscordChannelUnit) GetLastMessage ¶
func (self *DiscordChannelUnit) GetLastMessage() (IDiscordMessageUnit, error)
GetLastMassage finds and returns the latest message in the channel.
Returns the message if found, otherwise an error.
See: DiscordMessageUnit See: DiscordChannelUnit.FetchMessages
func (*DiscordChannelUnit) Guild ¶
func (self *DiscordChannelUnit) Guild() (IDiscordGuildUnit, error)
Guild returns the Guild that the current channel is in.
See: DiscordGuildUnit See: DiscordUnit.GetGuild
func (*DiscordChannelUnit) Id ¶
func (self *DiscordChannelUnit) Id() string
Id returns the ID of the discord channel.
func (*DiscordChannelUnit) NSFW ¶
func (self *DiscordChannelUnit) NSFW() bool
NSFW returns true if the channel is marked as a NSFW channel.
func (*DiscordChannelUnit) Name ¶
func (self *DiscordChannelUnit) Name() string
Name returns the name of the current channel.
func (*DiscordChannelUnit) Native ¶
func (self *DiscordChannelUnit) Native() *discordgo.Channel
Native returns the underlying discordgo.Channel object.
See: discordgo.Channel
func (*DiscordChannelUnit) Position ¶
func (self *DiscordChannelUnit) Position() int
Position returns the position of the current channel in the channel list.
func (*DiscordChannelUnit) SendMessage ¶
func (self *DiscordChannelUnit) SendMessage(message string) (IDiscordMessageUnit, error)
SendMessage sends a message in the channel.
Parameters:
message - The content of the message to send.
Returns the sent message on success, otherwise an error.
See: DiscordMessageUnit See: discordgo.Session.ChannelMessageSend
func (*DiscordChannelUnit) SendMessageOptions ¶
func (self *DiscordChannelUnit) SendMessageOptions(options DiscordMessageSend) (IDiscordMessageUnit, error)
SendMessageOptions sends a message in the channel with options.
Parameters:
options - The message options for the message to send.
Returns the sent message on success, otherwise an error.
See: DiscordMessageUnit See: discordgo.Session.ChannelMessageSendComplex
func (*DiscordChannelUnit) SendTyping ¶
func (self *DiscordChannelUnit) SendTyping() error
SendTyping sends the typing animation to users in the channel.
Returns an error on failure.
func (*DiscordChannelUnit) Snowflake ¶
func (self *DiscordChannelUnit) Snowflake() string
Snowflake returns the ID of the discord channel.
See: discordgo.Channel.ID
func (*DiscordChannelUnit) Topic ¶
func (self *DiscordChannelUnit) Topic() string
Topic returns the topic of the current channel.
func (*DiscordChannelUnit) Type ¶
func (self *DiscordChannelUnit) Type() discordgo.ChannelType
Type returns the type of the channel.
See: discordgo.ChannelType See: discordgo.Channel.Type
type DiscordEmbed ¶
type DiscordEmbed struct {
URL string
Title string
Description string
Timestamp *time.Time
Color int
Image *DiscordEmbedImage
Fields []*DiscordEmbedField
}
DiscordEmbed contains options used for DiscordMessageSend and DiscordMessageEdit.
See: parent DiscordMessageSend or DiscordMessageEdit See: time.Time See: DiscordEmbedFooter See: DiscordEmbedImage See: DiscordEmbedField
func PrepareEmbed ¶ added in v0.2.1
func PrepareEmbed(embed *discordgo.MessageEmbed) *DiscordEmbed
func (*DiscordEmbed) Build ¶
func (self *DiscordEmbed) Build() *discordgo.MessageEmbed
Build turns DiscordEmbed into discordgo.MessageEmbed.
type DiscordEmbedField ¶
DiscordEmbedField contains options used for DiscordEmbed.
See: parent DiscordEmbed
func PrepareEmbedField ¶ added in v0.2.1
func PrepareEmbedField(field *discordgo.MessageEmbedField) *DiscordEmbedField
func PrepareEmbedFields ¶ added in v0.2.1
func PrepareEmbedFields(fields []*discordgo.MessageEmbedField) []*DiscordEmbedField
func (*DiscordEmbedField) Build ¶
func (self *DiscordEmbedField) Build() *discordgo.MessageEmbedField
Build turns DiscordEmbedField into discordgo.MessageEmbedField.
type DiscordEmbedFooter ¶
type DiscordEmbedFooter struct {
}
DiscordEmbedFooter contains options used for DiscordEmbed.
See: parent DiscordEmbed
func PrepareEmbedFooter ¶ added in v0.2.1
func PrepareEmbedFooter(footer *discordgo.MessageEmbedFooter) *DiscordEmbedFooter
func (*DiscordEmbedFooter) Build ¶
func (self *DiscordEmbedFooter) Build() *discordgo.MessageEmbedFooter
Build turns DiscordEmbedFooter into discordgo.MessageEmbedFooter.
type DiscordEmbedImage ¶
type DiscordEmbedImage struct {
URL string
}
DiscordEmbedImage contains options used for DiscordEmbed.
See: parent DiscordEmbed
func PrepareEmbedImage ¶ added in v0.2.1
func PrepareEmbedImage(image *discordgo.MessageEmbedImage) *DiscordEmbedImage
func (*DiscordEmbedImage) Build ¶
func (self *DiscordEmbedImage) Build() *discordgo.MessageEmbedImage
Build turns DiscordEmbedImage into discordgo.MessageEmbedImage.
type DiscordGuildUnit ¶
type DiscordGuildUnit struct {
// contains filtered or unexported fields
}
DiscordGuildUnit is the wrapper for the Guild object
See: discordgo.Guild
func (*DiscordGuildUnit) Description ¶
func (self *DiscordGuildUnit) Description() string
Description returns the title/description of the discord guild.
func (*DiscordGuildUnit) Discord ¶
func (self *DiscordGuildUnit) Discord() IDiscordUnit
Discord returns the parent DiscordUnit object, the root of ktncordgo.
See: DiscordUnit
func (*DiscordGuildUnit) GetChannel ¶
func (self *DiscordGuildUnit) GetChannel(channelId string) (IDiscordChannelUnit, error)
GetChannel returns a channel in the discord guild.
Parameters
channelId - The ID of the discord channel.
Returns the channel if found, otherwise an error.
func (*DiscordGuildUnit) GetChannels ¶
func (self *DiscordGuildUnit) GetChannels() ([]IDiscordChannelUnit, error)
GetChannels returns the channels available in the discord guild. Returns an error if there's an issure with finding channels.
See: DiscordChannelUnit See: discordgo.Session.GuildChannels
func (*DiscordGuildUnit) GetMemberCount ¶
func (self *DiscordGuildUnit) GetMemberCount() (int, error)
GetMember Count returns the number of members in the discord guild. Note: This is an iterative process, be vary of usage in larger servers.
Returns number of members if successful, otherwise an error.
func (*DiscordGuildUnit) Icon ¶
func (self *DiscordGuildUnit) Icon() string
Icon returns the icon URL of the discord guild.
See: discordgo.Guild.Icon
func (*DiscordGuildUnit) Id ¶
func (self *DiscordGuildUnit) Id() string
Id returns the ID of the discord guild.
See: [DiscordGuildUser.Snowflake]
func (*DiscordGuildUnit) IsOwner ¶
func (self *DiscordGuildUnit) IsOwner() bool
IsOwner returns [true] if the bot user of the underlying DiscordUnit is the owner of the discord guild.
func (*DiscordGuildUnit) Name ¶
func (self *DiscordGuildUnit) Name() string
Name returns the name of the discord guild.
See: discordgo.Guild.Name
func (*DiscordGuildUnit) Native ¶
func (self *DiscordGuildUnit) Native() *discordgo.Guild
Native returns the underlying discordgo.Guild object.
See: discordgo.Guild
func (*DiscordGuildUnit) Region ¶
func (self *DiscordGuildUnit) Region() string
Region returns the voice channel region used in the discord guild.
func (*DiscordGuildUnit) Snowflake ¶
func (self *DiscordGuildUnit) Snowflake() string
Snowflake returns the ID of the discord guild.
See: discordgo.Guild.ID
type DiscordInteractionUnit ¶
type DiscordInteractionUnit struct {
// contains filtered or unexported fields
}
DiscordInteractionUnit holds any interaction related functionality, typically seen with interaction events, like slash commands.
See: discordgo.InteractionCreate
func (*DiscordInteractionUnit) CommandName ¶
func (self *DiscordInteractionUnit) CommandName() string
CommandName returns the name/label of the slash command.
See: discordgo.InteractionCreate.ApplicationCommandData See: discordgo.ApplicationCommandInteractionData.Name
func (*DiscordInteractionUnit) DeferReply ¶
func (self *DiscordInteractionUnit) DeferReply() error
DeferReply defers the reply, giving more time before replying to the command.
Typically discord requires a response within 3 seconds. Defer allows a delay of this. This cannot be followed by a [Reply] call and instead requires a [EditReply] call to follow up.
Returns an error on failure.
See: discordgo.Session.InteractionRespond See: discordgo.InteractionCreate.Interaction See: discordgo.InteractionResponse See: discordgo.InteractionResponseDeferredChannelMessageWithSource
func (*DiscordInteractionUnit) Discord ¶
func (self *DiscordInteractionUnit) Discord() IDiscordUnit
Discord returns the parent DiscordUnit object, the root of ktncordgo.
See: DiscordUnit
func (*DiscordInteractionUnit) DispatchEvent ¶
func (self *DiscordInteractionUnit) DispatchEvent(name string, callback IDiscordCommandFn) bool
DispatchEvent matches the command name to a provided value, and if valid runs a provided callback.
Parameters:
name - The name of the command to test against. callback - The command handler for the given command.
Returns true if the command matched.
See: IDiscordCommandFn See: [IsCommandName]
func (*DiscordInteractionUnit) EditReply ¶
func (self *DiscordInteractionUnit) EditReply(message *string) error
EditReply edits the interaction reply, or sends it if [DeferReply] was used.
Parameters:
message - Reference to the new content to use when editing response.
Returns an error on failure.
See: discordgo.Session.InteractionResponseEdit See: discordgo.InteractionCreate.Interaction See: discordgo.WebhookEdit
func (*DiscordInteractionUnit) IsCommandName ¶
func (self *DiscordInteractionUnit) IsCommandName(name string) bool
IsCommandName returns true if the name/label of the slash command matches a provided value.
Parameters:
name - The name of the command to test against.
Returns true if the command name matches.
See: discordgo.InteractionCreate.ApplicationCommandData See: discordgo.ApplicationCommandInteractionData.Name
func (*DiscordInteractionUnit) Native ¶
func (self *DiscordInteractionUnit) Native() *discordgo.InteractionCreate
Native returns the underlying discordgo.User object.
func (*DiscordInteractionUnit) Reply ¶
func (self *DiscordInteractionUnit) Reply(message string) error
Reply sends a reply to user interaction. This cannot be used with [DeferReply].
Parameters:
message - The text to include in the interaction response.
Returns an error on failure.
See: discordgo.Session.InteractionRespond See: discordgo.InteractionCreate.Interaction See: discordgo.InteractionResponse See: discordgo.InteractionResponseData See: discordgo.InteractionResponseChannelMessageWithSource
func (*DiscordInteractionUnit) User ¶ added in v0.1.0
func (self *DiscordInteractionUnit) User() IDiscordUserUnit
User returns the DiscordUserUnit instance of the command sender.
type DiscordMentionType ¶
type DiscordMentionType string
const ( DiscordMentionTypeRoles DiscordMentionType = "roles" DiscordMentionTypeUsers DiscordMentionType = "users" DiscordMentionTypeEveryone DiscordMentionType = "everyone" )
type DiscordMessageEdit ¶
type DiscordMessageEdit struct {
Content *string
Embeds *[]*DiscordEmbed
AllowedMentions *DiscordAllowedMentions
}
DiscordMessageEdit contains options used for DiscordMessageUnit.EditOptions.
See: DiscordEmbed See: DiscordAllowedMentions
func (*DiscordMessageEdit) Build ¶
func (self *DiscordMessageEdit) Build() *discordgo.MessageEdit
Build turns DiscordMessageEdit into discordgo.MessageEdit.
func (*DiscordMessageEdit) ToSend ¶ added in v0.2.0
func (self *DiscordMessageEdit) ToSend() *DiscordMessageSend
ToSend turns DiscordMessageEdit into DiscordMessageSend. Note: Sets (TTS: false, Attachments: [], Reference: nil).
See: DiscordMessageSend
type DiscordMessageSend ¶
type DiscordMessageSend struct {
Content string
Embeds []*DiscordEmbed
TTS bool
Attachments []*DiscordAttachment
AllowedMentions *DiscordAllowedMentions
Reference IDiscordMessageUnit
}
DiscordMessageSend contains options used for DiscordChannelUnit.SendMessageOptions.
See: DiscordEmbed See: DiscordAttachment See: DiscordAllowedMentions See: DiscordMessageUnit
func (*DiscordMessageSend) Build ¶
func (self *DiscordMessageSend) Build() *discordgo.MessageSend
Build turns DiscordMessageSend into discordgo.MessageSend.
func (*DiscordMessageSend) ToEdit ¶ added in v0.2.0
func (self *DiscordMessageSend) ToEdit() *DiscordMessageEdit
ToEdit turns DiscordMessageSend into DiscordMessageEdit.
See: DiscordMessageEdit
type DiscordMessageUnit ¶
type DiscordMessageUnit struct {
// contains filtered or unexported fields
}
DiscordMessageUnit is the wrapper for the Message object
See: discordgo.Message
func (*DiscordMessageUnit) Author ¶
func (self *DiscordMessageUnit) Author() IDiscordUserUnit
Author returns the sender of the message.
See: DiscordUserUnit See: discordgo.Message.Author
func (*DiscordMessageUnit) Channel ¶
func (self *DiscordMessageUnit) Channel() IDiscordChannelUnit
Channel returns the channel the message was sent in.
See: DiscordChannelUnit See: discordgo.Session.Channel See: discordgo.Message.ChannelID See: discordgo.Message.ID
func (*DiscordMessageUnit) Content ¶ added in v0.1.0
func (self *DiscordMessageUnit) Content() string
Content returns the text content of the message.
func (*DiscordMessageUnit) Crosspost ¶
func (self *DiscordMessageUnit) Crosspost() error
Crosspost performs a crosspost for the message. This only works in announcement type discord channels.
Returns an error upon failure.
See: discordgo.Session.ChannelMessageCrosspost See: discordgo.Message.ChannelID See: discordgo.Message.ID
func (*DiscordMessageUnit) Delete ¶
func (self *DiscordMessageUnit) Delete() error
Delete deletes the current message. This requires permission to manage messages or that the underlying DiscordUnit object user sent this message.
Returns an error upon failure.
See: discordgo.Session.ChannelMessageDelete See: discordgo.Message.ChannelID See: discordgo.Message.ID
func (*DiscordMessageUnit) Discord ¶
func (self *DiscordMessageUnit) Discord() IDiscordUnit
Discord returns the parent DiscordUnit object, the root of ktncordgo.
See: DiscordUnit
func (*DiscordMessageUnit) Edit ¶
func (self *DiscordMessageUnit) Edit(message string) error
Edit edits the message with new text. Only works if the DiscordUnit object user represent the sender of this message.
Parameter:
message - the message content to apply with the edit.
Returns an error upon failure.
See: discordgo.Session.ChannelMessageEdit See: discordgo.Message.ChannelID See: discordgo.Message.ID
func (*DiscordMessageUnit) EditOptions ¶
func (self *DiscordMessageUnit) EditOptions(options DiscordMessageEdit) error
EditOptions edits the message with new content. Only works if the DiscordUnit object user represent the sender of this message.
Parameter:
options - the message content to apply with the edit.
Returns an error upon failure.
See: DiscordMessageEdit See: discordgo.Session.ChannelMessageEditComplex See: discordgo.Message.ChannelID See: discordgo.Message.ID
func (*DiscordMessageUnit) EditedTimestamp ¶
func (self *DiscordMessageUnit) EditedTimestamp() *time.Time
EditedTimestamp returns the time.Time when the message was sent. It returns nil if the message was never edited.
func (*DiscordMessageUnit) Id ¶ added in v0.2.0
func (self *DiscordMessageUnit) Id() string
Id returns the ID of the discord message.
func (*DiscordMessageUnit) Mentions ¶
func (self *DiscordMessageUnit) Mentions() []IDiscordUserUnit
Mentions returns the users that have been mentioned in the message.
See: DiscordUserUnit See: discordgo.Message.Mentions
func (*DiscordMessageUnit) Native ¶
func (self *DiscordMessageUnit) Native() *discordgo.Message
Native returns the underlying discordgo.Message object.
See: discordgo.Message
func (*DiscordMessageUnit) Reply ¶
func (self *DiscordMessageUnit) Reply(message string) (IDiscordMessageUnit, error)
Reply replies to the message.
Parameters:
message - the message content to use in the reply.
Returns an error upon failure.
See: discordgo.Session.ChannelMessageSendReply See: discordgo.Message.GuildID See: discordgo.Message.ChannelID See: discordgo.Message.ID See: discordgo.MessageReference See: discordgo.MessageReferenceTypeDefault
func (*DiscordMessageUnit) Snowflake ¶ added in v0.2.0
func (self *DiscordMessageUnit) Snowflake() string
Snowflake returns the ID of the discord message.
See: discordgo.Message.ID
type DiscordUnit ¶
type DiscordUnit struct {
// contains filtered or unexported fields
}
DiscordUnit holds the main instance of ktncordgo.
See: discordgo.Session
func (*DiscordUnit) BotId ¶ added in v0.2.0
func (self *DiscordUnit) BotId() string
Id returns the ID of the discord unit's bot user
See: [DiscordUnit.Snowflake]
func (*DiscordUnit) BotSnowflake ¶ added in v0.2.0
func (self *DiscordUnit) BotSnowflake() string
Snowflake returns the ID of the discord unit's bot user.
See: DiscordUserUnit.Snowflake See: DiscordUnit.BotUser
func (*DiscordUnit) BotUser ¶
func (self *DiscordUnit) BotUser() IDiscordUserUnit
BotUser returns the underlying bot user of the DiscordUnit instance.
Returns the user instance of present, otherwise nil.
See: DiscordUserUnit See: discordgo.Session.State See: [discordgo.Session.State.User]
func (*DiscordUnit) GetChannel ¶ added in v0.0.1
func (self *DiscordUnit) GetChannel(channelId string) (IDiscordChannelUnit, error)
GetChannel finds and returns a channel given a snowflake ID.
Parameters:
channelId - The ID of the channel to find.
Returns the channel object if found, otherwise an error.
See: DiscordChannelUnit See: discordgo.Session.Channel
func (*DiscordUnit) GetGuild ¶
func (self *DiscordUnit) GetGuild(guildId string) (IDiscordGuildUnit, error)
GetGuild finds and returns a guild given a snowflake ID.
Parameters:
guildId - The ID of the guild to find.
Returns the guild object if found, otherwise an error.
See: DiscordGuildUnit See: discordgo.Session.Guild
func (*DiscordUnit) GetUser ¶
func (self *DiscordUnit) GetUser(userId string) (IDiscordUserUnit, error)
GetUser finds and returns a user given a snowflake ID.
Parameters:
userId - The ID of the user to find.
Returns the user object if found, otherwise an error.
See: DiscordUserUnit See: discordgo.Session.User
func (*DiscordUnit) NewInteractionUnit ¶
func (self *DiscordUnit) NewInteractionUnit(interaction *discordgo.InteractionCreate) IDiscordInteractionUnit
NewInteractionUnit creates a new DiscordInteractionUnit reference using the current DiscordUnit instance as the parent object.
Parameters:
interaction - The underlying [discordgo.InteractionCreate] instance to use.
Returns the created DiscordInteractionUnit reference.
func (*DiscordUnit) OnMessageCreate ¶
func (self *DiscordUnit) OnMessageCreate(callback func(IDiscordUnit, IDiscordMessageUnit))
OnMessageCreate registers an event handler for Channel Chat Messages.
Parameters:
callback - The callback handler for the message create event.
func (*DiscordUnit) OnSlashCommand ¶
func (self *DiscordUnit) OnSlashCommand(callback func(IDiscordUnit, IDiscordInteractionUnit))
OnSlashCommand registers an event handler for Slash Commands.
Parameters:
callback - The callback handler for the slash command event.
func (*DiscordUnit) Session ¶
func (self *DiscordUnit) Session() *discordgo.Session
Session returns a reference to the underlying discordgo.Session object.
Returns the discordgo.Session reference.
See: discordgo.Session
func (*DiscordUnit) Start ¶
func (self *DiscordUnit) Start(commands []*discordgo.ApplicationCommand) error
Start takes a slice of commands, opens the session, and registers the commands with discord.
Parameters:
commands - a slice of [discordgo.ApplicationCommand] references.
Returns an error on failure.
See: discordgo.Session.Open See: discordgo.Session.ApplicationCommandCreate
type DiscordUserUnit ¶
type DiscordUserUnit struct {
// contains filtered or unexported fields
}
DiscordUserUnit is the wrapper for the User object
See: discordgo.User
func (*DiscordUserUnit) Discord ¶
func (self *DiscordUserUnit) Discord() IDiscordUnit
Discord returns the parent DiscordUnit object, the root of ktncordgo.
See: DiscordUnit
func (*DiscordUserUnit) Discriminator ¶
func (self *DiscordUserUnit) Discriminator() string
Discriminator returns the 4 Discriminator digs of the discord user. This is no longer used for normal users and is limited to bots. For a normal user this will return "0000".
func (*DiscordUserUnit) GlobalName ¶
func (self *DiscordUserUnit) GlobalName() string
GlobalName returns the global display name of the discord user.
func (*DiscordUserUnit) HasMFAEnabled ¶
func (self *DiscordUserUnit) HasMFAEnabled() bool
HasMFAEnabled returns true if the discord user has multi-factor authentication enabled.
Might not work, See: discordgo.User.MFAEnabled for more info.
func (*DiscordUserUnit) Id ¶
func (self *DiscordUserUnit) Id() string
Id returns the ID of the discord user.
func (*DiscordUserUnit) IsAnyNitro ¶
func (self *DiscordUserUnit) IsAnyNitro() bool
IsAnyNitro returns true if the discord user has any of the Nitro tier, be that Nitro (9.99€), Nitro Basic (2.99€) or Nitro Classic (4.99€ mostly obsolete).
See: discordgo.User.PremiumType See: discordgo.User.UserPremiumType See: discordgo.User.UserPremiumTypeNone
func (*DiscordUserUnit) IsBot ¶
func (self *DiscordUserUnit) IsBot() bool
IsBot returns true if the discord user is a bot.
See: discordgo.User.Bot
func (*DiscordUserUnit) IsNitro ¶
func (self *DiscordUserUnit) IsNitro() bool
IsNitro returns true if the discord user has Nitro (9.99€).
See: discordgo.User.PremiumType See: discordgo.User.UserPremiumType See: discordgo.User.UserPremiumTypeNitro
func (*DiscordUserUnit) IsNitroBasic ¶
func (self *DiscordUserUnit) IsNitroBasic() bool
IsNitroBasic returns true if the discord user has Nitro Basic (2.99€).
See: discordgo.User.PremiumType See: discordgo.User.UserPremiumType See: discordgo.User.UserPremiumTypeNitroBasic
func (*DiscordUserUnit) IsNitroClassic ¶
func (self *DiscordUserUnit) IsNitroClassic() bool
IsNitroClassic returns true if the discord user has Nitro Classic (4.99€ mostly obsolete).
See: discordgo.User.PremiumType See: discordgo.User.UserPremiumType See: discordgo.User.UserPremiumTypeNitroClassic
func (*DiscordUserUnit) IsSystem ¶
func (self *DiscordUserUnit) IsSystem() bool
IsSystem returns true if the discord user is a system user, typically seen with Discord's own announcement messages.
func (*DiscordUserUnit) IsVerified ¶
func (self *DiscordUserUnit) IsVerified() bool
IsVerified returns true if the discord user has verified their email. Might not work. See discordgo.User.Verified for more info.
func (*DiscordUserUnit) Native ¶
func (self *DiscordUserUnit) Native() *discordgo.User
Native returns the underlying discordgo.User object.
See: discordgo.User
func (*DiscordUserUnit) Snowflake ¶
func (self *DiscordUserUnit) Snowflake() string
Snowflake returns the ID of the discord user.
See: discordgo.User.ID
func (*DiscordUserUnit) Username ¶
func (self *DiscordUserUnit) Username() string
Username returns the username of the discord user.
type IDiscordChannelUnit ¶
type IDiscordChannelUnit interface {
Discord() IDiscordUnit
Native() *discordgo.Channel
// Base
Snowflake() string
Id() string
// Information
Guild() (IDiscordGuildUnit, error)
Name() string
Topic() string
Position() int
NSFW() bool
Type() discordgo.ChannelType
Flags() discordgo.ChannelFlags
// Methods
FetchMessage(string) (IDiscordMessageUnit, error)
FetchMessages(limit int) ([]IDiscordMessageUnit, error)
GetLastMessage() (IDiscordMessageUnit, error)
SendMessage(string) (IDiscordMessageUnit, error)
SendMessageOptions(options DiscordMessageSend) (IDiscordMessageUnit, error)
SendTyping() error
}
IDiscordChannelUnit is the channel interface.
See: DiscordChannelUnit
type IDiscordCommandFn ¶
type IDiscordCommandFn func(IDiscordInteractionUnit) error
IDiscordCommandFn is a slash command handler callback function definition.
type IDiscordGuildUnit ¶
type IDiscordGuildUnit interface {
Discord() IDiscordUnit
Native() *discordgo.Guild
// Base
Snowflake() string
Id() string
// Information
Name() string
Description() string
Icon() string
Region() string
IsOwner() bool
// Methods
GetChannels() ([]IDiscordChannelUnit, error)
GetChannel(string) (IDiscordChannelUnit, error)
GetMemberCount() (int, error)
}
IDiscordGuildUnit is the guild interface.
See: DiscordGuildUnit
type IDiscordInteractionUnit ¶
type IDiscordInteractionUnit interface {
Discord() IDiscordUnit
Native() *discordgo.InteractionCreate
User() IDiscordUserUnit
DeferReply() error
Reply(message string) error
EditReply(message *string) error
CommandName() string
IsCommandName(name string) bool
DispatchEvent(name string, callback IDiscordCommandFn) bool
}
IDiscordInteractionUnit is the slash command interaction interface.
type IDiscordMessageUnit ¶
type IDiscordMessageUnit interface {
Discord() IDiscordUnit
Native() *discordgo.Message
// Base
Snowflake() string
Id() string
// Information
Channel() IDiscordChannelUnit
Content() string
Author() IDiscordUserUnit
Timestamp() time.Time
EditedTimestamp() *time.Time
Mentions() []IDiscordUserUnit
Edit(message string) error
EditOptions(options DiscordMessageEdit) error
Crosspost() error
Delete() error
Reply(message string) (IDiscordMessageUnit, error)
}
IDiscordMessageUnit is the message interface.
See: DiscordMessageUnit
type IDiscordUnit ¶
type IDiscordUnit interface {
Session() *discordgo.Session
NewInteractionUnit(interaction *discordgo.InteractionCreate) IDiscordInteractionUnit
OnSlashCommand(func(IDiscordUnit, IDiscordInteractionUnit))
OnMessageCreate(func(IDiscordUnit, IDiscordMessageUnit))
Start([]*discordgo.ApplicationCommand) error
Stop()
GetUser(string) (IDiscordUserUnit, error)
GetChannel(string) (IDiscordChannelUnit, error)
GetGuild(string) (IDiscordGuildUnit, error)
BotUser() IDiscordUserUnit
BotSnowflake() string
BotId() string
}
IDiscordUnit is the root ktncordgo interface.
See: DiscordUnit
func CreateDiscordUnit ¶
func CreateDiscordUnit(token string) (IDiscordUnit, error)
CreateDiscordUnit takes a discord token and creates a DiscordUnit instance.
Returns the create instance on success, otherwise an error.
See: DiscordUnit See: discordgo.Session See: discordgo.Identify See: discordgo.Intents
func NewDiscordUnit ¶
func NewDiscordUnit(session *discordgo.Session) IDiscordUnit
NewDiscordUnit takes a discordgo.Session reference and creates a DiscordUnit.
Parameters:
session - The underlying [discordgo.Session] reference to use.
Returns the created DiscordUnit reference.
type IDiscordUserUnit ¶
type IDiscordUserUnit interface {
Discord() IDiscordUnit
Native() *discordgo.User
// Base
Snowflake() string
Id() string
// Information
Username() string
Discriminator() string
GlobalName() string
IsBot() bool
IsVerified() bool
HasMFAEnabled() bool
IsSystem() bool
IsAnyNitro() bool
IsNitroClassic() bool
IsNitroBasic() bool
IsNitro() bool
}
IDiscordUserUnit is the user interface.
See: DiscordUserUnit