#discord-bots
1 messages · Page 621 of 1
only 1 on_message event works
Remove the new line you did after change_presence, put everything on one single line
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
but there is only one?
\😧
^ i recommend using the bot instance
!intents
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.
hmmmm
send full code
kk
all
@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")```
No it's not
needs to be on one line
@slate swan
@slate swan btw great to see you as always
how do you message a user using a mention
Shows it's not on one line
Any error??
nope. The bot just dont want to respond
The .mention attr
Great to see you too but I kind of regret coming here 
Awesome but how can I make it to add like ",". For example not 513124, but instead 512,124
Not even in console?
terminal?
I shouldve stayed sleeping but i got school rip
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....
but no not in debug console either
yup

nope. nothing at all
f'{your_number_here:,}'
doesn't work
what
Hold up, what? Where do I add that
I dont get what you mean
I think len() would work
HAS A STROKE
yep. It is really weird. Are you sure I dont need to press something in vscode for it to update in the bot?
I don't really understand where do I add that and how.
death go brrrr
is the bot even online? You haven't imported token I guess \🤔
!e
my_number = 513124
print(f'{my_number:,}')
@slate swan :white_check_mark: Your eval job has completed with return code 0.
513,124
@slate swan
Yikes, good luck
{ctx.author.mention} mentions the author
..
yes it is online and everything
How and where do I add it in my code
😔
I do not think you understand my meaning. Let me show you my entire code.
not the number but the emojis itself...like as in nqn style
In my experience the code is correct.....idk whats the problem with it 
0_0
How?
By using your keyboard.
Where?
Replace it with the place where you added len(client.users), so write f'{len(client.users):,}' instead
spamming webhooks == API abuse or smth else?
Theirs so many beginners here and only me and @slate swan @cinder marsh know the basics atleast @tawdry perch
okay, but thanks for helping!

I was pong
that was suprising
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
They have a rate limit, just like everything else. Follow them
I suggest all of you read docs and learn basic python or learn object tilted classes and asynchronous programming
🤷♂️
As I said, msg.mentions[0] returns the mentioned user as Member object
I already did
@slate swan When I press save and run in vscode, nothing pops up in the terminal? Is that normal?
I was asking to be sure I told correct thing to someone here, but good to know I was corrrect. Thx!
Or.... 🥁 give up
No thats my job
run discord bot's via terminal if possible.
give up is great!
how
open the terminal of vsc
That happened to me on...3 occasions.
Execute python <file_name>.py
nah
in terminal or cmd? @slate swan
then -> cd to folder where main.py or what ever locates at (or where module locates at if you use cogs)
you have made on ready command
This is braincell disintegrating
it is on 1 line
As said use a f so its a literal call or whatever you call it and you just do:
await ctx.send(f"{ctx.author.mention} hello im the author of the invoked message")
NEED HELP
Nevermind, I have the answer.
and after all ```py
python file_name_here.py
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??
🤣 👌
wdym?
oh be quiet I knew that
in cmd?
of vsc or anything, yes
role = get(bot.get_guild(payload.member.guild.id).roles, id ="808013565298606080")
await payload.member.add_roles(role)```
any idea why that isnt working?
ok another question
IDs are integers not strings
is said that it cant find the file
Guys this person needs help 
Id isnt a str its a int

true thanks
how would you list how many members is on the watching status
you are in wrong directory then. cd folder_where_main_file_is_inside_at
wdym
@slate swan you deserve credit too
but I cant find the file
@slate swan that's yours, good luck on explaining with intents 
like it tells you how many members it is watching
discord doesn't have that ig
why not?
I found it
why do you save the avatar?
drag and paste in cmd
to upload it
discord doesn't allow that mate
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'))
Runs away
and why do you upload it?

you know that an avatar has a link?
what about servers
To not send the link
I hate these errors
To make it look better
Lolz
How to fix it?
because its what the bot has to do
oh, that's different
!d discord.ext.commands.Bot.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
okay now in cmd it said that it is logged in as the bot
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"?
I do not know, I get them a lot and then....give up
yeah I thought
Get the length of that
It that right?
so I would I do that
You know that sending the avatar link just displays the image right?
Yes, should be I don't remember exact output. try running some commands
well but i need to fix it ;-;
omg yes it works
cool!
thanks!
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"?
well help me too
Now that I have been here for 3 minutes I can leave again
@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
plz plz

but in some servers when someone send a link, it instantly gets disappeared
@spiral forge just follow this https://stackoverflow.com/questions/41203823/attributeerror-nonetype-object-has-no-attribute-strip
May i follow?
also please no unicode characters
No pls
Guys? 
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"?
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
This guy needs a help 
how and I already have intents in the code
There are 500 people who need help here
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
Do I need to have cmd open all the time now
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
did you open cmd or use vsc in build terminal, but yes you have to keep it open
.
Thanks bud, may God bless you!
In the discord developer portal
tf it automatically fixed when I used except Exception as e:@thick sigil
I said I already have it on
You dont need to save it, File takes bytes data so you can just pass it in the parameter
how am I supposed to be able to leave from here ;-;
Alr so whats the issue?
like??
how do make the bot list how many servers its on on its status
use read method
Finally more big brain people btw great to see you
len(bot.guilds), add that in the status string
what happen?
🤔
Basic python
Add a token bruh its None
- I made a mistake
- I got it wrong
- I am an idiot
- Something else happened
- It's not he right answer
- I spoonfed you
one of these things
Literally says that
So, how will I use "discord.on_guild_join(guild)" in my code and connect if with a return message?
await ctx.channel.send(file=await discord.File(ctx.author.avatar_url_as(format="png").read()))```??
await it
3 is quite false
You don't need to, guild.text_channels returns a list of text channels, try to send a message to one of the channels
liike this
Oke, but the rest are very probable.
🤷♂️
its already in env file or something needed to run env token?
@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),
guild.text_channels
return("Thanks for adding me!")
No
Guess you typed it wrong or something it says its None
@cinder marsh no you read the asset, not file
ah.. ok
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
Great to see you again my boy😉

!resources Please learn the very basics of Python and don't just copy paste code from an open source bot
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

I didnt copy and paste
this is my code
ohk module or anything other needed to run env token
Please look above and learn python ,discord.py isnt beginner friendly
Can you help me with the way I add this?
Token*
when if no embed perms
wow ok let me go ask a dev
I am learning it by trying to learn how to add codes in my bot, and understanding them. Its a bit harder for me because Im not english, so yeah. That's why am I here.
just like I want to do it that way
as I said, read the asset
Sorry we have a no spoonfeed policy
ok i added it in env file, but how to link main file and env file
and pass it to File
As I said, it returns a list.
- Use a for loop
for channel in guild.text_channels:
- Try to send a message to the
channeland if it was successful then just usereturn
try:
# send your stuff
return
except:
# continue stuff
You dont?
how to?
for channel in guild.text_channels:
try:
# send your stuff
return
except:
# continue stuff
You get the token from the .env file
Thanks.
how do you do it
it wont display thats it. ask them to fix it. bots should have embed perms
\👍
just tell me so I can go sleep for a big day
If it's really your code, then take a look where you added variables to strings in the rest of your code
You did it right here:
Im just stupid at this..
when your bot joins a server, you can check if the bot has embed perms or not
no as it says it returns nth but im asking to link env with py file
?? What do you want to do?
replit 😬
has a stroke
\👍
ayyyy @sullen shoal hello
lol-
hello
dies
Help please 😢
ya anything need to correct?
cries in python
You dont you get the token var from the .env file
yes, get a vps. theres free service plans literally on google search results 🙏
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:
:/
so how to get it?@slate swan
and your saying
google sneakyhub
can you just tell me how you do it like
@slate swan Help? Im trying for a bot to send something like "Thanks for adding me" on joining the guild...
thats a decent free host
ah wdym?
bruh I dont have all day'
learn python this is so basic
irrc client.run(os.getenv("token")
Welp, will. Just help me with this one.
await ctx.send()? I guess??
As I don't understand it..
Learn discord.py
you didnt classify the action
@slate swan all yours brother
runs
🙄
He gonna be mad lmao

Python*
i wonder why
where do you put len.(bot.guilds),
bc Im kinda suck lol
youre here to get spoon fed basic knowledge
True af
yeah, and we gave you the exact steps to get started
it seems like here is some sort of hierarchy of giving others change to help others by pinging them, how nice
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Am I the only person who asks for help that actually looks stuff up before asking?
we dont spoon feed, whats wrong eith that
I thought @slate swan was intimidating as he has allot of knowledge but you guys are something else
I spoonfeed
Exactly
where do you put lens.(bot.guilds),
Giving snippets isnt quite spoonfeeding
Don’t
Not spoon feeding more like advice
can someone please help me
what you mean? I was just saying it's nice that people ping others so they can help instead you can just run
Spoonfeeding = literally given the code perfectly working
Python is OOP so give logic
guilds = len(bot.guilds)
Then where u got name do name = f'{guilds} servers'
if i use token directly then also i didnt work
no here
Dont replit is public and btw you have a wrong token
like
I think ima just like runs
This how it works?
# On Join Message
for channel in guild.text_channels:
await ctx.send("Hello!")
return```
Your sending a message through all text channels in a guild
Also put the guilds line above the change presence line
And no need for return
.say :gg:
Command raised an exception: ValueError: invalid literal for int() with base 10: ':gg:844879478106357811'```
How do i fix this?
If theirs nothing to return
Hm, how can I choose one channel then?
And be sure it has perms- for the bot to send the message
Thats not a int a int is a number thats a solid unlike a float characters with ints are considered complex
I switched over to my projects 
I am trying to send the emoji with thr .say command
Im on life support
@slate swan Hm?
Just send a emoji as a str ig?
Hm
the chat is pretty active today
Your msg gets send where a command or event is invoked
Your not helping
Well I don't need it for a command as I need it to auto send when the bot is invited to a server
Then a event
so what will I use instead of
On Join Message
for channel in guild.text_channels:
await ctx.send("Hello!")
Not at all
idk whom to help ones stuck with env and ones coding as if python is some ai to detect what they want to do
Huh?
And ones brain dead which is me
Good luck, I will come back in a few hours when it's more chill around here ^^
I just wish ppl would ask questions properly and show the shit we need to fix it
i hate you🥲
You got this 
Do you feel a lack of professionalism?
Help?
Not really😭
Help? cries in discord.py
I do
Please :criy:
Lavox , what problem do you have?
You have to use the on_guild_join event
help you with lavox , or importing life lol
Just lavox
wait why is okimii's brain set to None
so I just add @on_guild_join
?
No
BRUH
.
@slate swan my bad for not saying it but plesure to see you again 
All
How do i make mee6?
Glad to know you're pleasured
wdym by all , a piece of code / error you have problem with?
open vscode and slap your keyboard
.
@slate swan basically he or she wants to make a command to when the bot joins a guild it sends a welcoming command
Can I see your complete on_membe_join event?
As said^
*member
Doesnt have one
I don't have one
where do I put that mf lol
I did that, but i made @unkempt canyon instead
I see
Can we put custom buttons and links on bot presence??
Like MAL link??
Custom buttons yes
discord.py 1.7.3
Use disnake
Possible in dpy??
prays in discord.py
Not really without a third party lib
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
Don't think so
Can I insert dsnake code in discord.py??
Pretty sure no bots can use buttons in their presence like users can
Can I please dm you?
You can have all of code from discord.py 2.x in disnake
I dont wanna emberass myself here lmao
users can put buttons?? 🤔
In presences, yes
How??
Using an RPC client
RPC?
Rich Presence
Sure , I may take time to respond tho :)
rich presence
Wanna learn disnake in 5 seconds easily just do this:
import discord
To omg
import disnake
🙀
i dont think it is, discord is quite limited with presences for bots
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
Where is the pip installation 
Because it's an invite link to their server
Thatd a dev portal feature
\🧑
hm
No ;-;
I wish something like this would be in dpy
That's on users, not bots
😢
Nothing to do with discord.py
RIP
That portal thingy is to invite the bot and not to a server iirc
It's Discord themselves limiting the bot statuses
Too invite a bot to theit server yes their is
Yeah isnt that what were talking about?
whats a good module for RPC in python
😔
Yeah but the button was "Join my server", and it made the user join their server
Bruh
used to do that stuff when i was a skid
Only works on users though https://github.com/niveshbirangal/discord-rpc
If we are talking about blank , he/she wants a invite link for a server in the bot's status
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?
ty
arrays?
Lists/tuples.
or sets
Alr
sure
Do you know how you do as user?
^
Or read the discord documentation about RPC
Oh its rich presence
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
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
This man is on a rampage
how do i make it to where it will only let you do a command if its listed in here?
help how you list how many servers the bot on
Pass it in your commands.Bot
Do a global check
owner_ids = the list
I wanted to make a listening thing like spotify for other apps but it requires selfbot
witch one
for x in bot.guilds:
print(x)
but where in the string do you put it
like what kind of global check
@lapis wyvern @slate swan has said it like 5 times to you bro?
Where you put the text in the status
!d discord.ext.commands.Bot.activity
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.
I think you know where it is, since you coded it
Bruh i already told u
You check the author to your list?
Ain't enough ^^
Like i gave u exactly what to put scroll up
The owner list is for bot owners?
i wanna replace the role with check id
Almost everyone did
no i want it to check for buyers, admins, and owners
You do a decorator
||they want the code and not explanations||
Makes sense
You can make a custom check
I gave him pretty much the code
can you just the exact code
and how would that look?
then I can compare to see how would I do it
!customchecks
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.
Scroll up you have it minus me giving u everything
Never seen someone want a strip of code as hard as you
I told u where to put it and how to do it
I think you can just put the id instead of string
Read this @slate swan
Cant find it say agian
joins
Lurks
dies
codes
leaves
Here @lapis wyvern
Bruh if u cant understand that give up
Actually learn python and oop instead of give up
The boys lmao

Infurnums line was gold😭
ok this sucks
Guys, why am I having this?
pip install disnake
Sorry you feel that was but we don't quite spoonfeed here
ok so how would i link that up with this
import it too
Did this tho
You have to actually download disnake
He been spoonfed
And you dont even import perms?
He did but hes hungry again
Where
Cmd
and why-
because you use it
I did run pip install
Can you open tiktok without downloading it?
OMG IM GONNA MISS NEW CHARLI'S TIKTOK
OLOLOLOLOLOL XDDDDDDDDDD kids be like
leaves
No but fr, I already did a pip install command.
bruh what
yay she or he left
That was a fucking joke can you help me
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?
Never did
dang it me wish
I mentally left this chat 8 times
Can you help me? I already ran that command.
good prob the reason was me
just putting pip install wont work
Its:
import disnake
from disnake.ext import commands
I did pip install disnake bruh..
then say it properly
Same
what
I wished i left a while ago now i have brain damage
also most IDEs dont update imports, so your code should run fine if you run it
you need to import disnake in the file , lavox
sad :9

You're on PyCharm right?
look at my pfp
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
wait is genral even active
Why pycharm he or she is literally a beginner😭
Yes and nice pfp
Yeah,,
Blurry as my future
https://i.krypt0n.co.uk/47fb4665.png Can you click on that?
And share a screenshot of the "Python interpreter" part
It's in the middle of the popup
The #s before channel names appear almost invisible on phone, is that just for me?
can i send message without ctx.send?
Virtual environment
You need a messageable object
Click on File > Settings
Like above in the name of the channel?
nope like ummm
like TextChannel or DMChannel
uh
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
2 3 isnt a discord id
Its a int
Why that?
bre do u not read
Its always like that
its a category and i use a cmd to add a id
Go there https://i.krypt0n.co.uk/76984347.png
I mean , ctx is not required to send a message always
Just a messageable object like TextChannel or DMChannel would work
winrar tech tips
so by default its jus 12345 type thing
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 your discord tripping
well i think i fixed the bug, tq for help
Oh well, that's different
What's the code
mines looking fine as well
well i using pycharm maybe i can help you
Nothing to do with PyCharm at this point
Why tf does your discord look so good????
wanna send me to you in DMs?
ok am dumb , those channels were just muted
It appears different on Desktop so got confused
send me a friend request please
Send it here, the part where you define the intents
idk tbh
😭
Bot Prefix
client = commands.Bot(command_prefix = 'a!', intents=intents)
Mine looks simple bruh
And what is intents
Intents
intents = discord.Intents(members=True, guilds=True)
To what have you defined it
XD
...
um yea
disnake.Intents
armoled
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
Well if I delete import discord, this is what happens then
you're not supposed to use sync stuff with async libs like dpy
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
Yall like my discord?
😉 😏
requests is sync
flashbang
fuck u
😭
Remove all the references to discord. and replace with disnake.
if you use discord.py import discord
Light theme is pog
flushbanked
takes my sleep away
See your a man of culture 😭
😳
@sullen shoal yours bad kid🤮
discord in mobile device's browser is pog
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.
You have 2 help commands
The error literally says it all
What everybody saw
do that at 1am
o
while lights off
Actually you need to remove the default help first @modern fiber
Wait how
the one I had previously is like that auto one..
remove_command="help"```
why lol
How?
Using disnake, and the code is right
in commands.bot
client.remove_command('help')
oh u are disnake user XD
This works toohelp_command = None
Not me
They are using disnake
it says undefind "client" part
oh i think they use dpy
Yes just yes
bc discord.py shutting down..
and they wont accept it anymore as I heard
||@slate swan|| Sarthak bhai
replit caches my requests.get module and shows me the previously fetched result, how can I fix this??
im migrating pycord XD
Who said that?
i think the owner it say
It's not shutting down
discord.py is like will die soon because slash command
Yall tripping he never did
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.
So it won't get updates
Yall mad tripping
Don't make 2 help commands
I have one..
Just one
the other one default ig
You have the default one
discontinued but still online
I used
remove_command="help"
tho
Shutting down is when its out of service
I dont want the fucking default one
bot.remove_command('help')
yea, but because there was pycord i put all my hope on pycord rn
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
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
value is empty
Where did you write that?
at the top
Don't do that
where should I then
Yeah so can what I was doing with the for loops not work?
Put it after your bot declaration
wdym
Im going to leave have a good day guys 
value2 is an empty string
value2 is "" which is not accepted
Maybe you want a few changes
You have this somewhere right?
bot = ...Bot(...)
Put it after that
too many dots for my eyes to handle

@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__']
nice
client.run("token")?
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.
Have you added it?
Yeah.
Do you have an on_ready event?
Put it in there then
@on_ready
bla bla bla
Inside it
how exactly, lol
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?
nice censoring btw, i couldn't understand shit
!d 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").
thanks its however just a part lol
@client.event
async def on_ready():
# here...
aighty..
File "C:\Users\korisnik\PycharmProjects\DiscordBot\main.py", line 91
client.remove_command('help')
^
IndentationError: expected an indented block after function definition on line 90
Read the error
It says everything
uhh
uhh
space?
You did:
@client.event
async def on_ready():
code_here
Which is wrong indentation
!indents
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
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.
hmm
I don't remember where you need to put that code to remove it
Uhh.
Anybody knows? jeez
how do you hide a token
You're supposed to put it right before where you define client
Using a .env
Try it and see
do you do client.run(os.getenv.TOKEN)
Here
Take a look at this
Doesnt work
It does
Traceback (most recent call last):
File "main.py", line 412, in <module>
client.run(os.getenv.TOKEN)
AttributeError: 'function' object has no attribute 'TOKEN'
If your use it correctly
I idd
No you did not
I did
Is it so hard to read this
Like really...
??????''
There is a clear screenshot on how to use it
sigh
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...
show me a token example
Literally
H E R E
just spoonfeed him from importing discord to running it and end it im annoyed
client.run(os.getenviron.TOKEN)
AttributeError: module 'os' has no attribute 'getenviron'
* Running on all addresses.
its a token for god sake
!d os.environ half knowledge is dangerous (:
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.
If you can't even copy paste what's in a screenshot, I won't help you further more
do you save it in the cache , or replit just tends to save it automatically?
Also , is the request made everytime or just once
Try not to scream on people before knowing what does the funtcion do lol
os.environ works the same as os.getenv lol
No
then why isnt the token working
It's the same in C
I did it right like bruh
The difference is, environ is a dict whereas getenv is a function to get the env var. Read the embed 🤦
getenv is in C but whatever
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?
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.
Hope y'all enjoy this guy
s equivalent to getenv("HOME") in C.
I swear there’s never a day where Hunter and Krypton aren’t beefing.
can yall just show me a example of a TOKEN LIKE BRUH'
Yea, so?
Facts tbh
Whatever
Skill issue
...
Add this line of code
from dotenv import load_dotenv
load_dotenv()
Not my problem at this point
Should work after these
You don't need it........
@slate swan
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
I mean I’m not specifically targeting you Krypton. Id like to think I’m pretty chill with you. 🤷♂️
That's what they all say 
BTW Krypton, u still haven't told me how to get music audio from a legal place 🤣
NOT LIKE I CARE
😂 😂
I literally sent the mp3 file
how i can make calculator in my bot with all +, -, x, / in one statement
Where
At least stop lying
On Facebook duh
eval function
I'd use a library that will parse the equation for you
NO!
which library ?
I even starred your bot template 😢
Why?
Imagine him making a public calculate command
HELP
And someone sending code
who's krypton
Hmm, good calculation
How does that prove anything xD
ITS NOT WORKING
I Pay For Winrar
eval is sketchy and disliked by most people
o
Hm?
I mean , they can just isolate it by check it's only a mathematical calculation or not
Yeah because that load thingy is not needed
why not
Well yea, facts
I don’t even know 😭. I thought that would carry some meaning. Guess not.*
You can already remove that code
eval is sketchy and disliked by most people
Imagine someone sending code
^ is not a valid Operation in py
Yea
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!")```
the eval function?
Isn’t that bitwise
yeah
u can use break
Xor?
What does that have to do with this?
If you use a bit of logic it ain't @slate swan
!d discord.Guild.system_channel yes
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`.
get the channel object via its ID and then send it to that channel
U gotta try except BTW
bruh
It's public bot bud..
XD
that's why you use a database and have users configure it :bigbrain:
..
bruh
you are just fucked up lol
request is made when program starts
You sure? Pretty sure it is. It’s the bitwise operator for xor.
Can we calm down here? kayle just told the answer to your problem @modern fiber
its on_guild_join kraots
replit tends to save it automatically
Why are you trying to do it that way in the first place? Instead of having tens of checks, just use a different approach
oh
Yes it is.
excuse you?
☹️
🏃♂️
that's the reason , you need to make request everytime
!e 1^2
@slate swan :warning: Your eval job has completed with return code 0.
[No output]
dont start an argument bruh
NEED HELP
☹️
So I replace
for channel in guild.text_channels:
with
for channel in system_channel: ?
you already got help
Make the request everytime the command runs
Not working..
Or the event
Lmao this channel became a mayhem after my argument with Krypton (as usual loool)
you most likely did something wrong
Code
dont iterate through it, it isnt an iterable
wdym iterate? Im not english, lmfao
DOES THIS LOOK LIKE I DID ANYTHING WRONG
just check if it exists, and send it, if not send something
Show code bro
iterate means to loop through
Yea, u gotta do os.getenv("TOKEN")
for ... in ...
``` iterates through an iterable
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
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??
Can you just edit this code for that then?
os.getenv.TOKEN , smells js
!e
print(60^13)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
49
@boreal ravine
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
It's a valid operator
wtf
@slate swan
os.getenv['TOKEN'] literally, you've been told like 20 times already
Show the full thing
what full thing
os.environ*
os.getenv("TOKEN")
same thing
either works
client.run + plus the thing you said
already said that 😭
Do they? Since getenv is a function...
are you actually that fucking dumb you can't fucking do that shit yourself what the actual fuck
Ok ok calm down
a dot after run?
Remove that dot before the brackets
is that necessary?
😂 yo this man Kraots.
He's just pissed, understandable
bot.run(os.getenv['TOKEN'])
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)```
What's the error?
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!")```
__Enumvalue Activity type not callable
!d discord.Guild.system_channel
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`.
Which line
like that
dude
Dude remove that dot before the brackets
Also getenv is a function, u gotta use environ
Okay calm down there. Ignore him
i got muted for saying that
¯_(ツ)_/¯
DO THIS
client.run(os.getenv("TOKEN"))
And how can I add embed to it?
embed = disnake.Embed(title="Help Command")
embed.add_field(name="Help & Support",
send(embed=embed)
!mute 374622847672254466 1d that is not at all an appropriate thing to say

