#🔒 helpp me pls

101 messages · Page 1 of 1 (latest)

slow scarab
#

whats wrong with my code?

import discord
from discord.ext import commands
import os
from dotenv import load_dotenv

load_dotenv()

token_bot = os.getenv('x')
id_do_servidor = x
id_cargo_atendente = x
id_cargo_suporte = x

client = commands.Bot(command_prefix=".", case_insensitive=True, intents=discord.Intents.default())

@client.event
async def on_ready():
print(f"Entramos como {client.user}")

@client.command()
async def enviarembed(ctx):
embed = discord.Embed(
title="Título",
description="Descrição",
color=discord.Color.red()
)
embed.set_footer(text="Rodapé do embed")
embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar.url)

await ctx.send(embed=embed)  

client.run('x')

wheat sluiceBOT
#

@slow scarab

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

scarlet cave
slow scarab
#

hey

scarlet cave
#

read the embed

slow scarab
#

i got another one but its not workin again

#

import discord
from discord.ext import commands
from dotenv import load_dotenv
import os

Carregar as variáveis do arquivo .env

load_dotenv()

Obtenha o token do bot do arquivo .env

token = os.getenv("")

Crie a instância do bot

intents = discord.Intents.default()
intents.messages = True # Certifique-se de que o bot tem permissão para ler mensagens
client = commands.Bot(command_prefix="!", intents=intents)

Evento que é chamado quando o bot está pronto

@client.event
async def on_ready():
print(f'Bot está logado como {client.user}')

Comando para enviar um embed

@client.command()
async def embed(ctx):
embed = discord.Embed(
title="Exemplo de Embed",
description="Este é um exemplo simples de embed enviado pelo bot.",
color=discord.Color.blue() # Cor do embed
)
embed.set_footer(text="Rodapé do embed") # Rodapé do embed
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url) # Autor do embed

# Enviar o embed no canal onde o comando foi executado
await ctx.send(embed=embed)

Rodar o bot

client.run('')

wheat sluiceBOT
#

Hey @slow scarab!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
scarlet cave
#

format your code also

#

its hard to read it unformatted

slow scarab
#

how i do that?

scarlet cave
slow scarab
#
import discord
from discord.ext import commands
from dotenv import load_dotenv
import os

# Carregar as variáveis do arquivo .env
load_dotenv()

# Obtenha o token do bot do arquivo .env
token = os.getenv("")

# Crie a instância do bot
intents = discord.Intents.default()
intents.messages = True  # Certifique-se de que o bot tem permissão para ler mensagens
client = commands.Bot(command_prefix="!", intents=intents)

# Evento que é chamado quando o bot está pronto
@client.event
async def on_ready():
    print(f'Bot está logado como {client.user}')

# Comando para enviar um embed
@client.command()
async def embed(ctx):
    embed = discord.Embed(
        title="Exemplo de Embed",
        description="Este é um exemplo simples de embed enviado pelo bot.",
        color=discord.Color.blue()  # Cor do embed
    )
    embed.set_footer(text="Rodapé do embed")  # Rodapé do embed
    embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)  # Autor do embed

    # Enviar o embed no canal onde o comando foi executado
    await ctx.send(embed=embed)

# Rodar o bot
client.run('')
#

there is no error

#

the bot runs

#

but when i type !embed

#

nothing happens

scarlet cave
#

have you enabled message content intent in the developer portal?

slow scarab
#

idk

#

lol

scarlet cave
#

go to your developer portal

slow scarab
#

there

scarlet cave
slow scarab
#

and now?

scarlet cave
#

and go to the Bots tab

#

under your application

slow scarab
#

okk

scarlet cave
#

scroll down till you see this

#

enable it

slow scarab
#

done

#

let me see

#

if it works

scarlet cave
#

have you enabled it in the correct bot of yours

slow scarab
#

yes

scarlet cave
#

which library are you using

#

and also dont use replit for discord bots

slow scarab
slow scarab
#

what should i use?

scarlet cave
scarlet cave
#

and get a good vps to host it

#

or self host it if you have any spare device

slow scarab
#

im rlyy dont understand anything about these things

#

do i have to pay for any of that stuff?

scarlet cave
slow scarab
scarlet cave
scarlet cave
scarlet cave
#

for python

slow scarab
slow scarab
#

i just use this rplit one cause its free yk

#

and very simple

#

llol

scarlet cave
#

use any one

scarlet cave
#

replit is alright for small projects and stuff

#

but its really underpowered and isnt reliable when it comes to discord bots

slow scarab
#

hmm got it

#

but i mean

#

i dont rly think i want to learn yk

#

just trying to make my server a bot

#

thats it

#

but if its free, i may check it out later

#

but anyways, what should i do now again?

#

sometime ago, i had one of these embed bots, and i think i was usinh the same code

#

i just dont understand whats going on rn

scarlet cave
#

seems like you mightve installed multiple discord libraries

#

but idk

slow scarab
#

how do i check that?

scarlet cave
#

open your terminal

#

and do pip list

#

there

#

terminal/powershell

slow scarab
#

i rly dont know what is terminal lmao

scarlet cave
#

crazy

#

how did u install the library then

slow scarab
#

i didnt

#

lol

#

i just logged in replit

#

got the code and thats it

#

i just selected python

#

thats all

#

so? lol

serene salmon
#

brudda

#

u still need help?

#

@slow scarab

past herald
#
intents = discord.Intents.default()
#

What if you do

intents=discord.Intents.all()

instead?

weak igloo
#

You really should only enable intents that you need. If you enable the message_content intent this issue should be fixed.

void solar
# scarlet cave how did u install the library then

i used replit once so i can answer that for you just in case youre wondering, replit uses ephemeral storage so whatever not in your working directory will be wiped on each run, and for installing packages replit auto does that for you either it looking at module not found errors or requirements.txt

#

it really is stupid if you name your file like whatever the package on pypi named and if you import the file it install the package from pypi instead

void solar
# slow scarab

and for OP, replit is simply not good, you should avoid it, install microsoft visual studio code or jetbrains pycharm to have the full IDE experience to code in

for the discord bot question, you need to enable message_content intent on both the code and developer portal for the bot to be able to see the message content for prefix commands, or switch to slash commands

scarlet cave
#

well they have done that but either theyve enabled it in the wrong bot in the dev page or there some lib namespace conflict leading to it

wheat sluiceBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.