Bot.Backend.Core
Contains methods for initializing and preparing the bot's client.
Bot.Backend.Core.Client
Main client, used for communicating with Discord.
Bot.Backend.Core.NetClient
HTTP client, used for external network requests.
Bot.Backend.Core.Guild
Gets the bot's main guild.
Bot.Backend.Core.GuildID
The current guild's ID, fetched via Bot.Data.Files.GetSecret(string)
.
Bot.Backend.Core.GuildURL
The base guild URL.
Bot.Backend.Core.Restart()
Stops the client, releases its resources, and restarts the bot client.
Bot.Backend.Core.Start()
Starts the bot's client, initializes event handlers, and prepares caches.
Bot.Backend.Extensions
Convenience class for simple type conversions.
Bot.Backend.Extensions.ToMessage(Rest.InteractionMessageProperties)
Converts the value of this instance to its equivalent Rest.InteractionMessageProperties
representation.
Bot.Backend.Extensions.GetImageURLs(Collections.Generic.IReadOnlyList<Attachment>)
Converts a set of attachments to an array of the attachments' URLs.
Bot.Backend.Extensions.TryGetName(TextChannel, out string)
Attempts to get the channel's name, returning null if it doesn't have one.
Bot.Backend.Extensions.ToChecked(Rest.InteractionMessageProperties)
Caps the embed count of this instance to 10 embeds maximum.
Bot.Backend.Extensions.GetAvatar(User, ImageFormat?)
Gets the URL of a user's avatar if they have one, otherwise returning their default avatar URL.
Bot.Backend.Extensions.GetAvatar(GuildUser, ImageFormat?)
Gets the URL of a user's avatar if they have one, otherwise returning their default avatar URL.
Bot.Backend.Extensions.GetDisplayName(User)
Gets a User
's displayed discord name using the cached member list.
Bot.Backend.Members
Contains the cached members list, role list, and their relevant methods. This class possesses a static constructor not shipped in the GitHub repo for privacy reasons.
Bot.Backend.Members.Member
Represents a Rest.GuildUserInfo
object with additional bot-related fields.
Bot.Backend.Members.Member(Rest.GuildUserInfo)
Represents a Rest.GuildUserInfo
object with additional bot-related fields.
Bot.Backend.Members.MemberList
The bot's internal member list, generated from the members-search
endpoint.
Bot.Backend.Members.Accolades
The bot's internal list of event roles, and their appropriate descriptions.
Bot.Backend.Members.FounderRoles
The bot's internal list of founder roles, alongside their owners' user IDs.
Bot.Backend.Members.GetUserAccolades(Bot.Backend.Members.Member)
Returns a string summarizing a user's accolades and other important roles.
Bot.Backend.Members.LoadDictionaries()
Initializes the class with data from the members-search
endpoint.
Bot.Backend.VirtualTerminalSequences
Contains constants and method calls related to unmanaged code.
Bot.Backend.VirtualTerminalSequences.DarkGray
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Black
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Red
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkRed
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Green
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkGreen
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Yellow
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkYellow
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Blue
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkBlue
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Magenta
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkMagenta
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Cyan
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkCyan
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.White
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.Gray
Sets the console foreground color.
Bot.Backend.VirtualTerminalSequences.DarkGrayB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.BlackB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.RedB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkRedB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.GreenB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkGreenB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.YellowB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkYellowB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.BlueB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkBlueB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.MagentaB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkMagentaB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.CyanB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.DarkCyanB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.WhiteB
Sets the console background color.
Bot.Backend.VirtualTerminalSequences.GrayB
Sets the console background color.
Bot.Backend.Events
Contains methods responsible for handling message events.
Bot.Backend.Events.GuildUserUpdate(GuildUser)
Updates the Bot.Backend.Members.MemberList
dictionary when a user is added or modified.
Bot.Backend.Events.GuildUserRemove(Gateway.GuildUserRemoveEventArgs)
Removes users from the Caches.Content.List dictionary when a member is modified.
Bot.Backend.Events.MapClientHandlers()
Maps the Bot.Backend.Core.Client
's events to their appropriate response method.
Bot.Backend.Events.InteractionCreate(Interaction)
Processes received interactions by identifying their type, and passing them to the correct service.
Bot.Backend.Events.DeletedSpamMessage
Used by Bot.Messages.Functions.Filter(Gateway.Message)
to pass a message to Bot.Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
, bypassing the cache.
Bot.Backend.Events.MessageCreate(Gateway.Message)
Processes new messages.
Bot.Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
Logs message deletions.
Bot.Backend.Events.MessageUpdate(Gateway.Message)
Logs message edits and updates.
Bot.Backend.Events.ReactionAdded(Gateway.MessageReactionAddEventArgs)
Logs reactions to messages.
Bot.Data.Cache
Contains the recent messages cache and its relevant methods.
Bot.Data.Cache.RecentMessages
Contains all messages in the bot's cache.
Bot.Data.Cache.IgnoredMessageListPointer
The index of the last assigned Bot.Data.Cache.IgnoredMessageIDs
slot.
Bot.Data.Cache.IgnoredMessageIDs
A short array of messages to be ignored by Bot.Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
to prevent clutter.
Bot.Data.Cache.IgnoreMessageID(ulong)
Adds a message ID to the Bot.Data.Cache.IgnoredMessageIDs
.
Bot.Data.Files
Contains methods and constants used for persistent data storage.
Bot.Data.Files.Secrets
Allows the fetching of private data from user secrets.
Bot.Data.Files.EnsurePathsExist()
Ensures all files required for data storage are present and formatted correctly.
Bot.Data.Files.GetSecret(string)
Extracts a value from the project secrets, returning null if the identifier does not exist.
Bot.Data.Files.FileContains(Bot.Data.Files.Names, string, bool)
Whether the specified file contains the given data.
Bot.Data.Files.GetCounter(Bot.Data.Files.CounterLines, ulong)
Reads the value of a counter.
Bot.Data.Files.DataPath
The main path containing all the memory files used by P.BOT.
Bot.Data.Files.Paths
The bot's internal list of file paths, indexed by their names.
Bot.Data.Files.Names
A list of files used by P.BOT for storage.
Bot.Data.Files.Names.Accoaldes
Contains a list of event role IDs, alongside their descriptions.
Bot.Data.Files.Names.Counters
Contains data related to basic operations, such as incremental counters.
Bot.Data.Files.Names.Starboard
Contains a list of starred messages.
Bot.Data.Files.Names.FounderRoles
Contains a list of founder IDs, alongside their role IDs.
Bot.Data.Files.Names.Webhooks
Contains a list of webhook URLs.
Bot.Data.Files.CounterLines
A list of names for lines in the Bot.Data.Files.Names.Counters
file.
Bot.Data.Parsing.FromEscapedUnicode(string)
Replaces any unparsed unicode identifiers with their appropriate symbols (i.e. \u0041' to 'A'
).
Bot.Data.Parsing.ToEscapedMarkdown(string)
Converts the contents of this string into an escaped version, avoiding markdown formatting issues.
Bot.Data.Parsing.UnicodeIdentifierRegex()
Pattern:
\\\\u([0-9A-Fa-f]{4})
Explanation:
○ Match the string "\\u".
○ 1st capture group.
○ Match a character in the set [0-9A-Fa-f] exactly 4 times.
Bot.Data.Parsing.EscapeCharacterRegex()
Pattern:
\\\\(b|f|n|r|t|"|\\\\)
Explanation:
○ Match '\\'.
○ 1st capture group.
○ Match a character in the set ["\\bfnrt].
Bot.Documentation.Generator
Contains classes and methods for accessing and serializing XML documentation.
Bot.Documentation.Generator.Generate()
Generates an HTML file from a given file path.
Bot.Documentation.Generator.GetMemberSummaryPairs()
Gets the documentation file as a System.Collections.Generic.List`1
of string tuples.
Bot.Documentation.Generator.Format(string, bool)
Formats a member's name.
Bot.Documentation.Generator.SystemTypeRegex()
Pattern:
System\\.(Boolean|Byte|SByte|Char|Decimal|Double|Single|Int32|UInt32|IntPtr|UIntPtr|Int64|UInt64|Int16|UInt16|Object|String)
Explanation:
○ Match the string "System.".
○ 1st capture group.
○ Match with 7 alternative expressions, atomically.
○ Match a sequence of expressions.
○ Match an empty string.
○ Match with 2 alternative expressions, atomically.
○ Match the string "oolean".
○ Match the string "yte".
○ Match a sequence of expressions.
○ Match an empty string.
○ Match with 3 alternative expressions, atomically.
○ Match the string "Byte".
○ Match the string "ingle".
○ Match the string "tring".
○ Match the string "Char".
○ Match a sequence of expressions.
○ Match an empty string.
○ Match with 2 alternative expressions, atomically.
○ Match the string "ecimal".
○ Match the string "ouble".
○ Match a sequence of expressions.
○ Match an empty string.
○ Match with 4 alternative expressions, atomically.
○ Match the string "32".
○ Match the string "Ptr".
○ Match the string "64".
○ Match the string "16".
○ Match a sequence of expressions.
○ Match an empty string.
○ Match with 4 alternative expressions, atomically.
○ Match the string "32".
○ Match the string "Ptr".
○ Match the string "64".
○ Match the string "16".
○ Match the string "Object".
Bot.Documentation.Tags.MemberTagRegex()
Pattern:
\\uEEEC
Explanation:
○ Match ''.
Bot.Documentation.Tags.IndentTags(string)
Formats the final HTML document to have proper spacing for code readability.
Bot.Documentation.Tags.LT
Represents the safe replacement character for its equivalent XML entity.
Bot.Documentation.Tags.GT
Represents the safe replacement character for its equivalent XML entity.
Bot.Documentation.Tags.Code
Part of the code
tag pair, used for font application.
Bot.Documentation.Tags.cCode
Part of the code
tag pair, used for font application.
Bot.Documentation.Tags.Blue
Part of the blue
tag pair, used for highlighting.
Bot.Documentation.Tags.cBlue
Part of the blue
tag pair, used for highlighting.
Bot.Documentation.Tags.Cyan
Part of the cyan
tag pair, used for highlighting.
Bot.Documentation.Tags.cCyan
Part of the cyan
tag pair, used for highlighting.
Bot.Documentation.Tags.Details
Part of the details
tag pair, used for formatting.
Bot.Documentation.Tags.cDetails
Part of the details
tag pair, used for formatting.
Bot.Documentation.Tags.Summary
Part of the summary
tag pair, used for formatting.
Bot.Documentation.Tags.cSummary
Part of the summary
tag pair, used for formatting.
Bot.Documentation.Tags.MemberOpen
Indicate the start and end of a member name section, used in Bot.Documentation.Generator.GetMemberSummaryPairs()
Bot.Documentation.Tags.MemberClose
Indicate the start and end of a member name section, used in Bot.Documentation.Generator.GetMemberSummaryPairs()
Bot.Documentation.Tags.SummaryOpen
Indicate the start and end of a summary section, used in Bot.Documentation.Generator.GetMemberSummaryPairs()
Bot.Documentation.Tags.SummaryClose
Indicate the start and end of a summary section, used in Bot.Documentation.Generator.GetMemberSummaryPairs()
Bot.Interactions.SlashCommands
Contains the slash commands used by P.BOT and their associated tasks.
Bot.Interactions.SlashCommands.RollSecretSantaPartner()
N/A
Bot.Interactions.SlashCommands.SystemsCheck()
Command task. Checks if P.BOT's system is active.
Bot.Interactions.SlashCommands.MoveVoiceUsers(VoiceGuildChannel, VoiceGuildChannel, Role)
Command task. Moves a group of users from one voice channel to another.
Bot.Interactions.SlashCommands.CreatePost()
WIP
Bot.Interactions.SlashCommands.GetAvatar(User, ImageFormat?)
Command task. Gets the avatar of the user, in a specific format if specified in format.
Bot.Interactions.SlashCommands.GetTitle(string)
Command task. Gets the library entry of the title specified in the title parameter.
Bot.Interactions.SlashCommands.GetUser(User, bool)
Command task. Displays data relevant to a specified user.
Bot.Interactions.SlashCommands.GetWiki(string, bool)
Command task. Searches for a Wikipedia page similar to the given term, and gets its content if a page is found.
Bot.Interactions.Common.ASSETS
The URL to the GitHub Assets folder.
Bot.Interactions.Common.STD_COLOR
The hex code for standard embed gray.
Bot.Interactions.Common.RandomColor
Generates a random 24-bit integer from the current time in ticks.
Bot.Interactions.Common.GetAssetURL(string)
Gets the GitHub hosted URL of the given asset.
Bot.Interactions.Common.GetColor(ulong)
Gets the color associated with a user based on their ID, returning a random color if not associated.
Bot.Interactions.Generation.ToEmbedSet(Rest.RestMessage, string, Rest.EmbedFooterProperties, string, string, bool)
Combines the specified parameters with parameters extracted from a given Rest.RestMessage
to generate an embed.
Bot.Interactions.Helpers.Library
Contains data involving dictionaries and the Bot.Interactions.SlashCommands.GetTitle(string)
command.
Bot.Interactions.Helpers.Library.#cctor()
Precomputes embeds for library entries, sourced from the bot's data folder.
Bot.Interactions.Helpers.Library.Entries
Contains the precomputed embeds for all available library entries.
Bot.Interactions.Helpers.Library.NextPage()
WIP
Bot.Interactions.Helpers.Library.LastPage()
WIP
Bot.Interactions.Helpers.ProbabilityStateMachine
Contains constants, variables and the function responsible for probability calculations and roll results.
Bot.Interactions.Helpers.ProbabilityStateMachine.ErrMessage
The message to format and print if the roll command is invalid.
Bot.Interactions.Helpers.ProbabilityStateMachine.RollString
The message to format and append per standard roll result.
Bot.Interactions.Helpers.ProbabilityStateMachine.CritString
The message to format and append per critical success.
Bot.Interactions.Helpers.ProbabilityStateMachine.FailString
The message to format and append per critical failure.
Bot.Interactions.Helpers.ProbabilityStateMachine.LoadMersenneTwister()
Initializes the xShift128 algorithm based off the current time in ticks.
Bot.Interactions.Helpers.ProbabilityStateMachine.ParseParameters(ReadOnlySpan<char>)
Parses a given content, extracting its roll parameters.
Bot.Interactions.Helpers.ProbabilityStateMachine.Run(Gateway.Message)
Performs the approriate calculations based off the passed message, replying to it.
Bot.Interactions.Helpers.ProbabilityStateMachine.Next()
Runs a single iteration of the roller algorithm, returning the result.
Bot.Interactions.Helpers.ProbabilityStateMachine.NextArray(Span<uint>, uint, uint)
Randomly fills a given array with numbers.
Bot.Interactions.Helpers.ProbabilityStateMachine.Next(uint, uint, uint, out ulong)
Calculates the maximum possible result according to the given count, max, and mod, randomly generating a number in that range.
Bot.Interactions.Helpers.Wikipedia
Contains the Wikipedia API constant, as well as the method responsible for page retrieval.
Bot.Interactions.Helpers.Wikipedia.WIKI_API
The URL and preset parameters for the Wikipedia content API.
Bot.Interactions.Helpers.Wikipedia.GetPage(string, bool)
Sends the request responsible for retrieving the page, and formats it properly.
Bot.Interactions.Helpers.Wikipedia.FormatHeaders(string)
Applies varying types of formatting to page headers.
Bot.Interactions.Helpers.Wikipedia.CitationRegex()
Pattern:
:\\d\\.\\d|\\[\\d+\\]
Explanation:
○ Match with 2 alternative expressions, atomically.
○ Match a sequence of expressions.
○ Match an empty string.
○ Match a Unicode digit.
○ Match '.'.
○ Match a Unicode digit.
○ Match a sequence of expressions.
○ Match an empty string.
○ Match a Unicode digit atomically at least once.
○ Match ']'.
Bot.Messages.Functions
Contains methods and variables used for basic message functionality and parsing.
Bot.Messages.Functions.AddToStarBoard(Gateway.MessageReactionAddEventArgs)
Parses the contents of a given Gateway.MessageReactionAddEventArgs
and adds the result to the starboard.
Bot.Messages.Functions.GetMessageFromLink(string)
Gets the relevant Gateway.Message
object from a Discord message URL.
Bot.Messages.Functions.ParseLinks(Gateway.Message)
Parses a given message to check for message links, and displays their content if possible.
Bot.Messages.Functions.Filter(Gateway.Message)
Compares a given message's attributes to other messages by the same user, and deletes it if the filter's criteria are met.
Bot.Messages.Logging
Contains methods responsible for logging messages to the console.
Bot.Messages.Logging.LastAuthorID
The ID of the latest logged user.
Bot.Messages.Logging.LastDeletedAuthorID
The ID of the latest deleted user.
Bot.Messages.Logging.LOG_CHANNEL
The ID of the channel to send logs to.
Bot.Messages.Logging.LogNetworkMessage(Gateway.LogMessage)
Logs messages from the system.
Bot.Messages.Logging.LogCreatedMessage(Gateway.Message, bool)
Logs new discord messages.
Bot.Messages.Logging.LogDeletedMessage(Gateway.Message)
Logs deleted discord messages.
Bot.Messages.Logging.LogUpdatedMessage(Gateway.Message, Gateway.Message)
Logs edited discord messages.
Bot.Messages.Logging.WriteAsID(string, Bot.Messages.Logging.SpecialId)
Writes a message to the console using a specified Bot.Messages.Logging.SpecialId
.