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

Create-invite Command fix #298

Merged
merged 4 commits into from
Mar 14, 2024
Merged

Create-invite Command fix #298

merged 4 commits into from
Mar 14, 2024

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Mar 14, 2024

Notes

The /create-invite command was failing to appear correctly on the prod version of valkyrie. From local testing it seems like this could be the case of commands.set vs commands.create.

Also removes fjord.ts since it seems likely that was causing the main issue with overwriting commands. Especially since n8n integration hasn't been a thing except for standups.

### Notes

The `/create-invite` command was failing to appear correctly on the prod version of valkyrie. From local testing it seems like this could be the case of `commands.set` vs `commands.create`
@zuuring zuuring requested a review from Shadowfiend March 14, 2024 11:53
Remove `fjord.ts` since the n8n commands have not been implemented and it seems to be causing an issue with setting new commands.
@zuuring
Copy link
Member Author

zuuring commented Mar 14, 2024

One thing discovered in testing is that even if we remove fjord.ts the old commands are stored in the cache. So quick fix is to just run a command wipe before we run the rest. Or just add it temporarily to remove set fjord.ts commands /n8n, /debug, /activity, /stale-issues, /issues

Something along these lines we could use to ensure cache is clear of other valkyrie commands

const existingCommands = await application.commands.fetch()
await Promise.all(existingCommands.map(cmd => application.commands.delete(cmd.id)))
robot.logger.info("All old commands deleted")
Screenshot 2024-03-14 at 14 36 18

This then wipes the commands stored before we set the new one's in Valkyrie

The main question is if we use this route, we would need to run it before the discord-scripts are loaded, so perhaps in discord.ts

zuuring added 2 commits March 14, 2024 16:32
This checks if the `n8n` command exists and if so, removes all commands. Let's remove this after merging since it only has to run once to delete existing commands.
Prettier fixes
@zuuring
Copy link
Member Author

zuuring commented Mar 14, 2024

Added a quick check if n8n commands exist, then if so proceed to delete all commands. We can remove this afterwards since it only has to run once to wipe old fjord.ts commands from guild cache.

Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All righty let's ship it. We'll probably want to restart once after the initial execution as well.

@Shadowfiend Shadowfiend merged commit 0d3b1c5 into main Mar 14, 2024
7 checks passed
@Shadowfiend Shadowfiend deleted the invite-command-fix branch March 14, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants