Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert loud intros through context menu #24

Merged
merged 1 commit into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();