I am a new coder and I never code before. I followed the guideline to help me code a dicord bot but itz’s not helping at all. I want to give up. Can you help me?
https://replit.com/@keyblademasterl/Kairi#.replit
code snippet
I am a new coder and I never code before. I followed the guideline to help me code a dicord bot but itz’s not helping at all. I want to give up. Can you help me?
https://replit.com/@keyblademasterl/Kairi#.replit
code snippet
I dont know if I am posting the right link. Sorry
Could you share the current error your bot is causing?
Forgive me if I give you the wrong code
node index.js
/home/runner/Kairi/index.js:1
import discord
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.16.1
exit status 1
Try replacing that line with this:
const discord = require("discord");
I have this now:
const discord = require("discord");
from discord .ext import comands
from keep_alive import keep_alive
bot = comands.Bot(comand_prefix="!", intents=discord.Intents.all(), case_insensitive=True)
@bot.event)
async def on_ready():
print("Bot is ready")
@bot.comands)
async def ping(ctx):
await ctx.send("pong")
keep_alive()
bot.run("<token>")
Here what the error says now
node index.js
/home/runner/Kairi/index.js:2
from discord .ext import comands
^^^^^^^
SyntaxError: Unexpected identifier
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.16.1
exit status 1
It seems like you’re writing Python code in a node JS repl. Create a new repl with the Python template and paste your original code in the repl.
How do that? Sorry my mistake
Ok will do. Thanks for the info