#discord-bots

1 messages · Page 621 of 1

slate swan
#

Maybe you have allot on msg events

#

only 1 on_message event works

#

Remove the new line you did after change_presence, put everything on one single line

modern fiber
#

await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.users)} users!"))

#

Only says "1" FOR SOME REASON

orchid inlet
slate swan
#

\😧

slate swan
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
lapis wyvern
slate swan
#

send full code

orchid inlet
#

kk

slate swan
#

Still not all on one line

lapis wyvern
#

all

orchid inlet
#

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('Hello'):
        await message.channel.send('Hello')

client.run("token")

# .env
discord_token=("token")
discord_guild=("GFE")```
slate swan
#

No it's not

lapis wyvern
#

needs to be on one line

orchid inlet
#

@slate swan

slate swan
#

@slate swan btw great to see you as alwayspithink

velvet tinsel
#

how do you message a user using a mention

slate swan
#

Shows it's not on one line

orchid inlet
slate swan
slate swan
modern fiber
# slate swan !intents

Awesome but how can I make it to add like ",". For example not 513124, but instead 512,124

slate swan
orchid inlet
slate swan
cinder horizon
#

how do i make my bot to list all the emojis into a server....like one embed for one server(considering iz in 20+ servers) and it paginates....

orchid inlet
#

but no not in debug console either

slate swan
slate swan
orchid inlet
velvet tinsel
lapis wyvern
#

what

modern fiber
lapis wyvern
#

I dont get what you mean

slate swan
orchid inlet
modern fiber
#

I don't really understand where do I add that and how.

velvet tinsel
slate swan
slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

513,124
slate swan
#

@slate swan

slate swan
slate swan
lapis wyvern
#

..

orchid inlet
modern fiber
slate swan
velvet tinsel
cinder horizon
slate swan
lapis wyvern
#

0_0

slate swan
tawdry perch
#

spamming webhooks == API abuse or smth else?

slate swan
#

Theirs so many beginners here and only me and @slate swan @cinder marsh know the basics atleast @tawdry perch

orchid inlet
slate swan
lapis wyvern
#

ok nvm forget it im go back to

#

playing a game

tawdry perch
#

I was pong pithink that was suprising

velvet tinsel
#
                        def check2(msg):
                            return msg.author == ctx.author and msg.channel == ctx.channel

                        msg = await client.wait_for("message", check=check2, timeout=30)
                        member = # whateverI put here to get the user
                        await member.send("test")
#

f so many tabs

slate swan
#

I suggest all of you read docs and learn basic python or learn object tilted classes and asynchronous programming

#

🤷‍♂️

slate swan
orchid inlet
#

@slate swan When I press save and run in vscode, nothing pops up in the terminal? Is that normal?

tawdry perch
slate swan
tawdry perch
lapis wyvern
orchid inlet
tawdry perch
#

open the terminal of vsc

orchid inlet
#

okay

#

and then what

velvet tinsel
slate swan
orchid inlet
#

in terminal or cmd? @slate swan

tawdry perch
slate swan
#

you have made on ready command

lapis wyvern
#

I still dont get what you mean

#

you said on on 1 line

velvet tinsel
#

This is braincell disintegrating

lapis wyvern
#

it is on 1 line

slate swan
#

pithink NEED HELP

velvet tinsel
tawdry perch
#

and after all ```py
python file_name_here.py

slate swan
# lapis wyvern I still dont get what you mean

Instead of

await bot.change_presence
(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))

do

await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))

Is it that hard??

velvet tinsel
#

🤣 👌

lapis wyvern
tawdry perch
covert palm
#
role = get(bot.get_guild(payload.member.guild.id).roles, id ="808013565298606080")
        await payload.member.add_roles(role)```
#

any idea why that isnt working?

lapis wyvern
#

ok another question

slate swan
#

IDs are integers not strings

orchid inlet
slate swan
#

Guys this person needs help gem_red

modern fiber
covert palm
lapis wyvern
#

how would you list how many members is on the watching status

tawdry perch
slate swan
orchid inlet
slate swan
lapis wyvern
#

like it tells you how many members it is watching

inland epoch
tawdry perch
orchid inlet
#

I found it

thick sigil
velvet tinsel
slate swan
inland epoch
spiral forge
#
import discord
import os
from dotenv import load_dotenv

#bot = commands.Bot(command_prefix = "?")
client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as (0,user).format(client)')

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.content.startswith('tps.eb Hello'):
        await message.channel.send(
            'Hello, my friend where you gone? I was waiting for you')

TOKEN = /TOKEN.env

client.run(os.getenv('TOKEN'))







thick sigil
slate swan
thick sigil
#

you know that an avatar has a link?

lapis wyvern
slate swan
slate swan
#

To make it look better

thick sigil
#

Lolz

spiral forge
lapis wyvern
#

how many servers its on

#

what now thats cap

slate swan
inland epoch
slate swan
unkempt canyonBOT
orchid inlet
modern fiber
#

Hey guys, how can I make it so when someone adds the bot to their server, that the bot instantly sends a message, like "Thanks for adding me on the server, bla bla bla"?

velvet tinsel
lapis wyvern
#

yeah I thought

slate swan
#

Get the length of that

orchid inlet
#

It that right?

lapis wyvern
thick sigil
#

You know that sending the avatar link just displays the image right?

tawdry perch
spiral forge
orchid inlet
#

omg yes it works

tawdry perch
#

cool!

orchid inlet
#

thanks!

modern fiber
#

Hey guys, how can I make it so when someone adds the bot to their server, that the bot instantly sends a message, like "Thanks for adding me on the server, bla bla bla"?

spiral forge
#

well help me too

tawdry perch
#

Now that I have been here for 3 minutes I can leave again

slate swan
#

@lapis wyvern basically you enable intents in the dev portal and in your code by importing intents if you want not needed by the way and you just make a var for it and add it to your instance so the bot sees other members instead of himself so anything related to other members will need members intents

spiral forge
#

plz plz

modern fiber
slate swan
velvet tinsel
velvet tinsel
#

also please no unicode characters

modern fiber
#

Guys? gem_red

Hey guys, how can I make it so when someone adds the bot to their server, that the bot instantly sends a message, like "Thanks for adding me on the server, bla bla bla"?

tawdry perch
# spiral forge plz plz

no neeed to beg, be patient there are few people here currently helping (not me because I should be reading to exam) and a lot of people asking questions

velvet tinsel
#

😢

lapis wyvern
velvet tinsel
#

There are 500 people who need help here

slate swan
#

Guys please dont beg where trying are best its like 4 of us with like 7 of you pleade be patient were humans as well

orchid inlet
slate swan
# modern fiber Hey guys, how can I make it so when someone adds the bot to their server, that t...

Yes, there is an event discord.on_guild_join. Then send a message to a random channel or try to send a message to each channel with a try/except (it will return an exception if your bot didn't had the permissions to send a message in that channel), and when you managed to send a message in one of the channels, use return to stop the event
https://discordpy.readthedocs.io/en/stable/api.html#discord.on_guild_join

tawdry perch
lapis wyvern
#

.

modern fiber
slate swan
#

tf it automatically fixed when I used except Exception as e:@thick sigil

lapis wyvern
thick sigil
tawdry perch
#

how am I supposed to be able to leave from here ;-;

slate swan
lapis wyvern
#

how do make the bot list how many servers its on on its status

thick sigil
#

use read method

slate swan
slate swan
spiral forge
slate swan
#

Basic python

slate swan
velvet tinsel
# spiral forge what happen?
  1. I made a mistake
  2. I got it wrong
  3. I am an idiot
  4. Something else happened
  5. It's not he right answer
  6. I spoonfed you

one of these things

slate swan
#

Literally says that

modern fiber
slate swan
#
await ctx.channel.send(file=await discord.File(ctx.author.avatar_url_as(format="png").read()))```??
thick sigil
#

await it

slate swan
lapis wyvern
#

liike this

velvet tinsel
slate swan
spiral forge
lapis wyvern
#

@tasks.loop(seconds=10) async def change_status(): await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie")) len.(bot.guilds),

modern fiber
#

guild.text_channels
return("Thanks for adding me!")

slate swan
#

No

modern fiber
#

Like this? Im new to Python-

#

Sorry, lmao

slate swan
thick sigil
#

@cinder marsh no you read the asset, not file

sullen shoal
#

why are you saving the user avatars?

  • if you just want to display them,
    use embed image to display them, you just need put the url to display them
  • Member.avatar_url will not be None, you dont need to use Member.avatar.
#

avatar_url will return discord.Asset

slate swan
sullen shoal
slate swan
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
lapis wyvern
#

this is my code

spiral forge
slate swan
modern fiber
lapis wyvern
#

wow ok let me go ask a dev

modern fiber
slate swan
#

just like I want to do it that way

thick sigil
#

as I said, read the asset

slate swan
spiral forge
thick sigil
#

and pass it to File

slate swan
spiral forge
modern fiber
#

for channel in guild.text_channels:
try:
# send your stuff
return
except:
# continue stuff

slate swan
modern fiber
#

Thanks.

lapis wyvern
#

how do you do it

sullen shoal
lapis wyvern
#

just tell me so I can go sleep for a big day

slate swan
#

You did it right here:

modern fiber
#

Im just stupid at this..

sullen shoal
# slate swan \👍

when your bot joins a server, you can check if the bot has embed perms or not

spiral forge
velvet tinsel
slate swan
velvet tinsel
#

ayyyy @sullen shoal hello

modern fiber
sullen shoal
velvet tinsel
modern fiber
spiral forge
modern fiber
#

cries in python

slate swan
slate swan
unkempt canyonBOT
#

Hey @lapis wyvern!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

lapis wyvern
#

:/

spiral forge
lapis wyvern
#

and your saying

slate swan
lapis wyvern
#

can you just tell me how you do it like

modern fiber
#

@slate swan Help? Im trying for a bot to send something like "Thanks for adding me" on joining the guild...

slate swan
#

thats a decent free host

lapis wyvern
#

bruh I dont have all day'

slate swan
modern fiber
modern fiber
#

As I don't understand it..

velvet tinsel
slate swan
slate swan
#

🙄

slate swan
slate swan
lapis wyvern
#

where do you put len.(bot.guilds),

modern fiber
slate swan
#

youre here to get spoon fed basic knowledge

velvet tinsel
slate swan
#

yeah, and we gave you the exact steps to get started

tawdry perch
#

it seems like here is some sort of hierarchy of giving others change to help others by pinging them, how nice

slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

velvet tinsel
#

Am I the only person who asks for help that actually looks stuff up before asking?

slate swan
#

I thought @slate swan was intimidating as he has allot of knowledge but you guys are something elselemonpeek

#

I spoonfeed

velvet tinsel
lapis wyvern
slate swan
velvet tinsel
slate swan
lapis wyvern
#

can someone please help me

tawdry perch
slate swan
#

Spoonfeeding = literally given the code perfectly working

velvet tinsel
#

Python is OOP so give logic

slate swan
spiral forge
slate swan
lapis wyvern
#

like

slate swan
#

I think ima just like runs

modern fiber
#

This how it works?

# On Join Message
for channel in guild.text_channels:
    await ctx.send("Hello!")
    return```
slate swan
slate swan
#

And no need for return

waxen granite
#
.say :gg:

Command raised an exception: ValueError: invalid literal for int() with base 10: ':gg:844879478106357811'```
How do i fix this?
slate swan
#

If theirs nothing to return

modern fiber
#

And be sure it has perms- for the bot to send the message

slate swan
slate swan
waxen granite
slate swan
modern fiber
slate swan
waxen granite
#

Hm

sullen shoal
#

the chat is pretty active today

slate swan
slate swan
modern fiber
#

Well I don't need it for a command as I need it to auto send when the bot is invited to a server

modern fiber
#

so what will I use instead of

On Join Message

for channel in guild.text_channels:
await ctx.send("Hello!")

sullen shoal
#

idk whom to help ones stuck with env and ones coding as if python is some ai to detect what they want to do

modern fiber
slate swan
slate swan
#

I just wish ppl would ask questions properly and show the shit we need to fix it

slate swan
#

You got this 150

slate swan
modern fiber
slate swan
modern fiber
slate swan
slate swan
#

Im dying

#

😭

modern fiber
#

Please :criy:

slate swan
#

Lavox , what problem do you have?

slate swan
slate swan
slate swan
#

shipit wait why is okimii's brain set to None

modern fiber
#

?

slate swan
modern fiber
#

BRUH

slate swan
#

@slate swan my bad for not saying it but plesure to see you again yert

modern fiber
slate swan
#

How do i make mee6?

modern fiber
slate swan
sullen shoal
modern fiber
slate swan
#

@slate swan basically he or she wants to make a command to when the bot joins a guild it sends a welcoming command

slate swan
slate swan
#

*member

#

Doesnt have one

modern fiber
#

where do I put that mf lol

slate swan
slate swan
slate swan
#

Can we put custom buttons and links on bot presence??

slate swan
slate swan
slate swan
slate swan
slate swan
modern fiber
slate swan
slate swan
# modern fiber I don't have one

you gotta use on_guild_join event ,
which would basically go like ```py
@bot.event
async def on_guild_joim(guild : discord.Guild):

do your stuff here```

The guild argument is a discord.Guild object

slate swan
slate swan
#

Pretty sure no bots can use buttons in their presence like users can

slate swan
#

🤬

slate swan
modern fiber
#

I dont wanna emberass myself here lmao

slate swan
slate swan
#

How??

#

Using an RPC client

#

RPC?

#

Rich Presence

slate swan
sullen shoal
#

rich presence

slate swan
#

Oh so not possible for bot??

#

Example here:

slate swan
sullen shoal
#

i dont think it is, discord is quite limited with presences for bots

slate swan
slate swan
# slate swan Nope

I saw a guy and in his presence he has a button, join discord server and when I clicked it I joined the server

slate swan
slate swan
boreal ravine
#

hm

slate swan
#

I wish something like this would be in dpy

#

That's on users, not bots

#

😢

slate swan
slate swan
slate swan
#

It's Discord themselves limiting the bot statuses

slate swan
slate swan
boreal ravine
slate swan
#

😔

slate swan
sullen shoal
#

used to do that stuff when i was a skid

slate swan
#

ok ive been trying a LONG time to get this to work so i wanna have a command only let you use it if your id is listed inside but i wanna have multible ids not just one how the hell do i configure this?

slate swan
#

Lists/tuples.

sullen shoal
#

or sets

slate swan
#

are you aloud to send ss in here?

#

*screenshots

boreal ravine
slate swan
slate swan
#

Or read the discord documentation about RPC

#

Oh its rich presence

#

I thought it was like interaction button

#

Good luck on understanding how it works though

#

I dont like that discord only lets u use playing

slate swan
#

how do i make it to where it will only let you do a command if its listed in here?

lapis wyvern
slate swan
#

Pass it in your commands.Bot

slate swan
#

owner_ids = the list

#

I wanted to make a listening thing like spotify for other apps but it requires selfbot

slate swan
slate swan
lapis wyvern
#

not in console

#

I mean in status

slate swan
#

len(bot.guilds)

#

^

lapis wyvern
#

but where in the string do you put it

slate swan
#

@lapis wyvern @slate swan has said it like 5 times to you bro?

slate swan
sullen shoal
unkempt canyonBOT
#

property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
The activity being used upon logging in.
slate swan
#

I think you know where it is, since you coded it

slate swan
slate swan
slate swan
#

Like i gave u exactly what to put scroll up

slate swan
#

i wanna replace the role with check id

#

Almost everyone did

slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
lapis wyvern
#

can you just the exact code

slate swan
lapis wyvern
#

then I can compare to see how would I do it

slate swan
#

!customchecks

unkempt canyonBOT
#

Custom Command Checks in discord.py

Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides discord.ext.commands.check which allows you to create you own checks like this:

from discord.ext.commands import check, Context

def in_any_channel(*channels):
  async def predicate(ctx: Context):
    return ctx.channel.id in channels
  return check(predicate)

This check is to check whether the invoked command is in a given set of channels. The inner function, named predicate here, is used to perform the actual check on the command, and check logic should go in this function. It must be an async function, and always provides a single commands.Context argument which you can use to create check logic. This check function should return a boolean value indicating whether the check passed (return True) or failed (return False).

The check can now be used like any other commands check as a decorator of a command, such as this:

@bot.command(name="ping")
@in_any_channel(728343273562701984)
async def ping(ctx: Context):
  ...

This would lock the ping command to only be used in the channel 728343273562701984. If this check function fails it will raise a CheckFailure exception, which can be handled in your error handler.

slate swan
slate swan
#

I told u where to put it and how to do it

slate swan
slate swan
lapis wyvern
slate swan
#

No look u got pinged in my first reply

#

leaves

sullen shoal
#

joins

slate swan
#

Lurks

quick gust
#

dies

slate swan
#

codes

sullen shoal
#

leaves

slate swan
#

Bruh if u cant understand that give up

lapis wyvern
#

which

#

one i put up there

slate swan
#

Actually learn python and oop instead of give up

#

The boys lmao

#

Infurnums line was gold😭

lapis wyvern
#

ok this sucks

modern fiber
#

Guys, why am I having this?

slate swan
#

pip install disnake

slate swan
slate swan
#

import it too

modern fiber
slate swan
slate swan
#

And you dont even import perms?

slate swan
modern fiber
slate swan
modern fiber
#

and why-

slate swan
#

because you use it

modern fiber
slate swan
slate swan
#

Dont think so

modern fiber
#

OLOLOLOLOLOL XDDDDDDDDDD kids be like

slate swan
modern fiber
#

No but fr, I already did a pip install command.

sullen shoal
lapis wyvern
modern fiber
#

That was a fucking joke can you help me

slate swan
#

async def add_buyer(ctx, buyer : int = None): if ctx.author.id not in admins: embed = discord.Embed(title="Admin-only Command", description="You're not an Admin! L", color=0xa30000) await ctx.send(embed=embed)
this is what i use to add a buyer right so how would i do a check to id with this added into the mix?

slate swan
lapis wyvern
#

dang it me wish

slate swan
#

I mentally left this chat 8 times

modern fiber
lapis wyvern
sullen shoal
#

just putting pip install wont work

slate swan
modern fiber
sullen shoal
#

then say it properly

slate swan
lapis wyvern
#

what

slate swan
sullen shoal
#

also most IDEs dont update imports, so your code should run fine if you run it

slate swan
#

you need to import disnake in the file , lavox

slate swan
slate swan
lapis wyvern
#

look at my pfp

slate swan
#

ok so
buyers = [1, 2, 3] admins = [1, 2, 3] ownerList = [897594776822624367, 2, 3]
this is where the ids go
im using this to add a id to that category
async def add_buyer(ctx, buyer : int = None): if ctx.author.id not in admins: embed = discord.Embed(title="Admin-only Command", description="You're not an Admin! L", color=0xa30000) await ctx.send(embed=embed)
now how do i replace the check to role to check with category?
@commands.guild_only() @commands.has_role('REALS')

#

Venvs in pycharm

lapis wyvern
#

wait is genral even active

slate swan
slate swan
modern fiber
slate swan
slate swan
#

is someone finna answer?

slate swan
#

And share a screenshot of the "Python interpreter" part

#

It's in the middle of the popup

slate swan
#

The #s before channel names appear almost invisible on phone, is that just for me?

brave flint
#

can i send message without ctx.send?

slate swan
slate swan
slate swan
slate swan
brave flint
slate swan
#

like TextChannel or DMChannel

brave flint
#

uh

slate swan
#

ok so
buyers = [1, 2, 3] admins = [1, 2, 3] ownerList = [897594776822624367, 2, 3]
this is where the ids go
im using this to add a id to that category
async def add_buyer(ctx, buyer : int = None): if ctx.author.id not in admins: embed = discord.Embed(title="Admin-only Command", description="You're not an Admin! L", color=0xa30000) await ctx.send(embed=embed)
now how do i replace the check to role to check with category?
@commands.guild_only() @commands.has_role('REALS')

#

HELLO?

#

pls answer

slate swan
#

Its a int

slate swan
#

As in sidebar

modern fiber
slate swan
slate swan
slate swan
#

Wait nvm

modern fiber
#

Okay I did, what now?

slate swan
slate swan
# brave flint nope like ummm

I mean , ctx is not required to send a message always
Just a messageable object like TextChannel or DMChannel would work

sullen shoal
#

winrar tech tips

slate swan
#

so by default its jus 12345 type thing

modern fiber
# slate swan Go there https://i.krypt0n.co.uk/76984347.png

I installed it but I get this

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 12, in <module>
client = commands.Bot(command_prefix = 'a!', intents=intents)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\bot_base.py", line 143, in init
super().init(**options)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 162, in init
super().init(**options)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 102, in init
super().init(*args, **kwargs)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1192, in init
super().init(*args, **kwargs)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\client.py", line 283, in init
self._connection: ConnectionState = self._get_state(**options)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\client.py", line 303, in _get_state
return ConnectionState(
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\state.py", line 221, in init
raise TypeError(f"intents parameter must be Intent not {type(intents)!r}")
TypeError: intents parameter must be Intent not <class 'discord.flags.Intents'>

Process finished with exit code 1

slate swan
#

@slate swan your discord tripping

brave flint
slate swan
#

What's the code

sullen shoal
#

mines looking fine as well

brave flint
slate swan
#

Nothing to do with PyCharm at this point

slate swan
modern fiber
slate swan
#

ok am dumb , those channels were just muted
It appears different on Desktop so got confused

modern fiber
#

send me a friend request please

slate swan
#

Send it here, the part where you define the intents

sullen shoal
modern fiber
slate swan
modern fiber
slate swan
#

To what have you defined it

brave flint
#

XD

slate swan
#

shipit imagine not using armoled theme

#

AMOLED*

modern fiber
#

...

slate swan
#

um yea

sullen shoal
#

armoled

slate swan
#

Replace every discord. with disnake.

#

It sounded more like armored

#

HELP Replit caches my requests.get and repeats my old code even after I changed it in the target page

modern fiber
sullen shoal
full valley
#

Can I not use string concatenation in embeds?

value1 = ""
for playerid1 in team1:
  value1 += f"<@!{playerid1}> "
value2 = ""
for playerid2 in team1:
  value1 += f"<@!{playerid2}> "
embed = discord.Embed(title=f"Lobby#{game_id - 1}", description="Random teams have been chosen!",
                                      color=0xE74C3C)
embed.add_field(name="Team 1", value=value1, inline=True)
embed.add_field(name="Team 2", value=value2, inline=True)
raise HTTPException(r, data)

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.fields.1.value: This field is required

slate swan
#

Yall like my discord? yert 😉 😏

sullen shoal
#

requests is sync

slate swan
#

😭

slate swan
brave flint
slate swan
slate swan
#

takes my sleep away

slate swan
slate swan
#

@sullen shoal yours bad kid🤮

#

discord in mobile device's browser is pog

modern fiber
# slate swan Remove all the references to `discord.` and replace with `disnake.`

Now I got this

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 81, in <module>
async def help(ctx):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1383, in decorator
self.add_command(result)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1234, in add_command
raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

slate swan
#

The error literally says it all

sullen shoal
modern fiber
#

o

sullen shoal
#

while lights off

slate swan
#

Actually you need to remove the default help first @modern fiber

modern fiber
#

the one I had previously is like that auto one..

brave flint
slate swan
slate swan
slate swan
brave flint
slate swan
#

Not me

#

They are using disnake

modern fiber
brave flint
#

oh i think they use dpy

slate swan
modern fiber
#

and they wont accept it anymore as I heard

slate swan
#

||@slate swan|| Sarthak bhai

replit caches my requests.get module and shows me the previously fetched result, how can I fix this??

brave flint
slate swan
brave flint
slate swan
#

It's not shutting down

slate swan
#

It's just not under development anymore

brave flint
#

discord.py is like will die soon because slash command

slate swan
modern fiber
#

SOMEBODY HELp

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 82, in <module>
async def help(ctx):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1383, in decorator
self.add_command(result)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1234, in add_command
raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

slate swan
#

So it won't get updates

slate swan
modern fiber
slate swan
#

Just one

modern fiber
#

the other one default ig

slate swan
#

You have the default one

brave flint
modern fiber
#

I used
remove_command="help"
tho

slate swan
modern fiber
slate swan
brave flint
full valley
#

Can I not use string concatenation in embeds?

value1 = ""
for playerid1 in team1:
  value1 += f"<@!{playerid1}> "
value2 = ""
for playerid2 in team1:
  value1 += f"<@!{playerid2}> "
embed = discord.Embed(title=f"Lobby#{game_id - 1}", description="Random teams have been chosen!",
                                      color=0xE74C3C)
embed.add_field(name="Team 1", value=value1, inline=True)
embed.add_field(name="Team 2", value=value2, inline=True)
raise HTTPException(r, data)

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.fields.1.value: This field is required

#

How can I fix this

modern fiber
# slate swan ```py bot.remove_command('help') ```

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 5, in <module>
client.remove_command('help')
NameError: name 'client' is not defined

also bot nothing

modern fiber
slate swan
#

Don't do that

modern fiber
#

where should I then

full valley
slate swan
#

Put it after your bot declaration

modern fiber
slate swan
#

Im going to leave have a good day guys pithink

sullen shoal
slate swan
full valley
#

ohhhh Facepalm

#

ty

slate swan
sullen shoal
#

too many dots for my eyes to handle

slate swan
sullen shoal
#

nice

#

!e print(dir(...))

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
sullen shoal
#

nice

slate swan
#

how i fix

#

its a )

slate swan
modern fiber
# slate swan You can put before that yes, probably will work

Still gives me

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 80, in <module>
async def help(ctx):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1383, in decorator
self.add_command(result)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1234, in add_command
raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

slate swan
#

Have you added it?

modern fiber
#

Yeah.

slate swan
#

Do you have an on_ready event?

modern fiber
#

this is only I have

slate swan
#

Put it in there then

modern fiber
#

@on_ready
bla bla bla

slate swan
#

Inside it

modern fiber
#

how exactly, lol

cinder horizon
#

if a message my bot's sending got more than 2000 characters....how do i make like a check to see if iz more than 2000 messages and make it send as a diff message?

sullen shoal
unkempt canyonBOT
#
len

len(s)```
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).

**CPython implementation detail:** `len` raises [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") on lengths larger than [`sys.maxsize`](https://docs.python.org/3/library/sys.html#sys.maxsize "sys.maxsize"), such as [`range(2 ** 100)`](https://docs.python.org/3/library/stdtypes.html#range "range").
modern fiber
slate swan
cinder horizon
modern fiber
sullen shoal
#

🤨

slate swan
#

It says everything

modern fiber
#

uhh

cinder horizon
modern fiber
#

space?

slate swan
#

You did:

@client.event
async def on_ready():
code_here
#

Which is wrong indentation

#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

modern fiber
#

still bruh...

Traceback (most recent call last):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 80, in <module>
async def help(ctx):
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1383, in decorator
self.add_command(result)
File "C:\Users\korisnik\PycharmProjects\DiscordBot\venv\lib\site-packages\disnake\ext\commands\core.py", line 1234, in add_command
raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

slate swan
#

hmm

modern fiber
slate swan
#

I don't remember where you need to put that code to remove it

modern fiber
#

Uhh.

slate swan
modern fiber
#

Anybody knows? jeez

lapis wyvern
#

how do you hide a token

slate swan
# modern fiber

You're supposed to put it right before where you define client

slate swan
slate swan
lapis wyvern
#

like do you do

#

client.run(os.getenv.TOKEN)

modern fiber
#

YESSSSSSSSSSSSSSSSSSSSSSSS

#

FInnaly I fixed it

#

after intents I put it @slate swan

lapis wyvern
#

Please respond

slate swan
#

Try it and see

lapis wyvern
#

do you do client.run(os.getenv.TOKEN)

slate swan
#

Here

#

Take a look at this

lapis wyvern
#

Doesnt work

slate swan
#

It does

lapis wyvern
#

Traceback (most recent call last):
File "main.py", line 412, in <module>
client.run(os.getenv.TOKEN)
AttributeError: 'function' object has no attribute 'TOKEN'

slate swan
#

If your use it correctly

lapis wyvern
#

I idd

slate swan
#

No you did not

lapis wyvern
#

I did

slate swan
#

Like really...

lapis wyvern
#

??????''

slate swan
#

There is a clear screenshot on how to use it

lapis wyvern
#

sigh

slate swan
#

Why do you keep asking questions but don't even do what we tell you to do?

#

It's just time waste for us in the end...

lapis wyvern
#

show me a token example

slate swan
#

Literally

slate swan
sullen shoal
#

just spoonfeed him from importing discord to running it and end it im annoyed

slate swan
#

It's about hiding a token

#

But doesn't want to read

#

Just wants us to do everything

lapis wyvern
#

client.run(os.getenviron.TOKEN)
AttributeError: module 'os' has no attribute 'getenviron'
 * Running on all addresses.

slate swan
#

Can you read?

#

Like really..........

lapis wyvern
#

its a token for god sake

slate swan
#

Where do you see getenviron IN THAT CODE

#

I give up

maiden fable
unkempt canyonBOT
#

os.environ```
A [mapping](https://docs.python.org/3/glossary.html#term-mapping) object where keys and values are strings that represent the process environment. For example, `environ['HOME']` is the pathname of your home directory (on some platforms), and is equivalent to `getenv("HOME")` in C.

This mapping is captured the first time the [`os`](https://docs.python.org/3/library/os.html#module-os "os: Miscellaneous operating system interfaces.") module is imported, typically during Python startup as part of processing `site.py`. Changes to the environment made after this time are not reflected in `os.environ`, except for changes made by modifying `os.environ` directly.

This mapping may be used to modify the environment as well as query the environment. [`putenv()`](https://docs.python.org/3/library/os.html#os.putenv "os.putenv") will be called automatically when the mapping is modified.
slate swan
#

If you can't even copy paste what's in a screenshot, I won't help you further more

slate swan
maiden fable
#

Try not to scream on people before knowing what does the funtcion do lol

maiden fable
slate swan
#

No

lapis wyvern
#

then why isnt the token working

slate swan
#

It's the same in C

lapis wyvern
#

I did it right like bruh

maiden fable
#

The difference is, environ is a dict whereas getenv is a function to get the env var. Read the embed 🤦

slate swan
#

getenv is in C but whatever

modern fiber
#

A small problem.

#On Join Message
@client.event
async def on_guild_join(guild: disnake.Guild):
for channel in guild.text_channels:
await channel.send("Hello, thank you for adding me!")

It sends in all channels, lol. How can I make it so it only sends in hm, like system channel or smth?

maiden fable
#

A mapping object where keys and values are strings that represent the process environment. For example, environ['HOME'] is the pathname of your home directory (on some platforms), and is equivalent to getenv("HOME") in C.

slate swan
#

Hope y'all enjoy this guy

slate swan
sage otter
#

I swear there’s never a day where Hunter and Krypton aren’t beefing.

lapis wyvern
#

can yall just show me a example of a TOKEN LIKE BRUH'

maiden fable
#

Yea, so?

slate swan
#

Whatever

lapis wyvern
#

...

maiden fable
slate swan
#

Not my problem at this point

maiden fable
#

Should work after these

slate swan
# lapis wyvern Please respond

i'm not obligated to respond, plus i was busy, but regardless after what i've just seen it's obvious that you're not a person who's gonna get my help anytime soon

sage otter
#

I mean I’m not specifically targeting you Krypton. Id like to think I’m pretty chill with you. 🤷‍♂️

maiden fable
#

BTW Krypton, u still haven't told me how to get music audio from a legal place 🤣

slate swan
steep estuary
#

how i can make calculator in my bot with all +, -, x, / in one statement

maiden fable
#

Where

slate swan
#

But yeah, it's hard to read messages

#

Can understand

maiden fable
#

At least stop lying

slate swan
full lily
full lily
steep estuary
sage otter
slate swan
maiden fable
lapis wyvern
#

HELP

maiden fable
#

And someone sending code

maiden fable
#

Hmm, good calculation

slate swan
full lily
lapis wyvern
#

ITS NOT WORKING

maiden fable
slate swan
boreal ravine
slate swan
#

do NOT use eval

maiden fable
boreal ravine
#

just call him winrar

#

😎

slate swan
slate swan
boreal ravine
sage otter
slate swan
#

You can already remove that code

slate swan
slate swan
maiden fable
#

Yea

modern fiber
#

This code makes the bot basically send the "welcoming" message in every single channel in the Server. How can I make it send only in one, like system channel or the channel that other bot's send those too?

Code;

#On Join Message
@client.event
async def on_guild_join(guild: disnake.Guild):
    for channel in guild.text_channels:
        await channel.send("Hello, thank you for adding me!")```
sage otter
#

Isn’t that bitwise

slate swan
sage otter
#

Xor?

full lily
slate swan
boreal ravine
unkempt canyonBOT
#

property system_channel: Optional[discord.channel.TextChannel]```
Returns the guild’s channel used for system messages.

If no channel is set, then this returns `None`.
slate swan
maiden fable
#

U gotta try except BTW

modern fiber
#

XD

slate swan
#

that's why you use a database and have users configure it :bigbrain:

modern fiber
#

..

modern fiber
#

you are just fucked up lol

slate swan
sage otter
maiden fable
#

Can we calm down here? kayle just told the answer to your problem @modern fiber

boreal ravine
#

its on_guild_join kraots

slate swan
slate swan
slate swan
patent lark
boreal ravine
slate swan
#

🏃‍♂️

slate swan
unkempt canyonBOT
#

@slate swan :warning: Your eval job has completed with return code 0.

[No output]
boreal ravine
lapis wyvern
boreal ravine
#

☹️

modern fiber
slate swan
slate swan
lapis wyvern
#

Not working..

slate swan
#

Or the event

maiden fable
slate swan
maiden fable
boreal ravine
modern fiber
#

wdym iterate? Im not english, lmfao

lapis wyvern
#

DOES THIS LOOK LIKE I DID ANYTHING WRONG

boreal ravine
#

just check if it exists, and send it, if not send something

maiden fable
lapis wyvern
patent lark
modern fiber
#

Oh, so what should I put for it do don't
else
break

#

?

maiden fable
boreal ravine
slate swan
# lapis wyvern

yes you did something wrong, very wrong, people already told you like 10 times before how you're supposed to do it and you still somehow managed to do it wrong

slate swan
# slate swan Make the request everytime the command runs

I mean when the program starts, it make a request to my github repo and executes the code it get, but sometime it just show me the output of my previous code even though I changed the code. Any trick?? like adding a random string to url after ? or somethig else??

modern fiber
slate swan
#

os.getenv.TOKEN , smells js

slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

49
slate swan
#

You should give valid input

#

!e print("•")

slate swan
# slate swan !e print(60^13)

Yea , it's not the ^ expression use it general tho , ^ is used for power to a base in mathematical operations and ** in py

#

It's the XOR operation for bitwise operations

lapis wyvern
slate swan
#

It's a valid operator

slate swan
slate swan
# lapis wyvern

os.getenv['TOKEN'] literally, you've been told like 20 times already

lapis wyvern
#

Show the full thing

slate swan
#

what full thing

patent lark
#

os.getenv("TOKEN")

slate swan
patent lark
lapis wyvern
#

client.run + plus the thing you said

slate swan
maiden fable
slate swan
maiden fable
#

Ok ok calm down

lapis wyvern
#

a dot after run?

maiden fable
#

Remove that dot before the brackets

sage otter
#

😂 yo this man Kraots.

maiden fable
slate swan
#

Also IDK why this is also not working ```py
@tasks.loop(minutes=5)
async def change_activity():

activity_list=['s', 'p', 'w', 'l']
activity_s=['Earth', 'Mars', 'Jupiter', 'Mercury', 'Venus', 'Saturn', 'Neptune', 'Uranus']
activity_p=['Minecraft', 'with Blank', 'Squid Games', 'Do or Die', 'Curse of Aros', 'with Satan', 'with anime girls']
activity_w=['over you!', 'Animes', 'Plants', 'Animals', 'Blank', 'Nothing!']
activity_l=['Youtube Music', 'Blank', 'Dead Groovy', 'Dead Rythm', 'Death']
activity=random.choice(activity_list)


if activity=="s":
    activity=discord.Streaming(name=random.choice(activity_s))
elif activity=="p":
    activity=discord.Game(name=random.choice(activity_s))
elif activity=="w":
    activity=discord.Activity(type=discord.ActivityType.watching(name=random.choice(activity_w)))
else:
    activity=discord.Activity(type=discord.ActivityType.listening(name=random.choice(activity_l)))
await client.change_presence(activity=activity)```
maiden fable
#

What's the error?

modern fiber
#

Guys how do I change it so it sends in system channel or else just break?

#On Join Message
@client.event
async def on_guild_join(guild: disnake.Guild):
    for channel in guild.text_channels:
        await channel.send("Hello, thank you for adding me!")```
maiden fable
#

Bruh

#

await guild.system_channel.send()

lapis wyvern
slate swan
maiden fable
#

!d discord.Guild.system_channel

unkempt canyonBOT
#

property system_channel: Optional[discord.channel.TextChannel]```
Returns the guild’s channel used for system messages.

If no channel is set, then this returns `None`.
maiden fable
lapis wyvern
#

like that

patent lark
maiden fable
#

Also getenv is a function, u gotta use environ

#

Okay calm down there. Ignore him

manic wing
#

i got muted for saying that

slate swan
lapis wyvern
#

File "main.py", line 415

^

SyntaxError: unexpected EOF while parsing

slate swan
patent lark
#

DO THIS

client.run(os.getenv("TOKEN"))

modern fiber
tall dust
#

!mute 374622847672254466 1d that is not at all an appropriate thing to say