oup's Two

This commit is contained in:
Jill 2023-03-22 13:53:54 +03:00
parent b85d65563f
commit ddf763bcf1
Signed by: oat
GPG Key ID: 33489AA58A955108
1 changed files with 2 additions and 1 deletions

View File

@ -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}\``