medi
DIAdiscord.js - Imagine an app
•Created by medi on 8/18/2024 in #djs-questions
Send a message in a specific channel?
I copy pasted the guide and it doesn't work. Maybe there are some errors?
import { Client, Events, GatewayIntentBits, Partials } from "discord.js"
...
const channel = client.channels.cache.get("1274810907113029664");
const timePassed = 0
setInterval(() => {
channel.send(`${timePassed} minutes has passed`);
timePassed++
}, 1 * 60 * 1000);
import { Client, Events, GatewayIntentBits, Partials } from "discord.js"
...
const channel = client.channels.cache.get("1274810907113029664");
const timePassed = 0
setInterval(() => {
channel.send(`${timePassed} minutes has passed`);
timePassed++
}, 1 * 60 * 1000);
channel.send(`${timePassed} minutes has passed`);
^
TypeError: Cannot read properties of undefined (reading 'send')
at file:///C:/Users/zxc/Documents/Coding%20Projects/admiral%20hipper/main.js:44:9
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
channel.send(`${timePassed} minutes has passed`);
^
TypeError: Cannot read properties of undefined (reading 'send')
at file:///C:/Users/zxc/Documents/Coding%20Projects/admiral%20hipper/main.js:44:9
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
11 replies