Browse Source

Fix announcements failing

pull/1/head
Abheek Dhawan 4 years ago
parent
commit
c860dfd0b4
  1. 14
      bot/awesomescibo.mjs
  2. 2
      bot/package.json

14
bot/awesomescibo.mjs

@ -21,7 +21,7 @@ if (fs.existsSync('numhits.txt')) {
client.once('ready', () => { client.once('ready', () => {
console.log('Ready!'); console.log(client.user.username);
client.user.setActivity("for \"do be helping\"", { type: "WATCHING" }); client.user.setActivity("for \"do be helping\"", { type: "WATCHING" });
}); });
@ -30,10 +30,16 @@ client.on('guildCreate', guild => {
}); });
client.on('message', async message => { client.on('message', async message => {
if (message.content.startsWith("do be announcing") && message.author.id === "745063586422063214") {
if (message.content.startsWith("do be announcing") && message.author.id === "author-id") {
var announcement = message.content.substring(17); var announcement = message.content.substring(17);
client.guilds.cache.array().forEach((guild) => { client.guilds.cache.forEach((guild) => {
guild.channels.cache.find(channel => channel.name === 'general').send(announcement).catch((error) => { console.log(error) }) var channel = guild.channels.cache.find(channel => channel.name === 'general');
if (channel) {
if (channel.type = "text") {
channel.send(announcement);
}
}
}); });
} }
if (message.content.toLowerCase() === "do be hits") { if (message.content.toLowerCase() === "do be hits") {

2
bot/package.json

@ -5,7 +5,7 @@
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1"
}, },
"name": "awscibo", "name": "awscibo",
"version": "0.2.0", "version": "0.2.2",
"main": "awesomescibo.mjs", "main": "awesomescibo.mjs",
"bin": { "bin": {
"awscibo": "./awesomescibo.mjs" "awscibo": "./awesomescibo.mjs"

Loading…
Cancel
Save