added !list command
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
|
const { Client, Events, GatewayIntentBits, Partials, EmbedBuilder } = require('discord.js');
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
GatewayIntentBits.Guilds,
|
||||||
@@ -91,6 +91,8 @@ client.on(Events.MessageCreate, async (msg) => {
|
|||||||
case "remove":
|
case "remove":
|
||||||
delChannel(args[1], msg)
|
delChannel(args[1], msg)
|
||||||
break;
|
break;
|
||||||
|
case "list":
|
||||||
|
listChannels(msg)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -118,4 +120,19 @@ function delChannel(channel, msg) {
|
|||||||
content: `Unsubscribed from [${channel}] Notifications!`
|
content: `Unsubscribed from [${channel}] Notifications!`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function listChannels(msg){
|
||||||
|
let subscribed = []
|
||||||
|
let embed = new EmbedBuilder()
|
||||||
|
.setTitle('Lists of Subscribed Channels:')
|
||||||
|
for (const [key, value] of Object.entries(channels)) {
|
||||||
|
if(value.includes(msg.author.id)){
|
||||||
|
subscribed.push(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
embed.setDescription(subscribed.join("\n"))
|
||||||
|
|
||||||
|
msg.reply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
}
|
||||||
client.login(process.env.DISCORD_Token);
|
client.login(process.env.DISCORD_Token);
|
||||||
|
|||||||
Reference in New Issue
Block a user