use interaction handler

This commit is contained in:
SowinskiBraeden committed 2023-01-21 16:03:55 -08:00
1 parent 2a8252289c
commit 05930e8d33
6 files changed
+38 -15

No files matched your search

+1 -1
View File
@@ -63,8 +63,8 @@ module.exports = {
socket.emit('botping', {message:'hello there'});
socket.on('botpong', (data) => {
if (debugConsole) client.log('Debug: Socket responded')
return interaction.send({ content: `Debug: Socket responded` })
socket.disconnect();
return interaction.send({ content: `Debug: Socket responded` })
});
} else if (command == "apicheck") {
+12 -9
View File
@@ -104,10 +104,14 @@ module.exports = {
)
}
interaction.send({ embeds: [nameResult], components: [row] });
client.on("interactionCreate", ButtonInteraction => {
const socket = io.connect(client.config.socket);
return interaction.send({ embeds: [nameResult], components: [row] });
});
},
},
Interactions: {
license: {
run: async (client, ButtonInteraction, { GuildDB }) => {
const socket = io.connect(client.config.socket);
let queryString = ButtonInteraction.customId;
let query = {
@@ -124,12 +128,11 @@ module.exports = {
}
socket.emit("update_drivers_license_status", query);
socket.on("bot_updated_drivers_license_status", (res) => {
if (!res.success) ButtonInteraction.update({ content: 'Failed to update license.', embeds: [], components: [] });
socket.disconnect();
if (!res.success) return ButtonInteraction.update({ content: 'Failed to update license.', embeds: [], components: [] });
});
return ButtonInteraction.update({ content: 'Successfully updated license.', embeds: [], components: [] });
});
});
},
},
}
}
}
}
+3 -2
View File
@@ -66,9 +66,10 @@ module.exports = {
const socket = io.connect(client.config.socket);
socket.emit('bot_update_status', req);
socket.on('bot_updated_status', (res) => {
interaction.send({ content: `Succesfully updated <@${interaction.member.user.id}>'s status to \`${args[0].value}\`` });
socket.disconnect();
});
return interaction.send({ content: `Succesfully updated <@${interaction.member.user.id}>'s status to \`${args[0].value}\`` });
});
return;
},
},
}