Skip to content

Commit

Permalink
Fix slash command
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightnessTM committed Jun 10, 2021
1 parent 0d8a937 commit 9d22233
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ client.ws.on("INTERACTION_CREATE", async interaction => {
try {
if (client.slashcommands.get(interaction.data.name)) {
commandLog(`<:slashcommands:785919558376488990> ${interaction.member.user.username}#${interaction.member.user.discriminator} (\`${interaction.member.user.id}\`) ran slash command \`${interaction.data.name}\` in the \`${interaction.channel_id}\` channel of \`${interaction.guild_id}\``, { client, content: "" });
if (!interaction.member) interaction.member = {user: interaction.user};
await client.slashcommands.get(interaction.data.name)(interaction, client, Discord);
}
} catch (e) {
Expand Down
6 changes: 4 additions & 2 deletions slash_commands/asuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const { string } = require("../utils/strings");
const humanizeDuration = require("humanize-duration");
const { initTrello } = require("../utils/trello");
module.exports = async function (interaction, client) {
console.log(interaction);
function respond(data) {
client.api.interactions(interaction.id, interaction.token).callback.post({data: {
type: 4,
Expand All @@ -21,8 +20,11 @@ module.exports = async function (interaction, client) {
});
}
let qUserDB = await dbQuery("User", { id: interaction.member.user.id });
let locale = qUserDB.locale || "en";
if (!interaction.guild_id) return respond(string(locale, "COMMAND_SERVER_ONLY", {}, "error"));
let qServerDB = await dbQuery("Server", { id: interaction.guild_id });
let locale = qUserDB.locale || (qServerDB ? qServerDB.config.locale : "") || "en";
locale = qUserDB.locale || (qServerDB ? qServerDB.config.locale : "") || "en";

if (!qServerDB) return respond(string(locale, "UNCONFIGURED_ERROR", {}, "error"));
const guildLocale = qServerDB.config.locale;

Expand Down

0 comments on commit 9d22233

Please sign in to comment.