BulkOverwrite has stopped functioning

In the last 5 months have there been any breaking changes to how commands register? I created 2 sapphirecli slash commands and one has appeared after several days (roll), the other one (createchannel) was pushed 2 hours ago and has not shown up in the BulkOverwritten guild yet.
No description
Solution:
I think I might be deleting/creating my container incorrectly, is this not enough to update a running container?
Jump to solution
37 Replies
Songbird
SongbirdOP8mo ago
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { CategoryChannel, ChannelType } from 'discord.js';

@ApplyOptions<Command.Options>({
name: 'createchannel',
description: 'debug command to create a channel'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addStringOption((option) =>
option //
.setName('name')
.setDescription('The name of the channel')
.setRequired(true)
)
.addIntegerOption((option) =>
option //
.setName('categoryID')
.setDescription('The category ID to place the channel under')
.setRequired(true)
)
);
} ........
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { CategoryChannel, ChannelType } from 'discord.js';

@ApplyOptions<Command.Options>({
name: 'createchannel',
description: 'debug command to create a channel'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addStringOption((option) =>
option //
.setName('name')
.setDescription('The name of the channel')
.setRequired(true)
)
.addIntegerOption((option) =>
option //
.setName('categoryID')
.setDescription('The category ID to place the channel under')
.setRequired(true)
)
);
} ........
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';

@ApplyOptions<Command.Options>({
// name: 'roll',
description: 'Roll an n-sided die m times and return the results.'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addIntegerOption((option) =>
option //
.setName('sides')
.setDescription('The number of sides on the dice')
.setRequired(true)
)
.addIntegerOption((option) =>
option //
.setName('rolls')
.setDescription('The number of times to roll the dice')
.setRequired(false)
)
);
}...........
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';

@ApplyOptions<Command.Options>({
// name: 'roll',
description: 'Roll an n-sided die m times and return the results.'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addIntegerOption((option) =>
option //
.setName('sides')
.setDescription('The number of sides on the dice')
.setRequired(true)
)
.addIntegerOption((option) =>
option //
.setName('rolls')
.setDescription('The number of times to roll the dice')
.setRequired(false)
)
);
}...........
ApplicationCommandRegistries.setDefaultGuildIds(['925192180480491540']);
ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
ApplicationCommandRegistries.setDefaultGuildIds(['925192180480491540']);
ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
in index.ts also added these to lib/setup.ts
import '@sapphire/plugin-logger/register';
import '@sapphire/plugin-api/register';
import '@sapphire/plugin-editable-commands/register';
import '@sapphire/plugin-subcommands/register';
import '@sapphire/plugin-logger/register';
import '@sapphire/plugin-api/register';
import '@sapphire/plugin-editable-commands/register';
import '@sapphire/plugin-subcommands/register';
Favna
Favna8mo ago
no if there would be a new semver major version of sapphire would've been published. Semver doesn't allow breaking changes in patch or minor versions. make sure you're compiling your TS code and clean dist to be sure
Songbird
SongbirdOP8mo ago
hmm would this still apply given that it’s a docker image that is recreated every commit and deleted/pulled every time? no volumes either
Favna
Favna8mo ago
it wouldnt, but make sure that your docker builds are working and not failing during build
Songbird
SongbirdOP8mo ago
don’t think they are, I have it set up through GH actions and it wouldn’t pass the pipeline unless it succeeded
Favna
Favna8mo ago
so is the pipeline green?
Songbird
SongbirdOP8mo ago
yes sir it is one second
Songbird
SongbirdOP8mo ago
No description
Songbird
SongbirdOP8mo ago
No description
Songbird
SongbirdOP8mo ago
Any other ideas @Favna ? It still hasn’t shown up which is making me think it’s my code.. https://github.com/masonbesmer/lyra-sapphire/blob/main/src/commands/CreateChannel.ts
GitHub
lyra-sapphire/src/commands/CreateChannel.ts at main · masonbesmer/l...
A rewrite of Night City's Discord bot, in TypeScript, using SapphireJS. Now using GitHub Actions! - masonbesmer/lyra-sapphire
Favna
Favna8mo ago
Can you try setting the default behaviour to overwrite instead of bulk? I can't recall what it was, would have to search this forum, but there was a weird bug with bulk before Maybe if you search this channel for BulkOverwrite you can find that thread again
Songbird
SongbirdOP8mo ago
I can try it again though and leave it for a few hours
Favna
Favna8mo ago
commands should always register instantly waiting a few hours does nothing that's something of way back in the day only
Songbird
SongbirdOP8mo ago
oh. I’ll try it again and see if it randomly works this time Good to know though has to be something wrong with my code 🙄 still not appeared overnight
Favna
Favna8mo ago
@vladdy thy hath been summoned
vladdy
vladdy8mo ago
huh which cmd doesnt show up
Songbird
SongbirdOP8mo ago
CreateChannel I think I may have just figured it out, but im veryifying rq
Solution
Songbird
Songbird8mo ago
I think I might be deleting/creating my container incorrectly, is this not enough to update a running container?
vladdy
vladdy8mo ago
you're doing What
Songbird
SongbirdOP8mo ago
echo "Stopping container..." &&\
docker stop Lyra &&\
echo "Deleting container..." &&\
docker rm Lyra &&\
echo "Creating container..." &&\
docker run\
-d\
--name='Lyra'\
--net='bridge'\
-e TZ="America/Chicago"\
-e HOST_OS="Unraid"\
-e HOST_HOSTNAME="Moonlink"\
-e HOST_CONTAINERNAME="Lyra"\
-e 'DISCORD_TOKEN'='token'\
-l net.unraid.docker.managed=dockerman\
-l net.unraid.docker.icon='.cx/s/kYF27nN29wBnMoD/preview' 'ghcr.io/masonbesmer/lyra-sapphire:latest' &&\
echo "Removing dangling images..." &&\
docker image prune -f &&\
echo "Finished" &&\
exit 0
echo "Stopping container..." &&\
docker stop Lyra &&\
echo "Deleting container..." &&\
docker rm Lyra &&\
echo "Creating container..." &&\
docker run\
-d\
--name='Lyra'\
--net='bridge'\
-e TZ="America/Chicago"\
-e HOST_OS="Unraid"\
-e HOST_HOSTNAME="Moonlink"\
-e HOST_CONTAINERNAME="Lyra"\
-e 'DISCORD_TOKEN'='token'\
-l net.unraid.docker.managed=dockerman\
-l net.unraid.docker.icon='.cx/s/kYF27nN29wBnMoD/preview' 'ghcr.io/masonbesmer/lyra-sapphire:latest' &&\
echo "Removing dangling images..." &&\
docker image prune -f &&\
echo "Finished" &&\
exit 0
vladdy
vladdy8mo ago
oh
Favna
Favna8mo ago
this is why you use docker compose 👀
Songbird
SongbirdOP8mo ago
:whatge:
Favna
Favna8mo ago
docker compose pull <service>
docker compose up -d --force-recreate --no-deps <service
docker compose pull <service>
docker compose up -d --force-recreate --no-deps <service
done
Songbird
SongbirdOP8mo ago
is it perchance a dropin replacement?
Favna
Favna8mo ago
no you need to write a compose file but you'd do well to do that
vladdy
vladdy8mo ago
btw ithink the issue is your categoryID option, idk if it can have upper case letters but it should log to the console.... do you have any listeners for CommandApplicationCommandRegistryError?
Favna
Favna8mo ago
I have this as control.sh (which in turn is added to PATH) on my linux machines
#!/usr/bin/zsh

RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
WORKSPACE_DIR="$HOME/workspace"

alias dc="docker compose"

# Display a message, wrapping lines at the terminal width.
message() {
printf "$1 \n"
}

function removeAllContainers() {
docker ps -a -q | xargs --no-run-if-empty docker rm -fv
}

help() {
message "\n${BLUE}Infi Docker Control script${NC}

${GREEN}Usage:${NC}\n
control [COMMAND] [ARGS...]
control -h | --help

${YELLOW}Commands:${NC}\n
build Builds a Docker image so it is prepped for running
start Starts a Docker container in detached state
stop Stops a Docker container
remove Removes a single Docker container
removeall Removes all Docker containers
logs Shows the logs of a Docker container
tail Tails the logs of a Docker container
update Updates a running container"
}

case $1 in
build) dc -f ${WORKSPACE_DIR}/docker-compose.yml build ${@:2:99} ;;
start) dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps ${@:2:99} ;;
restart) dc -f ${WORKSPACE_DIR}/docker-compose.yml restart ${@:2:99} ;;
recreate) dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps --force-recreate ${@:2:99} ;;
stop) dc -f ${WORKSPACE_DIR}/docker-compose.yml stop ${@:2:99} ;;
logs) dc -f ${WORKSPACE_DIR}/docker-compose.yml logs -t --tail=100 ${@:2:99} ;;
tail) dc -f ${WORKSPACE_DIR}/docker-compose.yml logs -tf --tail=100 ${@:2:99} ;;
remove) dc -f ${WORKSPACE_DIR}/docker-compose.yml rm -fsv ${@:2:99} ;;
removeall) removeAllContainers ;;
update) dc -f ${WORKSPACE_DIR}/docker-compose.yml pull ${@:2:99} && dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps --force-recreate ${@:2:99} ;;
redis) docker compose -f ${WORKSPACE_DIR}/docker-compose.yml exec redis redis-cli -p ${REDIS_PORT} -a $(cat ${WORKSPACE_DIR}/redis-pass) ;;
*) help ;;
esac
#!/usr/bin/zsh

RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
WORKSPACE_DIR="$HOME/workspace"

alias dc="docker compose"

# Display a message, wrapping lines at the terminal width.
message() {
printf "$1 \n"
}

function removeAllContainers() {
docker ps -a -q | xargs --no-run-if-empty docker rm -fv
}

help() {
message "\n${BLUE}Infi Docker Control script${NC}

${GREEN}Usage:${NC}\n
control [COMMAND] [ARGS...]
control -h | --help

${YELLOW}Commands:${NC}\n
build Builds a Docker image so it is prepped for running
start Starts a Docker container in detached state
stop Stops a Docker container
remove Removes a single Docker container
removeall Removes all Docker containers
logs Shows the logs of a Docker container
tail Tails the logs of a Docker container
update Updates a running container"
}

case $1 in
build) dc -f ${WORKSPACE_DIR}/docker-compose.yml build ${@:2:99} ;;
start) dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps ${@:2:99} ;;
restart) dc -f ${WORKSPACE_DIR}/docker-compose.yml restart ${@:2:99} ;;
recreate) dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps --force-recreate ${@:2:99} ;;
stop) dc -f ${WORKSPACE_DIR}/docker-compose.yml stop ${@:2:99} ;;
logs) dc -f ${WORKSPACE_DIR}/docker-compose.yml logs -t --tail=100 ${@:2:99} ;;
tail) dc -f ${WORKSPACE_DIR}/docker-compose.yml logs -tf --tail=100 ${@:2:99} ;;
remove) dc -f ${WORKSPACE_DIR}/docker-compose.yml rm -fsv ${@:2:99} ;;
removeall) removeAllContainers ;;
update) dc -f ${WORKSPACE_DIR}/docker-compose.yml pull ${@:2:99} && dc -f ${WORKSPACE_DIR}/docker-compose.yml up -d --no-deps --force-recreate ${@:2:99} ;;
redis) docker compose -f ${WORKSPACE_DIR}/docker-compose.yml exec redis redis-cli -p ${REDIS_PORT} -a $(cat ${WORKSPACE_DIR}/redis-pass) ;;
*) help ;;
esac
so I just run control update <service> and boom it updates
vladdy
vladdy8mo ago
I could also use the logs from when you started the bot when it was running with VerboseOverwrite
Songbird
SongbirdOP8mo ago
yes, that is what caused me to think it was my deployment method, because when i forcefully updated the container, it started showing that error it appears that was the only issue though I have fixed the command temporarily and it now functions properly root cause analysis: PICNIC now this is nice
Favna
Favna8mo ago
PICNIC? I mean I know what a picnic is but I've never heard it used as abbreviation
Songbird
SongbirdOP8mo ago
Problem In Chair, Not In Computer
Favna
Favna8mo ago
oohhh
Songbird
SongbirdOP8mo ago
got a very, very noob question for you: do I push my docker-compose.yml to my git repo and let it be built in to the image, or do i only put it on my production server? I'm not exactly 100% sure how compose works
Favna
Favna8mo ago
I do a mix. On the repo is a compose file but it's meant for Dev. The prod server has a separate one because it has env vars for credentials and such. That prod one we backup periodically by gzipping it together with some other files and actually tonight I'm going to explore the new feature of EaseUS Todo Backup free that can auto sync over SFTP (3-2-1 backups)
Songbird
SongbirdOP8mo ago
that's what I figured. thank you, found a nice site to convert from docker run to docker compose so I am switching over rn and probably going to adopt your script
Want results from more Discord servers?
Add your server