oup's Two
This commit is contained in:
parent
b85d65563f
commit
ddf763bcf1
|
@ -18,12 +18,13 @@ module.exports = {
|
|||
await interaction.deferReply({ephemeral: true});
|
||||
const announcementType = interaction.options.getString('type') as string;
|
||||
|
||||
if (subscriptions[announcementType].includes(interaction.channelId)) {
|
||||
if (subscriptions[announcementType] && subscriptions[announcementType].includes(interaction.channelId)) {
|
||||
subscriptions[announcementType] = subscriptions[announcementType].filter(id => id !== interaction.channelId);
|
||||
await interaction.followUp({
|
||||
content: `<#${interaction.channelId}> has been unsubscribed from \`${announcementType}\``
|
||||
});
|
||||
} else {
|
||||
subscriptions[announcementType] = subscriptions[announcementType] || [];
|
||||
subscriptions[announcementType].push(interaction.channelId);
|
||||
await interaction.followUp({
|
||||
content: `<#${interaction.channelId}> has been subscribed to \`${announcementType}\``
|
||||
|
|
Loading…
Reference in New Issue