Backend.Bot
Contains methods for initializing and preparing the bot's client.
Backend.Bot.Secrets
Allows the fetching of private data from user secrets.
Backend.Bot.GetSecret(string)
Extracts a value from the project secrets, returning null if the identifier does not exist.
Backend.Bot.Client
Main client, used for communicating with Discord.
Backend.Bot.NetClient
HTTP client, used for external network requests.
Backend.Bot.GetGuild(ulong)
Gets a guild from the Backend.Bot.Client
's cache from using its ID.
Backend.Bot.GuildID
The current guild's ID, fetched via Backend.Bot.GetSecret(string)
.
Backend.Bot.GuildURL
The base guild URL.
Backend.Bot.Restart()
Stops the client, releases its resources, and restarts the bot client.
Backend.Bot.Start()
Starts the bot's client, initializes event handlers, and prepares caches.
Backend.Extensions
Convenience class for simple type conversions.
Backend.Extensions.ToMessage(Rest.InteractionMessageProperties)
Converts the value of this instance to its equivalent Rest.InteractionMessageProperties
representation.
Backend.Extensions.GetImageURLs(ReadOnlyDictionary<ulong, Attachment>)
Converts a set of attachments to an array of the attachments' URLs.
Backend.Extensions.TryGetName(TextChannel, out string)
Attempts to get the channel's name, returning null if it doesn't have one.
Backend.Extensions.ToChecked(Rest.InteractionMessageProperties)
Caps the embed count of this instance to 10 embeds maximum.
Backend.Extensions.GetAvatar(User, ImageFormat?)
Gets the URL of a user's avatar if they have one, otherwise returning their default avatar URL.
Backend.Extensions.GetAvatar(GuildUser, ImageFormat?)
Gets the URL of a user's avatar if they have one, otherwise returning their default avatar URL.
Backend.Extensions.GetDisplayName(User)
Gets a User
's displayed discord name using the cached member list.
Backend.Files
Contains methods and constants used for persistent data storage.
Backend.Files.FileContains(Backend.Files.Names, string, bool)
Whether the specified file contains the given data.
Backend.Files.ReadCounter(Backend.Files.CounterLines, int)
Reads the value of a counter.
Backend.Files.MAIN
The main path containing all the memory files used by P.BOT.
Backend.Files.Names
A list of files used by P.BOT for storage.
Backend.Files.Names.Counters
Contains data related to basic operations, such as incremental counters.
Backend.Files.Names.Starboard
Contains a list of starred messages.
Backend.Files.CounterLines
A list of names for lines in the Backend.Files.Names.Counters
file.
Backend.Files.Paths
The bot's internal list of file paths, indexed by their names.
Backend.Parsing.ToParsedUnicode(string)
Replaces any unparsed unicode identifiers with their appropriate symbols (i.e. \u0041' -> 'A'
).
Backend.Parsing.ToEscapedMarkdown(string)
Converts the contents of this string into an escaped version, avoiding markdown formatting issues.
Backend.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.
Backend.Parsing.EscapeCharacterRegex()
Pattern:
\\\\(b|f|n|r|t|"|\\\\)
Explanation:
○ Match '\\'.
○ 1st capture group.
○ Match a character in the set ["\\bfnrt].
Backend.VirtualTerminalSequences
Contains constants and method calls related to unmanaged code.
Backend.VirtualTerminalSequences.DarkGray
Sets the console foreground color.
Backend.VirtualTerminalSequences.Black
Sets the console foreground color.
Backend.VirtualTerminalSequences.Red
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkRed
Sets the console foreground color.
Backend.VirtualTerminalSequences.Green
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkGreen
Sets the console foreground color.
Backend.VirtualTerminalSequences.Yellow
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkYellow
Sets the console foreground color.
Backend.VirtualTerminalSequences.Blue
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkBlue
Sets the console foreground color.
Backend.VirtualTerminalSequences.Magenta
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkMagenta
Sets the console foreground color.
Backend.VirtualTerminalSequences.Cyan
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkCyan
Sets the console foreground color.
Backend.VirtualTerminalSequences.White
Sets the console foreground color.
Backend.VirtualTerminalSequences.Gray
Sets the console foreground color.
Backend.VirtualTerminalSequences.DarkGrayB
Sets the console background color.
Backend.VirtualTerminalSequences.BlackB
Sets the console background color.
Backend.VirtualTerminalSequences.RedB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkRedB
Sets the console background color.
Backend.VirtualTerminalSequences.GreenB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkGreenB
Sets the console background color.
Backend.VirtualTerminalSequences.YellowB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkYellowB
Sets the console background color.
Backend.VirtualTerminalSequences.BlueB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkBlueB
Sets the console background color.
Backend.VirtualTerminalSequences.MagentaB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkMagentaB
Sets the console background color.
Backend.VirtualTerminalSequences.CyanB
Sets the console background color.
Backend.VirtualTerminalSequences.DarkCyanB
Sets the console background color.
Backend.VirtualTerminalSequences.WhiteB
Sets the console background color.
Backend.VirtualTerminalSequences.GrayB
Sets the console background color.
Backend.Embeds
Contains functions for the creation of embeds and their components.
Backend.Embeds.CreateAuthor(string, string, string)
Creates an Rest.EmbedAuthorProperties
object for use in an Embed
.
Backend.Embeds.CreateFooter(string, string)
Creates an Rest.EmbedAuthorProperties
object for use in an Embed
.
Backend.Embeds.CreateField(string, string, bool)
Creates an Rest.EmbedFieldProperties
object for use in an Embed
.
Backend.Embeds.GetAssetURL(string)
Gets the GitHub hosted URL of the given asset.
Backend.Embeds.ASSETS
The URL to the GitHub Assets folder.
Backend.Embeds.STD_COLOR
The hex code for standard embed gray.
Backend.Embeds.RandomColor
Generates a random 24-bit integer from the current time in ticks.
Backend.Embeds.Generate(Rest.EmbedProperties, string[], string, bool)
Combines the specified parameters to generate an embed.
Backend.Embeds.ToEmbed(Rest.RestMessage, string, Rest.EmbedFooterProperties, string, string)
Combines the specified parameters with parameters extracted from a given Rest.RestMessage
to generate an embed.
Backend.Embeds.Title(string, Rest.EmbedFieldProperties[], ulong)
Creates a Rest.MessageProperties
object suitable for Commands.SlashCommands.GetTitle(Commands.Helpers.Library.Titles)
.
Backend.Events
Contains methods responsible for handling message events.
Backend.Events.GuildUserUpdate(GuildUser)
Updates the Caches.Members.List
dictionary when a user is added or modified.
Backend.Events.GuildUserRemove(Gateway.GuildUserRemoveEventArgs)
Removes users from the Caches.Content.List dictionary when a member is modified.
Backend.Events.RoleUpdate(Role)
Updates the Caches.Members.Roles
dictionary when roles are created or updated.
Backend.Events.RoleDelete(Gateway.RoleDeleteEventArgs)
Updates the Caches.Members.Roles
dictionary when roles are deleted.
Backend.Events.MapClientHandlers()
Maps the Backend.Bot.Client
's events to their appropriate response method.
Backend.Events.InteractionCreate(Interaction)
Processes received interactions.
Backend.Events.DeletedSpamMessage
Used by Messages.Functions.Filter(Gateway.Message)
to pass a message to Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
, bypassing the cache.
Backend.Events.MessageCreate(Gateway.Message)
Processes new messages.
Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
Logs message deletions.
Backend.Events.MessageUpdate(Gateway.Message)
Logs message edits and updates.
Backend.Events.ReactionAdded(Gateway.MessageReactionAddEventArgs)
Logs reactions to messages.
Caches.Messages
Contains the recent messages cache and its relevant methods.
Caches.Messages.Recent
Contains all messages in the bot's cache.
Caches.Messages.IgnoreCounter
The index of the last assigned Caches.Messages.IgnoreCache
slot.
Caches.Messages.IgnoreCache
A short array of messages to be ignored by Backend.Events.MessageDelete(Gateway.MessageDeleteEventArgs)
to prevent clutter.
Caches.Messages.IgnoreID(ulong)
Adds a message ID to the Caches.Messages.IgnoreCache
.
Caches.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.
Caches.Members.Member
Represents a Rest.GuildUserInfo
object with additional bot-related fields.
Caches.Members.Member(Rest.GuildUserInfo)
Represents a Rest.GuildUserInfo
object with additional bot-related fields.
Caches.Members.List
The bot's internal member list, generated from the members-search
endpoint.
Caches.Members.Accolades
The bot's internal list of event roles, and their appropriate descriptions.
Caches.Members.FounderRoles
The bot's internal list of founder roles, alongside their owners' user IDs.
Caches.Members.Roles
The bot's internal role list, generated with Rest.RestClient.GetGuildRolesAsync(ulong, Rest.RestRequestProperties)
.
Caches.Members.IsAccolade(ulong)
Checks if the role referenced by the ID is an event role.
Caches.Members.GetUserAccolades(Caches.Members.Member)
Returns a string summarizing a user's accolades and other important roles.
Caches.Members.Load()
Initializes the class with data from the members-search
endpoint.
Commands.SlashCommands
Contains the slash commands used by P.BOT and their associated tasks.
Commands.SlashCommands.SystemsCheck()
Command task. Checks if P.BOT's system is active.
Commands.SlashCommands.MoveVoiceUsers(VoiceGuildChannel, VoiceGuildChannel, Role)
Command task. Moves a group of users from one voice channel to another.
Commands.SlashCommands.GetAvatar(User, ImageFormat?)
Command task. Gets the avatar of the user, in a specific format if specified in format.
Commands.SlashCommands.GetTitle(Commands.Helpers.Library.Titles)
Command task. Gets the library entry of the title specified in the title parameter.
Commands.SlashCommands.GetUser(User, bool)
Command task. Displays data relevant to a specified user.
Commands.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.
Commands.SlashCommands.CreatePost(string, Attachment, bool, Channel, bool)
Command task. Creates an embed with the specified content and image.
Commands.Helpers.Library
Contains data involving dictionaries and the Commands.SlashCommands.GetTitle(Commands.Helpers.Library.Titles)
command.
Commands.Helpers.Library.Titles
A list of possible choices for the Commands.SlashCommands.GetTitle(Commands.Helpers.Library.Titles)
command.
Commands.Helpers.Library.Titles.WhatIs_ThePPP
The history of the PPP.
Commands.Helpers.Library.Titles.IcelandGuide
Angel's Iceland travel guide.
Commands.Helpers.Library.Entries
Contains definitions used for the Commands.SlashCommands.GetTitle(Commands.Helpers.Library.Titles)
command.
Commands.Helpers.ProbabilityStateMachine
Contains constants, variables and the function responsible for probability calculations and roll results.
Commands.Helpers.ProbabilityStateMachine.ErrMessage
The message to format and print if the roll command is invalid.
Commands.Helpers.ProbabilityStateMachine.RollString
The message to format and append per standard roll result.
Commands.Helpers.ProbabilityStateMachine.CritString
The message to format and append per critical success.
Commands.Helpers.ProbabilityStateMachine.FailString
The message to format and append per critical failure.
Commands.Helpers.ProbabilityStateMachine.LoadMersenneTwister()
Initializes the xShift128 algorithm based off the current time in ticks.
Commands.Helpers.ProbabilityStateMachine.Run(Gateway.Message)
Applies the appropriate logic to use based on the given message.
Commands.Helpers.ProbabilityStateMachine.Next()
Runs a single iteration of the roller algorithm, returning the result.
Commands.Helpers.Wikipedia
Contains the Wikipedia API constant, as well as the method responsible for page retrieval.
Commands.Helpers.Wikipedia.WIKI_API
The URL and preset parameters for the Wikipedia content API.
Commands.Helpers.Wikipedia.GetPage(string, bool)
Sends the request responsible for retrieving the page, and formats it properly.
Commands.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 ']'.
Commands.TextCommands
Contains the text commands used by P.BOT and their associated tasks.
Commands.TextCommands.Parse(Gateway.Message)
Parses a given message, running the associated text command if a valid prefix is found.
Documentation.Generator
Contains classes and methods for accessing and serializing XML documentation.
Documentation.Generator.Generate()
Generates an HTML file from a given file path.
Documentation.Generator.GetMemberSummaryPairs()
Gets the documentation file as a System.Collections.Generic.List`1
of string tuples.
Documentation.Generator.Format(string, bool)
Formats a member's name.
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".
Documentation.Tags.MemberTagRegex()
Pattern:
\\uEEEC
Explanation:
○ Match ''.
Documentation.Tags.IndentTags(string)
Formats the final HTML document to have proper spacing for code readability.
Documentation.Tags.LT
Represents the safe replacement character for its equivalent XML entity.
Documentation.Tags.GT
Represents the safe replacement character for its equivalent XML entity.
Documentation.Tags.Code
Part of the code
tag pair, used for font application.
Documentation.Tags.cCode
Part of the code
tag pair, used for font application.
Documentation.Tags.Blue
Part of the blue
tag pair, used for highlighting.
Documentation.Tags.cBlue
Part of the blue
tag pair, used for highlighting.
Documentation.Tags.Cyan
Part of the cyan
tag pair, used for highlighting.
Documentation.Tags.cCyan
Part of the cyan
tag pair, used for highlighting.
Documentation.Tags.Details
Part of the details
tag pair, used for formatting.
Documentation.Tags.cDetails
Part of the details
tag pair, used for formatting.
Documentation.Tags.Summary
Part of the summary
tag pair, used for formatting.
Documentation.Tags.cSummary
Part of the summary
tag pair, used for formatting.
Documentation.Tags.MemberOpen
Indicate the start and end of a member name section, used in Documentation.Generator.GetMemberSummaryPairs()
Documentation.Tags.MemberClose
Indicate the start and end of a member name section, used in Documentation.Generator.GetMemberSummaryPairs()
Documentation.Tags.SummaryOpen
Indicate the start and end of a summary section, used in Documentation.Generator.GetMemberSummaryPairs()
Documentation.Tags.SummaryClose
Indicate the start and end of a summary section, used in Documentation.Generator.GetMemberSummaryPairs()
Messages.Functions
Contains methods and variables used for basic message functionality and parsing.
Messages.Functions.AddToStarBoard(Gateway.MessageReactionAddEventArgs)
Parses the contents of a given Gateway.MessageReactionAddEventArgs
and adds the result to the starboard.
Messages.Functions.GetMessageFromLink(string)
Gets the relevant Gateway.Message
object from a Discord message URL.
Messages.Functions.ParseLinks(Gateway.Message)
Parses a given message to check for message links, and displays their content if possible.
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.
Messages.Logging
Contains methods responsible for logging messages to the console.
Messages.Logging.LastAuthorID
The ID of the latest logged user.
Messages.Logging.LastDeletedAuthorID
The ID of the latest deleted user.
Messages.Logging.LOG_CHANNEL
The ID of the channel to send logs to.
Messages.Logging.LogNetworkMessage(Gateway.LogMessage)
Logs messages from the system.
Messages.Logging.LogCreatedMessage(Gateway.Message)
Logs new discord messages.
Messages.Logging.LogDeletedMessage(Gateway.Message)
Logs deleted discord messages.
Messages.Logging.LogUpdatedMessage(Gateway.Message, Gateway.Message)
Logs edited discord messages.
Messages.Logging.WriteAsID(string, Messages.Logging.SpecialId)
Writes a message to the console using a specified Messages.Logging.SpecialId
.