Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement message parsing as a toggleable feature #336

Closed
jf-06 opened this issue Sep 17, 2024 · 0 comments · Fixed by #338
Closed

Reimplement message parsing as a toggleable feature #336

jf-06 opened this issue Sep 17, 2024 · 0 comments · Fixed by #338
Labels
area: code-ops Issue relates to the issue of Code Ops area: discord Issue relates to discord kind: feature This issue integrates a single feature (or multiple disguised as one) opsec: love-all-environments SEC-04-LAE opsec: we-love-clean-code SEC-10-WLCC

Comments

@jf-06
Copy link
Contributor

jf-06 commented Sep 17, 2024

Reimplement message based commands, but allow them to be switched between 2 modes (3, if you want):

  1. Enabled, they can be consumed as-is.
  2. Disabled, they cannot be consumed and messages will not be responded to.
  3. Disabled, but a warning message is displayed (configurable)
@jf-06 jf-06 added kind: feature This issue integrates a single feature (or multiple disguised as one) opsec: love-all-environments SEC-04-LAE opsec: we-love-clean-code SEC-10-WLCC area: discord Issue relates to discord area: code-ops Issue relates to the issue of Code Ops labels Sep 18, 2024
@jf-06 jf-06 added this to GRIDBOT Sep 18, 2024
@github-project-automation github-project-automation bot moved this to Not Started in GRIDBOT Sep 18, 2024
@jf-06 jf-06 moved this from Not Started to On Track in GRIDBOT Sep 18, 2024
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Reorganize code to support both interaction and command context
~ Add Discord.Net.Commands dependency to Shared.Utility
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Create IUserMessageExtensions to add a method to reply with a file.
~ Create ModuleBaseExtensions to add functionality to reply with reference, reply with file, and reply with multiple files easily within module base.
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Text-commands version of on interaction executed
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Add references to CommandService, DiscordClient and ServiceProvider
~ Update _allowedCommandRegex to support underscores, as well as match only on one line to improve performance.
~ Add hashset to store all command aliases to filter out responses and calls to commands service
~ Update all metrics to remove the idea of deprecation against text commands.
~ Add metric for command processing time.
~ Add initialization method called within on ready event finished that will update the command aliases hashset with the currently registered modules.
~ Move around logger instantiation after command alias validation to introduce better performance when commands are not found.
~ Drop log on the users ingesting "previous phase commands"
~ Add branches to check if commands are enabled or disabled, debating on whether or not to put this before maintenance checks.
~ Call on commands service.
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Add command service to the container.
~ Add on command executed event.
jf-06 added a commit that referenced this issue Oct 1, 2024
~ Add references to commands service and on command executed event.
~ Add text commands modules.
~ Initialize the on message event after modules are added.
jf-06 added a commit that referenced this issue Oct 1, 2024
An attribute only allows the command to be executed within the DMs of users within the specified bot role, or within the specified guild (if configured).
jf-06 added a commit that referenced this issue Oct 1, 2024
Drop the interaction one for the commands one
jf-06 added a commit that referenced this issue Oct 1, 2024
Move all private modules to text commands to help lock them down to specific guilds etc so that they don't flood out command lists.
jf-06 added a commit that referenced this issue Oct 1, 2024
Port slash commands to text commands.
@jf-06 jf-06 linked a pull request Oct 1, 2024 that will close this issue
jf-06 added a commit that referenced this issue Oct 3, 2024
Add the help command for text based commands.
This will cache the embeds for each indivual command on the first usage of the command.
jf-06 added a commit that referenced this issue Oct 9, 2024
~ Rename references of interactions to commands.
Drop need for summary attribute on command arguments as it is unused within the stack.
~ Clean up constructors of some handlers removing uneeded arguments.
jf-06 added a commit that referenced this issue Oct 9, 2024
#!components: grid-bot

Settings.cs:
~ This command allows you to:
    1. Get environment information about the current application configuration.
    2. List all available settings provider names.
    3. List all values within a settings provider (cached, can optionally be refreshed just before fetch) -- For now it only functions in Vault-based environments.
    4. Get the value of a specific setting in a provider, supported on both Vault and Env var based environments.
    5. Support for setting a specific setting value in a provider, for now only supported by Vault providers as base class is only Vault and the base class does not fall back to EnvVar provider when Vault refresh is not enabled within set commands.
    6. Support for refreshing all registered auto refresh providers immediately, or in turn refreshing a specific provider (will possibly refresh twice if the refresh thread hits is around the same time)
jf-06 added a commit that referenced this issue Oct 9, 2024
Correctly fetch the required permission attribute
jf-06 added a commit that referenced this issue Oct 9, 2024
Account for the fact that cached values is a dictionary of strings and JsonElements, 1.1.0 of Configuration should address this issue and it will be removed in a future release
mfdlabs-ops pushed a commit that referenced this issue Oct 9, 2024
#!components: grid-bot, grid-bot-recovery
#!deployable-components: grid-bot

* Initial whitespace changes

* #337: LuaVM changes

~ Drop all type annotations to support #337
~ Update branches to properly handle LuaVMEnabledForAdmins

* #336: Script Logger

~ Reorganize code to support both interaction and command context
~ Add Discord.Net.Commands dependency to Shared.Utility

* Update BacktraceUtility

No longer log trace back, as this feature is not needed.

* Update SocketInteractionExtensions.cs

Add method to get the channel, and ingest it via GetChannelAsString

* #336: Extension methods

~ Create IUserMessageExtensions to add a method to reply with a file.
~ Create ModuleBaseExtensions to add functionality to reply with reference, reply with file, and reply with multiple files easily within module base.

* Update CommandsSettings.cs

~ EnableLockdownCommands: Determines if lockdown commands are enabled, if false then any commands marked with LockdownAttribute will just be passed straight on to the next precondition attribute.
~ LockdownGuildId: The guild permitted to respond to lockdown commands.
~ TextCommandsDisabledWarningText: Warning text to respond with when text commands are disabled, otherwise it will default to a generic message.
~ EnableTextCommands: Determines if text commands should be enabled.
~ ShouldWarnWhenCommandsAreDisabled: Determines if a warning should be responded with when the user tries to use a text command.

* Update ScriptLogger.cs

Drop dependency on client directly and use the context instead.

* Update OnSlashCommandExecuted.cs

~ Drop dependency on discord client directly and use the context client instead.
~ Catch-all on Discord.Net.HttpException

* #336: OnCommandExecutedEvent

~ Text-commands version of on interaction executed

* Update OnLogMessage.cs

Do not handle InteractionException or CommandException as OnInteractionExecuted and OnCommandExecuted events handles it themselves.

* #336: OnMessage

~ Add references to CommandService, DiscordClient and ServiceProvider
~ Update _allowedCommandRegex to support underscores, as well as match only on one line to improve performance.
~ Add hashset to store all command aliases to filter out responses and calls to commands service
~ Update all metrics to remove the idea of deprecation against text commands.
~ Add metric for command processing time.
~ Add initialization method called within on ready event finished that will update the command aliases hashset with the currently registered modules.
~ Move around logger instantiation after command alias validation to introduce better performance when commands are not found.
~ Drop log on the users ingesting "previous phase commands"
~ Add branches to check if commands are enabled or disabled, debating on whether or not to put this before maintenance checks.
~ Call on commands service.

* Update OnInteraction.cs

~ Drop branch out of interaction service execution to a different thread and just run within the current thread (report back later when it causes problems)

* #336: Update Runner.cs

~ Add command service to the container.
~ Add on command executed event.

* #336: OnReady

~ Add references to commands service and on command executed event.
~ Add text commands modules.
~ Initialize the on message event after modules are added.

* #336: Lock Down Attribute

An attribute only allows the command to be executed within the DMs of users within the specified bot role, or within the specified guild (if configured).

* #336: RequireBotRoleAttribute

Drop the interaction one for the commands one

* #336: Private Modules

Move all private modules to text commands to help lock them down to specific guilds etc so that they don't flood out command lists.

* #336: Modules

Port slash commands to text commands.

* Local Testing: Noop Job Manager

Implement a NOOP job manager to allow local debugging for users who are not on infra networks, or do not have software tools available to run grid servers.

* Administration: Bot roles

~ Move around the bot role enum to Shared.Utility.
~ Add a method in admin utility to wrap the individual methods to detect if users are owners, admins or privilaged by using the bot role enum.

* Account for change to BotRole enum.

Update RequireCommandBotRoleAttribute, ClientSettings and Maintenance modules to account for the movement of the enum to Shared.Utility.

* #336: Help Command

Add the help command for text based commands.
This will cache the embeds for each indivual command on the first usage of the command.

* Rewrap on interaction + command service calls

Apparently this will cause thread locks.

* Update on command and interaction executed.

Change case for CommandException

* Bump all mfdlabs packages

LTS changes, all versions are in sync now to better guage future changes

* Reflect package upgrades

All loggers now take in a function getter for the log level instead of hard coding the log level. Trace no longer exists and has been changed to Verbose

* #336: Text commands clean ups

~ Rename references of interactions to commands.
Drop need for summary attribute on command arguments as it is unused within the stack.
~ Clean up constructors of some handlers removing uneeded arguments.

* #336: Settings Text command.

Settings.cs:
~ This command allows you to:
    1. Get environment information about the current application configuration.
    2. List all available settings provider names.
    3. List all values within a settings provider (cached, can optionally be refreshed just before fetch) -- For now it only functions in Vault-based environments.
    4. Get the value of a specific setting in a provider, supported on both Vault and Env var based environments.
    5. Support for setting a specific setting value in a provider, for now only supported by Vault providers as base class is only Vault and the base class does not fall back to EnvVar provider when Vault refresh is not enabled within set commands.
    6. Support for refreshing all registered auto refresh providers immediately, or in turn refreshing a specific provider (will possibly refresh twice if the refresh thread hits is around the same time)

* #336: Minor fix with Help command

Correctly fetch the required permission attribute

* Update recovery to reflect logger changes

* Update recovery log message adaptor

* #336: Settings Command List

Account for the fact that cached values is a dictionary of strings and JsonElements, 1.1.0 of Configuration should address this issue and it will be removed in a future release

* Update Help.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

* Update ClientSettings.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

* Update OnLogMessage.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

* Update OnLogMessage.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

* Update ScriptLogger.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

* Update IScriptLogger.cs

Signed-off-by: Nikita Petko <petko@vmminfra.net>

---------

Signed-off-by: Nikita Petko <petko@vmminfra.net>
@mfdlabs-ops mfdlabs-ops moved this from On Track to Complete in GRIDBOT Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: code-ops Issue relates to the issue of Code Ops area: discord Issue relates to discord kind: feature This issue integrates a single feature (or multiple disguised as one) opsec: love-all-environments SEC-04-LAE opsec: we-love-clean-code SEC-10-WLCC
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

1 participant