-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: BluLightShow <[email protected]>
- Loading branch information
1 parent
b79982c
commit 3cb609b
Showing
4 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Listener } from 'discord-akairo' | ||
import { version } from '../../package.json' | ||
import { config, embed } from '../bot' | ||
import * as cache from '../utils/cache' | ||
import { ButtonInteraction, CommandInteraction, Interaction, MessageEmbed } from 'discord.js' | ||
|
||
export default class InteractionListener extends Listener { | ||
public constructor() { | ||
super('interactionCreate', { | ||
emitter: 'client', | ||
event: 'interactionCreate' | ||
}) | ||
} | ||
|
||
public exec(interaction: any) { | ||
if (interaction.isButton() && (interaction.message.id === config.specialMessages.roleSelect)) { | ||
var member = interaction.member | ||
if (interaction.customId === 'events') { | ||
if (member.roles.cache.get(config.roles.eventNotifsOptin)) { | ||
member.roles.remove(config.roles.eventNotifsOptin) | ||
|
||
interaction.reply({ ephemeral: true, embeds: [ | ||
new MessageEmbed(embed) | ||
.setTimestamp(new Date()) | ||
.setTitle('✅ The event notification role was succesfully removed.') | ||
] }) | ||
} else { | ||
member.roles.add(config.roles.eventNotifsOptin) | ||
|
||
interaction.reply({ ephemeral: true, embeds: [ | ||
new MessageEmbed(embed) | ||
.setTimestamp(new Date()) | ||
.setTitle('✅ The event notification role was succesfully added.') | ||
] }) | ||
} | ||
} else if (interaction.customId === 'server_updates') { | ||
if (member.roles.cache.get(config.roles.serverUpdateNotifsOptin)) { | ||
member.roles.remove(config.roles.serverUpdateNotifsOptin) | ||
|
||
interaction.reply({ ephemeral: true, embeds: [ | ||
new MessageEmbed(embed) | ||
.setTimestamp(new Date()) | ||
.setTitle('✅ The server update notification role was succesfully removed.') | ||
] }) | ||
} else { | ||
member.roles.add(config.roles.serverUpdateNotifsOptin) | ||
|
||
interaction.reply({ ephemeral: true, embeds: [ | ||
new MessageEmbed(embed) | ||
.setTimestamp(new Date()) | ||
.setTitle('✅ The server update notification role was succesfully added.') | ||
] }) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters