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

Null channels within private thread channels. #335

Merged
merged 8 commits into from
Sep 17, 2024

Conversation

jf-06
Copy link
Contributor

@jf-06 jf-06 commented Sep 3, 2024

Please read into discord-net/Discord.Net#2997 for more information.

Example exception:

Discord.Interactions.InteractionException: Error occurred executing execute script.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Grid.Bot.Utility.ScriptLogger.LogScriptAsync(String script, ShardedInteractionContext context) in /home/runner/work/grid-bot/grid-bot/services/grid-bot/lib/utility/Implementation/ScriptLogger.cs:line 91
   at Grid.Bot.Interactions.Public.ExecuteScript.ExecuteScriptFromTextAsync(String script) in /home/runner/work/grid-bot/grid-bot/services/grid-bot/lib/commands/Modules/ExecuteScript.cs:line 317
   at Discord.Interactions.Builders.ModuleClassBuilder.<>c__DisplayClass11_0.<<CreateCallback>g__ExecuteCallback|1>d.MoveNext()
   --- End of inner exception stack trace ---

~ Take into account that forum channels exist.
~ Allow logging of already existing script hashes (just log the hash instead of the whole content)
@jf-06 jf-06 changed the title Update ScriptLogger.cs Null channels within private thread channels. Sep 3, 2024
@jf-06
Copy link
Contributor Author

jf-06 commented Sep 3, 2024

Will update this branch with a patch and deploy it to production to temporarily mitigate this issue until the mentioned issue is rectified.

@jf-06 jf-06 marked this pull request as draft September 3, 2024 23:32
@jf-06 jf-06 added priority: key deliverable The issue is high priority and normally has a very close target quarter. platform: windows This issue relates to windows. platform: linux This issue relates to Linux. platform: mac-os This issue relates to MacOS. opsec: love-all-environments SEC-04-LAE opsec: love-all-platforms SEC-04-LAP opsec: public-ops SEC-02-PUBOPS opsec: discord-gateway SEC-25-GATEWAY 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 kind: hotfix A bug fix that is to be implemented as fast as possible. Always KD. area: dependencies Pull requests that update a dependency file labels Sep 3, 2024
@jf-06 jf-06 added this to the SEC-10-WLCC milestone Sep 3, 2024
@jf-06 jf-06 requested a review from mfdlabs-ops September 3, 2024 23:34
#!components: grid-bot

discord-net/Discord.Net#2997 and #335

In the case of interactions, fallback to ChannelId.
In the case of messages, fallback to Thread ID.
#!skip-build!#

Add ability to append suffixes to versions
#!skip-build!#
#!skip-build!#
Implement extension methods for the socket interaction context class for the following purposes:
~ Getting the channel as a string, taking into consideration that the channel can be null when interactions are executed within private thread channels.
~ Getting the guild as an object from the interaction context when the interaction is coming from a private thread channel, as the conventional method of checking the type of the interaction's channel against SocketGuildChannel will not work.
~ Move Regex for format parts to a GeneratedRegex function to improve performance.
~ Only read the LuaVM template once, as it is read from the resources on every subsequent use.
~ Account for the absence of the LuaVM in results.
#!components: grid-bot

ExecuteScript.cs:
~ Take reference to current DiscordShardedClient.
~ Move correspondence calls when errors are called to use LuaError instead of regular follow ups.
~ Add detection of scripts containing code blocks within zero content (causes exception)
~ Rewrite error for scripts that contain unicode to reduce ambiguity.
~ Rename GridJob to ClientJob.
~ Clean up call to PollDeletion
~ Integrate use of GetChannelAsString and GetGuild.

OnSlashCommand, OnSlashCommandExecuted, LoggerFactory, ScriptLogger:
~ Clean up usings.
~ Rewrite GetGuildId to use extension methods.
~ Change around references to channel to use extension methods.
@jf-06 jf-06 marked this pull request as ready for review September 17, 2024 20:20
@jf-06 jf-06 merged commit d8bf48d into master Sep 17, 2024
6 checks passed
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: dependencies Pull requests that update a dependency file area: discord Issue relates to discord kind: hotfix A bug fix that is to be implemented as fast as possible. Always KD. opsec: discord-gateway SEC-25-GATEWAY opsec: love-all-environments SEC-04-LAE opsec: love-all-platforms SEC-04-LAP opsec: public-ops SEC-02-PUBOPS opsec: we-love-clean-code SEC-10-WLCC platform: linux This issue relates to Linux. platform: mac-os This issue relates to MacOS. platform: windows This issue relates to windows. priority: key deliverable The issue is high priority and normally has a very close target quarter.
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

2 participants