Intent code problem

Hello, i am having a problem with this type of error, and i cannot figure out why it wasnt working. Its completely working on the other replit project, but in here it wasnt. I copied everything on that project, but why? whats the issue?

Hi @OreoNM!

Is it possible we could see your full code and possibly a link to your Repl?

(If your bot’s token is stored openly, I would highly recommend quickly switching to the usage of environment variables or your token could be stolen by malicious users.)

1 Like

Like @bobastley said, we’d need your your full code or the link to your Repl to help you better, but I believe this works?:

import discord

bot = commands.Bot(command_prefix=prefix, intents=discord.Intents.default())
2 Likes

Edit your question and use the Preformatted Text (</>) to include all of your code inside of it. Also, what @QwertyQwerty88 said should fix your problem.

Packages

Packages that are used in the replit
discord, discord webhook, flask, numpy, colorama, urllib3, replit

This is a self bot only for educational purposes, and i know that this is again’st the discord TOS. But please help me to fix this messed up code.

**Here's the full code**:

import discord
from discord.ext import commands
import colorama
from colorama import Fore
import asyncio
from webserver import keep_alive
from discord_webhook import DiscordEmbed, DiscordWebhook
import os

#-Setup-

prefix = ">"

# use .env feature to hide your token

keep_alive()
token = os.getenv("Token")

#-DO NOT TOUCH-
pslink = os.getenv("Link")

bot = commands.Bot(command_prefix=prefix,
                   help_command=None,
                   case_insensitive=True,
                   self_bot=True)

@bot.command(pass_context=True)
async def start(ctx):
  await ctx.message.delete()
  global dmcs
  dmcs = True
  while dmcs:
    async with ctx.typing():
      await asyncio.sleep(10)
      await ctx.send(pslink)
      print(f"{Fore.RED}Sent a link!")
      webhook = DiscordWebhook(url="https://discord.com/api/webhooks/test")

      embed = DiscordEmbed(
    title="Notification!", description="The private server link has been delivered!", color="03b2f8"
)
      embed.set_author(
      name="Tests",
      icon_url="https://media.discordapp.net/attachments/test",
)
      embed.set_footer(text="Executed by <@test>")
      embed.set_timestamp()
      webhook.add_embed(embed)
      response = webhook.execute()
      await asyncio.sleep(300)

@bot.command()
async def stop(ctx):
  await ctx.message.delete()
  await ctx.send('Has been disabled!')
  global dmcs
  dmcs = False
  
@bot.event
async def on_ready():
  activity = discord.Game(name="Test's Running..", type=4)
  await bot.change_presence(status=discord.Status.online, activity=activity)
  print(f'''{Fore.GREEN}Test Is Prepared!''')
  
bot.run(token, bot=False)


Use this:
image

It will generate this → ``` automatically, just put your code inside.

Its now edited, try to backread it again, hehe.

Great Job!

As I said before, what Qwerty said should fix your problem.

Could you send me the fixed version of it so i can just plug it in on my replit?

You just have to change

#-Setup-

prefix = ">"

To

bot = commands.Bot(command_prefix=">", intents=discord.Intents.all())

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.