await API calls

This commit is contained in:
LenAnderson 2024-07-22 18:48:01 -04:00
parent 621ef197da
commit 133a3663f4
1 changed files with 12 additions and 12 deletions

View File

@ -555,8 +555,8 @@ export class SlashCommandHandler {
new SlashCommandNamedArgument('inject', 'inject user input automatically (if disabled use {{input}})', [ARGUMENT_TYPE.BOOLEAN], false), new SlashCommandNamedArgument('inject', 'inject user input automatically (if disabled use {{input}})', [ARGUMENT_TYPE.BOOLEAN], false),
]; ];
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-create', SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-create',
callback: (args, name) => { callback: async (args, name) => {
this.createSet(name, args); await this.createSet(name, args);
return ''; return '';
}, },
aliases: ['qr-presetadd'], aliases: ['qr-presetadd'],
@ -586,8 +586,8 @@ export class SlashCommandHandler {
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-update', SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-update',
callback: (args, name) => { callback: async (args, name) => {
this.updateSet(name, args); await this.updateSet(name, args);
return ''; return '';
}, },
aliases: ['qr-presetupdate'], aliases: ['qr-presetupdate'],
@ -611,8 +611,8 @@ export class SlashCommandHandler {
`, `,
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-delete', SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'qr-set-delete',
callback: (_, name) => { callback: async (_, name) => {
this.deleteSet(name); await this.deleteSet(name);
return ''; return '';
}, },
aliases: ['qr-presetdelete'], aliases: ['qr-presetdelete'],
@ -932,9 +932,9 @@ export class SlashCommandHandler {
} }
createSet(name, args) { async createSet(name, args) {
try { try {
this.api.createSet( await this.api.createSet(
args.name ?? name ?? '', args.name ?? name ?? '',
{ {
disableSend: isTrueBoolean(args.nosend), disableSend: isTrueBoolean(args.nosend),
@ -946,9 +946,9 @@ export class SlashCommandHandler {
toastr.error(ex.message); toastr.error(ex.message);
} }
} }
updateSet(name, args) { async updateSet(name, args) {
try { try {
this.api.updateSet( await this.api.updateSet(
args.name ?? name ?? '', args.name ?? name ?? '',
{ {
disableSend: args.nosend !== undefined ? isTrueBoolean(args.nosend) : undefined, disableSend: args.nosend !== undefined ? isTrueBoolean(args.nosend) : undefined,
@ -960,9 +960,9 @@ export class SlashCommandHandler {
toastr.error(ex.message); toastr.error(ex.message);
} }
} }
deleteSet(name) { async deleteSet(name) {
try { try {
this.api.deleteSet(name ?? ''); await this.api.deleteSet(name ?? '');
} catch (ex) { } catch (ex) {
toastr.error(ex.message); toastr.error(ex.message);
} }