#Getting and TypeError: (0 , status_1.SendStatusEmbed) is not a function

29 messages · Page 1 of 1 (latest)

vivid lagoon
#

let message = await channel.messages.fetch(messageid).catch(() => {SendStatusEmbed(channel,channel.id,ip,port,configPATH)} )

The SendStatusEmbed is a function imported from a different file where it works flawlessly. Any idea?

safe hawk
#

a TypeError is a runtime error
if node says it's not a function, then it's either not a function, or there is something going on with your compiled code

vivid lagoon
#

its a function i can call it in the file where im exporting it

safe hawk
#

maybe showing more could would help

#

and a stacktrace too

#

also, are you using discord.js or something?

vivid lagoon
#
    channel.send({ embeds: [StatusEmbed]}).then((message:any) => {
    const obj:object = {
        "channelid": channelid,
        "messageid": message.id,
        "ip": ip,
        "port": port
    }
    fs.writeFileSync(configPATH,JSON.stringify(obj))
    })
}```

File where where its called:
```import { SendStatusEmbed, StatusEmbed} from "../../../commands/status";```
safe hawk
#

well, would be interesting to show that file as well, since you are using SendStatusEmbed

vivid lagoon
safe hawk
#

oh, right

vivid lagoon
#

other than that there is nothing elsse except the variables used to run the func

safe hawk
#

what about the stacktrace?

vivid lagoon
safe hawk
#

the error message you got

#

it also had information about the exact place where the code crashed

#

it might give some clues

#

where does the error occur?

vivid lagoon
#
TypeError: (0 , status_1.SendStatusEmbed) is not a function
    at C:\Users\dep\Desktop\GIT\Bot\src\events\ready\stat\status.ts:22:95
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
vivid lagoon
#

Where is the function

safe hawk
#

maybe try having a look at the generated code monkaHmm

#

also, what are you using to compile your code? just tsc? or some other tool?

vivid lagoon
safe hawk
#

maybe try build it locally with tsc, just to see what the emitted code looks like

#

because it should be a function and it should be callable MeowThink

vivid lagoon
#

so weirrrdd