Skip to content

Commit

Permalink
Reverts loud intros through context menu (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphyree committed Sep 23, 2022
1 parent 136add0 commit 4275d4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/contextmenu/induct.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ module.exports = {
.setDefaultMemberPermissions(0x10000000)
.setName("Induct User")
.setType(ApplicationCommandType.User),
silent: true,
async execute(interaction) {
let dt = new Date().toUTCString();
await interaction.deferReply({ ephemeral: true });
await wait(1000);

let user = interaction.targetMember;
await interaction.guild.members.fetch();
await interaction.guild.channels.fetch();
let user = await interaction.guild.members.fetch(interaction.targetId);

let general, roles, role;

Expand Down Expand Up @@ -46,7 +47,7 @@ module.exports = {

if (user.roles.cache.find((r) => r.name === "Guest")) {
console.log(
`${dt} - Warning: ${interaction.user.tag} tried to induct ${user.tag} but they were already inducted.`
`${dt} - Warning: ${interaction.user.tag} tried to induct ${user.user.tag} but they were already inducted.`
);
return await interaction.editReply({
content: "User is already inducted.",
Expand All @@ -57,17 +58,20 @@ module.exports = {
await user.roles.add(role);
await interaction.guild.members.fetch();

if (general.send(message)) {
if (
(!this.silent && general.send(message)) ||
(this.silent && user.roles.cache.find((r) => r.name === "Guest"))
) {
console.log(
`${dt} - Warning: ${interaction.user.tag} has inducted ${user.tag} into CSS.`
`${dt} - Warning: ${interaction.user.tag} has inducted ${user.user.tag} into CSS.`
);
await interaction.editReply({
content: "User inducted successfully.",
ephemeral: true,
});
} else {
console.log(
`${dt} - Warning: An error occured during ${interaction.user.tag}'s induction of ${user.tag}`
`${dt} - Warning: An error occured during ${interaction.user.tag}'s induction of ${user.user.tag}`
);
await interaction.editReply({
content: "Something has gone wrong.",
Expand Down
2 changes: 0 additions & 2 deletions src/deploy-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ for (const file of contextMenuFiles) {

const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);

console.log(commands);

rest
.put(Routes.applicationCommands(process.env.CLIENTID), { body: commands })
.then(() => console.log("Successfully registered application commands."))
Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,4 @@ for (const file of eventFiles) {
}
}

console.log(client.commands);

client.login();

0 comments on commit 4275d4c

Please sign in to comment.