'use strict';
const { MessageEmbed, Client, MessageAttachment } = require('discord.js');
const client = new Client( );
let config = require('./botconfig.json')
let token = config.token
client.on("ready", async () => {
console.log(`${client.user.username} is ready for action!`);
if (config.activity.streaming == false) {
client.user.setActivity(config.activity.game, {type: 'PLAYING'});
}
});
client.on('message', async message => {
const image = message.attachments.first();
const link = message.content.startsWith('http');
const emoji = message.content.startsWith(':');
if ( message.channel.id === '998926319729508392' || message.channel.id === '998926325987426324' || message.channel.id === '998939345274814544') {
if(!image && !link || emoji) {
setTimeout(function(){
message.delete()
}, 1000) }
}
});
client.login(token);
/app/node_modules/discord.js/src/client/actions/MessageCreate.js:11
const existing = channel.messages.cache.get(data.id);
^
TypeError: Cannot read properties of undefined (reading 'cache')
at MessageCreateAction.handle (/app/node_modules/discord.js/src/client/actions/MessageCreate.js:11:41)
at Object.module.exports [as MESSAGE_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
at WebSocketShard.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
at WebSocketShard.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (node:events:527:28)
at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:1008:20)
at Receiver.emit (node:events:527:28)
at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:517:14)