#discord-bots
1 messages Β· Page 609 of 1
nah , you can get the id tho
yes
!d discord.Guild.owner_id
The guild ownerβs ID. Use Guild.owner instead.
and then just let it do this
ty
@commands.command()
async def suggest(self, ctx, *, message):
channell = self.client.get_channel(911618237702225921)
if (ctx.author.guild_permissions.send_messages):
embed = discord.Embed(
title = '',
description = '',
colour = 0
)
embed.set_footer(text='By oSeatch#6969')
embed.set_author(name=ctx.message.author, icon_url=ctx.message.author.avatar_url)
embed.add_field(name='Suggestion', value=message , inline=False)
message_ = await channell.send(embed=embed)
await message_.add_reaction("β
")
await message_.add_reaction("β")
await ctx.message.delete()
return
else:
await ctx.send("__**This Command Requires a Higher Rank.**__")```
This exact code works on another server but it doesn't work on my test server, am I doing something wrong?
<@{discord.Guild.owner_id}>
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'member' object has no attribute 'client'```
This is the error
it's in a cog
oh nvm , do you have member.client somewhere>
nope
traceback includes the line number and file name.
1 sec
wow ok im brain dead...
def __init__(self, client):
self.client = client```i forgot to add this..
hi I want to make a command for my bot that compares the stats of 2 players from the hyperlands api. here's my current code, i don't understand how I can make the bot differentiate between the first user and the second (because usernames can have spaces in them)
https://paste.pythondiscord.com/yecokodigi.py
ping me
Either use slash commands or execute the command like
!compare "Username one" "Username two"
Will it work without changing the code like I can just go and try it with ""?
What do you mean?
Just try it
severe deja vu
And you shouldn't use requests
ok
use aiohttp instead, as its asynchronous
,compare "AbleToHxck" "kvdgamerboy1"
Ignoring exception in command compare:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
TypeError: compare() missing 1 required keyword-only argument: 'player'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: compare() missing 1 required keyword-only argument: 'player'
Why is the arguement missing? how can I make my bot know that it's the second arguement
instead of args and kwargs do: literal params.
async def compare(ctx, player1, player2):
... code
it will take: .compare player1 player2
Apparently it is
are you in a cog? Good Name?
oh ok
guys..... i need halp, im trying to connect mongo db in my repl
;-;
oki
would offer some worthwhile help on that.
Ignoring exception in command compare:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\subha\Documents\HIDE\main.py", line 455, in compare
user = player1.json()
AttributeError: 'str' object has no attribute 'json'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'json'
π
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
> python main.py
File "main.py", line 393
y += x.member_count discord. Embed (descrip tion=f"Tirex is Best anti nuke bot which prev ents your server from any type of damage", timestamp=datetime.datetime.utcnow())
SyntaxError: invalid syntax
exit status 1
Why do you have so many spaces
me?
i think its their console. mine used to do that a lot on my chromebook
Not player1.json(), but stats.json()...
oh ok
Same for player2 below
Please take a screenshot
i need halp with my mongo db connection pls halp anybody #databases
okk
And you might want to ask a question there...
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
ok
like this? @brittle ingot https://paste.pythondiscord.com/mopilinuje.rb
You haven't changed anything
I change the stats.json to player1.json
Read this again.......
@client.command()
async def role(ctx, role):
if (ctx.author.guild_permissions.change_nickname):
role1 = discord.utils.get(ctx.author.guild.roles, name= role)
await ctx.author.add_roles(role1)
await ctx.send(f'You have received the role **{role}**.')
@role.error
async def role_error(ctx, error):
if isinstance(error, commands.BotMissingPermissions):
embed = discord.Embed(title=f"Error!!!", description=f"You Can Not Get This Role!", color=ctx.author.colour)
await ctx.send(embed=embed)```
I want to make a role command which I did. Now the problem is, if there is a role HIGHER than the bot's then the bot can't add it. In such a case, I want the bot to display an error message but it won't do so. Can anyone tell me where I'm going wrong in the error message?
ohhh
Ignoring exception in command compare:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\subha\Documents\HIDE\main.py", line 456, in compare
online = stats['status']['online']
TypeError: 'Response' object is not subscriptable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Response' object is not subscriptable
anyone?..
my space bar is broken i think
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
taking a look
wait lemme figure it out
ok thanks
hmmoki
in commands.MissingPermissions is there anything that can replace commands
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())```
MissingPermissions is for @commands.has_permissions BotMissingPermissions is for @commands.bot_has_permissions
this is my code
you can compare bot's top role's position and the role's position ( discord.Role.position)
async def tictactoe_error(ctx, error):
print(error)
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Please mention players for this command.", detete_after=5)
elif isinstance(error, commands.BadArgument):
await ctx.send("Please make sure to mention/ping players (for example @688534433879556134).", detete_after=5)
typehint the role arg to discord.Role so you dont need to get it
and in english this would mean?..
what error prints to the console when there is a conflict with the roles position compared to the bots role.
1 sec
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions ```
what? isnt that english
in laymens terms they mean. Assuming they don't know what typehinting is.
hey did u figure out my error?
it would mean in your command parameters you do:
role: discord.Role instead of just role.
not yet. I've just returned to look at your error real quick
according to this msg, what do you think I should add in my error code?
How to delete all the channels in a server?
remove BotMissingPermissions
!d discord.Guild.channels
property channels: List[GuildChannel]```
A list of channels that belongs to this guild.
await channelrandom.delete()
Loop through that and use .delete()
Ty
you are trying to read the response "stats" which is an entire HTTP response with headers and a body Instead of doing like for example:
rank = stats['rankData']['rank']
you should do:
rank = user['rankData']['rank']
Since when you did:
user = stats.json()
You specifically assigned the json object of the entire request response to the variable user
ye loop

then what do i add in its placE?
This command is a bit abusive tho-
sry remove Bot from BotMissingPermissions , i meant
alr tried that
why would you need to delete all channels in a server?
nuking ofc lul
Nah
hm
Just asking xd
XD
ok so i change all of the code from stats to user?
yeh we don't help with that stuff, anytime anyone asks for that stuff we need to make sure their intentions are correct.
the entire json thing
oop
wuts ur problem
Its hola bro
for the first part yes, but for second user where you assign the request's json body to player you change those to player.
I just like to say 'ola' and 'elo' :}
π
Someone stole my bot token on replit and deleted all the channels in a server with over 200 members... Since then i never hosted my bot on replit.. i always wondered how they did that.
so in the first part I change it all? and then in the next json thing I change it to player?
he pays for winrar, end of discussion.
correct.
just use an environment varialble
Everything on replit is public

Yes
Yeah- i was dumb

I thought it was private
No bruh you have to make a .env file to store your token in
You could make the code a bit cleaner by making the fetching of a player as function,
Thats why:
Replit = bad
lol
Instead of env i created a bot_token.py file and thought it would be enough
Vsc = Good
keep ur token as a secret , u use rep ofc
is it possible for the bot to send a message in case there's ANY error?
wait what, i host everything on replit 
Vsc is an editor you have to use a vps for hosting
@role.errror
async def role_error(ctx, error):
if isinstance(error, commands.WhatToAddHere):```
Rather buy a vps then host on replit
Just remove the if-statement and send a message
3 r's
remove that 'if' line and add 'await ctx.send("Error!")'
discord.errors.Forbidden ig
yes
And send the message straight up
errors.Forbidden deals with all the roles and perm thing
in case there's ANY error?
The docs say discord.Forbidden
well this is working, might as well go with any type of error
oof
I suggest to look at error handlers in docs
ill try this too
Just use try except
ew
async def on_command_error( ctx, error):
print(error)
if isinstance(error, commands.MissingPermissions):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error, commands.UserInputError):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error, commands.CommandNotFound):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error, commands.BotMissingPermissions):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error, commands.MissingRequiredArgument):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error, commands.BadArgument):
await ctx.send("[HANDLER] Could not find that value!")
elif isinstance(error, commands.DisabledCommand):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
await ctx.send(embed=em)
elif isinstance(error,commands.CommandOnCooldown):
em=discord.Embed(title='Error!',description = f"{error}")
await ctx.send(embed=em)
elif isinstance(error, commands.NoPrivateMessage):
em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())
em.set_footer(text='k.command (command) | for help!')
await ctx.send(embed=em)```
Well nobody really asked for it
And it's flooding the entire chat
Might want to upload it and send the link if you really want to show it 
im......
Bro why do kids be hating on vsc for not being able to host like replit 
async def role_error(ctx, error):
if isinstance(error, discord.Forbidden):
embed = discord.Embed(title='Error!', description='You can not do this', color=ctx.author.colour)
await ctx.send(embed=embed)``` wheeee im defo doing something super dumb
They call vsc bad cause of that reason
Dude
they like free stuff
i host my entire chatting application on vsc

Vsc is a text editor or sometimes ide while replit is texteditor,ide aswell as hoster
I mever pointed my opinion at anybody
And that's exactly the point of what was said...
Vsc is more a texteditor than a ide
he mever pointed on anybod
vsc = cool
all others = gay
now, is this code correct?
You forgot about pycharm
Nah
that there is a violation and i wouldnt personally have it
Pycharm is only for community
vsc > pycharm
naw cap
Pycharm provides community support
pycharm kooler than vsc
how so piro
The only reason it has an edge over vsc is because of enterprise support and that too the community version needs u to pay
ye
Community more like enterprise
π
Wait what
You're saying you need to pay for community?
No
na u dont
The enterprise i meant
xD
If your working as a team then u go for pycharm
Needed that
Your big brain man
It doesn't really matter what you use for editing the code
What matters are the tools you use outside of your IDE
Yall all trash i use notepadπ 
Yes
nano > notepad 
ew
#editors-ides is also there BTW
Yeah realized that thanks
Talking about IDEs for bot development
And nano is definitely the best

Average replit user hating on notepad
Notepad => nano
pov:replit haters being angry weN i said ew
Still, the topic is IDEs
my english badbad
[...] related to bot development

No
truth is idk how to install stuffs like modules, i just succ at that

How do i check if someone already has a role?
ctx.author.has_role(role1) isn't seem to working i alr added a variable for role1
Can I see what's role1?
async def role(ctx, role):
role1 = discord.utils.get(ctx.author.guild.roles, name= role)
if (not ctx.author.has_role(role1)):
await ctx.author.add_roles(role1)```
if role1 not in ctx.author.roles
ye
:kek:
vsc >>>>
Isnt that obvious huh?
Vsc is nothing compared
what are you on πΆββοΈ
Windows vista ofc
or if role1 != ctx.author.roles:
understandable π
thanks
im bad at typing
No
you too :)

no
nvm
well
does anybody know how to check whether a user is having mutual guilds as me
Selfbottum moment?
yeah, just click the user's profile and then click Mutual servers
using bot....
no
yes it has it in the docs
its there in the docs
Read them
but idk how to implement them
which docs are you on lmao
which docs are U on
y'all still on the outdated dpy??
oh yeah surprisingly it is still there
C:
I get this when trying to start my bot ```python
SolverProblemError
Because no versions of discord match >1.7.3,<2.0.0
and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
So, because repl-python3-modestcornydatasets depends on both aiohttp (^3.8.1) and discord (^1.7.3), version solving failed.
at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237β packages = result.packages
238β except OverrideNeeded as e:
239β return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240β except SolveFailure as e:
β 241β raise SolverProblemError(e)
242β
243β results = dict(
244β depth_first_search(
245β PackageNode(self._package, packages), aggregate_package_nodes
exit status 1
.
and surprisingly it still works
Oh
well i had this problem create a new repl
this is on a new repli
its in every repl
well, not in disnake
How do you even use those property stuff and what is it never used them before
try installing discord.py in shell
Just like any attributes
property is basically a nice way of saying attribute, but slightly different
Bruhπ
you can't change the value of a property
unless you make a setter for it
I see
and unlike an attribute, you can add some code in the property
requirement already satisfied
How do I invoke command by an url ?
replit installs the pypi version of dpy which is 1.7.3 not 2.0
That's cool
?
Any idea
but how do i fix the error none of my code runs it just gives me this error
Just gonna say it
disnake > any fork
When ppl go to the link command in discord will run
i couldn't agree more
I want like this
make an API
Disnake or .py 2.0?
i dont wanna understand how to use it seems complicated
The for I use in the evening is definitely better π΄
disnake
How
using FastAPI
It's a fork, so you use it just like discord.py
it's literally similar to dpy
Does it have slash?
yes
Its the same syntax you just have to change discord to disnakeπ
has slash since day one
some people bro π
nice
Server for it?
let me try disnake
They trippinπ
To change libraries can i just install via pypi and then change import and everything else same?
if im disapointed its your fault
@slate swan Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!
Our server rules can be found here: https://pythondiscord.com/pages/rules
what
oof
@slate swan Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!
Our server rules can be found here: https://pythondiscord.com/pages/rules
oof
I should probably check this myself but, will everything change from discord to disnake if I switch to disnake? for example
embed = disnake.Embed()```
Or juat import disnake as discord which is bad pratice so no
There's a discord button
And you get to the server
or yeah use the docs to join
Yes
Okay cool
yea
You have to change everything from discord to disnake everything
pain
ctrl + F2?
Download it and import itπ
lmao
Until someone does my help command and sees the discord help instructions as dissnake
disnake* please
@slate swan what version of disnake you use?
And make it case sensitive
latest pypi
then it won't change
wdym
what help command
For find and replace
Or replace discord. to disnake. and import discord... to import disnake...
Β―_(γ)_/Β―
So inside the library everything is still the same
Yes
Oh yh ez
It's a β¨ fork β¨
Weve said it like 5 times its the same syntax
lmao
But say like discord.utils is it disnake.utils
yes
But is it the same syntax?
No there has been conflicting stuff
Already said it 6 times, y e s.
for the most part, yes, there are some breaking changes tho, they're easy to fix so no big deal
It was a joke 
for example in disnake when you edit a message all params are kwargs, content isn't an arg anymore but a kwarg basically
who knows to connect mongo db better here
oof
^
I still dont get it
for example
def func(arg, *, kwarg):
...
func(arg, kwarg=...)
you can't specify what kwarg is if you don't add the kwarg=something
Oh
It's when you supply a named argument to a function.
^
So if i normally do arg = None for example thats a kwarg already?
no, you're just giving it a default value
So when you call function like some_func(param=value), that's a keyword argument.
As opposed to some_func(value), which is a positional argument.
idk how else to explain π
Explained more in depth
Do you know that you can specify the parameter names when you call a function? Like some_func(param=value)
i dont think they did tbh
yes
are you mac user
it says package dosent exist
ew no
uh
Mac is sexy
Wsp bro
u sure u spelled it correctly?
do python --version
disnake and not dissnake
Try pip3
what does wsp mean
Or Disnake
yes
Whatsup
Good to hear
Pretty good
nice
hm
?
so uh i switched to disnake
File "/home/container/.local/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 175, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/.local/lib/python3.10/site-packages/disnake/ext/commands/help.py", line 836, in command_callback
return await self.send_bot_help(mapping)
File "/home/container/cogs/help.py", line 46, in send_bot_help
embed.set_footer(text=self.get_ending_note())
File "/home/container/cogs/help.py", line 18, in get_ending_note
self.clean_prefix, self.invoked_with
AttributeError: 'HelpCommand' object has no attribute 'clean_prefix'```
that's a dpy 2.0 breaking change
o h
self.context.clean_prefix
and self.context.invoked_with?
if you haven't even migrated from dpy 1.7.3 to dpy 2.0 then you'll have a ton of breaking changes to fix
idk if that's changed
show the error messags
ill see
the dis snek people said i need python3 and that there docs where wrong
so you dont wanna show the error or what
The disnek people
i can if you want
what's disnek π π
do it
so I can't use discord_components with disnake?
await self.get_destination().send(embed=embed,
components=BUTTONS
)```
``Messageable.send() got an unexpected keyword argument 'components'``
Or is that another breaking change
bro
Its disnakeπ
it's disnake π
What dimension are you onπ
π
How do i insert bot token in Vsc in replit i went to secrets and did it
Dissnekπ
π
TOKEN = "yourtokenhere"
wdym
thats literally
so goddamn basic
Ctrl c ctrl v
token value

not .env token
No need for it
Just copy paste your token cause its private unlike replit
does disnake have buttons lol?
Yes ofc
oh
Theirs examples in the git
Why would u use disnake?
If u wanna add it under windows its in systems settings
why not
But u might aswell copypaste
When dpy 2.0 provides u buttons?
Also i dunno if vsc will read directly from windows env variables
dont tell me you use those crap old extensions for discord.py
Huh
why would you not?
Just use ui.View
Why not
it doesn't provide slashes
cant find it π
discord.py will die once discord forces everyone to use slash commands
Use pycord
Its disnakedev
pycord is shit, disnake is better
Go to examples
No way
yes way
Views
No.
got it
pycord changed the path of Bot
ty
Yw
yes stop being such a simp for that yt guy that made vids about pycord lmao π π
He watches freecodecamp too chill
more popular != better
pfft-
freecodecamp bad
Is this what ur talking about?
Bro your always against himπ

no, it's at DisnakeDev not EQUENOS
@sullen shoal hates freecodecamp to death
it got moved to an organisation from EQ
π π
^
Freecodecamp is good
Yeah i know you like him

lol this guy likes freecodecamp
Imagine
although theres one thing even worse than freecodecamp, wait i gotta find thr link
Lucas
Lucas?? π π
https://youtu.be/8YoNsQO1Vso
this grown ass uses scratch for discord bots
Learn how to make a Discord Bot WITHOUT coding or downloading anything! In this video, I show you how to create a discord bot using drag-and-drop blocks! Your Discord Bot will be hosted for free, and you won't have to download anything onto your computer! Best of all, you can make a Discord Bot without even knowing how to code! By the end of thi...
oh damn
π
No comment
Xd
You cant call that even programming more like a game or a puzzle
something wrong
at the end
at the end i did
Whats that at the end?
bro its gonna be 2 days and you're still stuck with those 35 lines
uh
m8 you just showed like 99.99% of it
you exposed the main part of it
Just do bot.run("your token")
.
the main part is the one after the 2nd dot where it's discord's HMAC
now go change your token
Lmaooo so true
And what the fuck is keep_alive
replit thing
@slate swan whats that in the last line of the terminal his ip?
I have no idea what does numbers are for
But your actual token
you have to run a webserver along with your discord bot to host your bot there
Bruh*

yes i out it
?tag rule 11
This is not a Modmail thread.
yea
@slate swan the last numbers
oh that, it's his local server
pretty sure that is his ip actually
his provider's ip
We're glad to help where we can, but come with at least a basic understanding of Python.
- It's recommended to complete a smaller project first. Some of the techniques used in the library are difficult for beginners to understand and could be potentially frustrating or confusing.
is aiohttp faster than requests?
doesnt matter
i'm trying to make my anti-nuke faster and idk what to use
No aiohttp is async
i keep shifting between 3diff countries
While requests isnt
Does*
π
okay but is there anything faster than requests?
If your using it in a coroutine use aiohttp
So your coding in vscode and linking it to replit?
does anyone know if theres a way to make a discord bot create/edit/delete events?
that variable name is so.... what
making an anti-nuke so i'm pretty sure i should use aiohttp
i am just coding it on vsc
Oh-
shh
Ic
i will host it on google cloud or mesoku
guild events?
@slate swan bro your coding your bot in vsc and hosting it in replit π
no this kind of event
no host on google cloud or mesoku thing
imma do it rn
What a shame for vsc
Yeah
yeah that's a guild event
oh ok thanks
ok thanks!
Not documented in any libs rn
It's still a new feature
ohh
since it's relatively new to the API it's probably in no lib for now, but iirc it's coming fairly soon to disnake
Gonna be implemented in disnake soon
Disnake is just to goodπ€·ββοΈ
True
ikr
ahead of everyone
Other forks just cant keep up
Lmao true
keyword forks
I want to use the 'click here' Button yo invoke a command rather than url. How can I do this any idea ?
A hyper link
so should i just host it on heroku
...
Oh-
Really?
no just for hosting
Yes really
but goes into url I want to invoke another command on click
Still theyre both bad
ik
Send a link to disnake server in dms @slate swan
Idk
i dont have any other free option tho
lmgtfy
then host on heroku, yeah
Hi! How can i get the user # numbers with python?
which lib are you using
just discord
!d discord.User.discriminator
The userβs discriminator. This is given when the username has conflicts.
???
Yea this
I have now switched to disnake and am officially a part of the cool gang
π
surprisingly there weren't any breaking changes
i only won't switch to disnake cuz i'm to used to writing discord.Embed
except 1
and discord.Member
disnake.Embed is weird idk
Welcomeπ
disthon.Embed isn't to bad

you cant thats it. unless you host a website connected with your bot instance that would invoke the command when the link is visited
sed
you can use select menu tho
what lib you using
idk then
ah shit
here we go again
import disnake as discord is always there :D
tbh they could just replace import discord with import disnake
@maiden fable slash commands are "released" in disnake?
SolverProblemError
Because no versions of discord match >1.7.3,<2.0.0
and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
So, because repl-python3-heeeeeeeeeeeelp depends on both aiohttp (^3.8.1) and discord (^1.7.3), version solving failed.
at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237β packages = result.packages
238β except OverrideNeeded as e:
239β return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240β except SolveFailure as e:
β 241β raise SolverProblemError(e)
242β
243β results = dict(
244β depth_first_search(
245β PackageNode(self._package, packages), aggregate_package_nodes
exit status 1
Replit: Package operation failed.
I keep getting this error when trying to run discord.py in replit
then from discord to from disnake
Yups
whats this
Node.js
the error i get when trying to run discord.py in replit
i dont help replit people so gotta stay away
i wouldnt be useing replit right know if it werent for the fact that my python IDE insnt detecting 3.10
Disnake also have context menus and most of the new things in the API
it's been in the stable ever since it was released and already fully supported slash groups and subcommands, and in cogs too π
Nice
although back then the way you added options was kinda shit, now it's a lot better
You should not use Repl.it to host your bot.
While this may seem like a nice and free service, it has a lot more caveats than you might think, such as:
-
The machines are super underpowered.
-
- This means your bot will lag a lot as it gets bigger.
-
You need to run a webserver alongside your bot to prevent it from being shut off.
-
- This isn't a trivial task, and eats more of the machines power.
-
Repl.it uses an ephemeral file system.
-
- This means any file you saved via your bot will be overwritten when you next launch.
-
They use a shared IP for everything running on the service.
This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
Please avoid using repl.it to host your bot. It's not worth the trouble.
heroku >>> replit
Both are shit
Yes
when i was a kid, i used replit for once, both times as soon as i ran it, i got rate limited lol
But yea i agree heroku is better
I never got ratelimited with replit tbh
i got ratelimited twice as soon as i ran it
yep
i had some idea to code that day but couldnt rip
-
Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
-
Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
-
Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
-
Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
-
Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
Imagine dpy tags
Xd
Bro i know how to do cogs but i see them terrifying for a reason
!d discord.ext.commands.Bot.wait_for @patent surge
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
ik, but as a free option, heroku is the best free one
You can get a free actual hosting service.
It's really not that hard; since many hosting services use arc.io which kills most of their needs for ads and or premium services.
like?
https://somehost.xyz is a great and easy-to-use one.
Free and paid hosting
You've tried it before?
even tried the most expensive pack
i tried some discord hosts that rich kids run, they provide like 20 percent cpu usage and some bit of ram
couldn't get my bot to run
yes
- it also asks you to stay on some shitty page to get some coins
heroku doesn't
Since that's off-topic, mind talking in DMs?
Can i send there multiple events ?
i'm not going back to trying it out again only to error, i don't even wanna bother with it actually since i'd have to stay on some shitty page for some coins
Ah well that seems like a you problem; hence I won't go on more with this.
No, u need multiple wait_for then
But for multiple wait_for it will check one after one
i still have this question why does sometimes a bot doesnt have a channel id or a id of something in its cache and you need to do a api call?
I want to check different events at same time
what bot command should i add
Uhh, I don't really know... Less resources?
maybe because they change name and stuff so they remove the cache or smth

the bot restarted
No
Elaborate
How to check multiple events at the same time ?
whenever you start your bot, the cache is empty
!d discord.on_guild_channel_update is also there to update the cache (dpy should use that tbh)
discord.on_guild_channel_update(before, after)```
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
How do i add status to ma bot
Yes ik but why doesnt it see it sometimes even when the cache is ready
Ok so I want the bot to download all the old files that exists in a channel. Is it possible??
Wdym by status like game?
!d discord.Client.change_activity
Playing GAme or something
can't see the message, only the channels, members, and guilds (all of these depend on your intents)
yes
!s discord.Client.change_presence
!site
Can also use: s
Commands for getting info about our website.
Subcommands:
!site faq
Info about the site's FAQ page.
!site help
Info about the site's Getting Help page.
!site home
Info about the website itself.
!site resources
Info about the site's Resources page.
!site rules [rules]...
Provides a link to all rules or, if specified, displays specific rule(s).
!site tools
Info about the site's Tools page.
!d discord.ext.commands.Bot.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the clientβs presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter.
!d discord.Client.change_presence
Ffs I forgot that method tbh. What's happening to meeeee
the messages are added in the cache after the bot fully started
Yeah ik but sometimes weirdly it has all perms all everything but it just doesn't seem to find the id in the cache
what does the library cache π€ the instance?
yes
The Raw JSON most probably
idk what kind of discord bot to make
elaborate, that shouldn't happen if the bot didn't restart and if the bot is fully started
I mean, u can yourself make a TextChannel object by making raw requests. The class excepts the JSON dict and the bot's state, which would be available to you easily
Idk sometimes it happens to some people
must be their fault or something
i've never had that happen to me
so TextChannel.name could still show the wrong name if the cache isnt updated and they change the name?
Prob they never get deep to it so i assumed they did have all perms
or it can detect that stuff with some events?
This way u can store Discord Objects in a DB by storing their JSONs and making an object manually after calling a class
Same
!d discord.on_guild_channel_update bro
discord.on_guild_channel_update(before, after)```
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
no
oh
whenever something's edited (message/channel/guild/user/member/etc) the cache is also updated
oh
idk
Disnake broπ
u mean disnake? or dis-snek?
also afaik as ik its disnek
^^^1
No, dis-snek is also a thing haha
.
Best fork bro
disnake
disnake or dis-snek?
wait wait wait can someone link it
** AS SAID JUST CHANGE DISCORD TO DISNAKE BOOM YOU MIGRATED**
π€£that name gonna give disnake marketing
Dis-snekπ
!pypi disnake
Cool
idk where i had the link to that api wrapper with good looking docs
Ok so I want the bot to download all the old files that exists in a channel. Is it possible??
vsc code is epok
what did you download exactly from the internet
we told this guy to use disnake and somehow he ended up with dis-snek wtf
you probably downloaded a random exe
π
Discord bot Dashboard template pls bcz i am lazy
its a a repo called dis snek and its pretty good has some issues but not that bad
We are also lazy (:
Ok so I want the bot to download all the old files that exists in a channel. Is it possible??
No way thats actually a thing
Elaborate
you want the repo?
oh it was dis-snek almost forgot the name https://github.com/Discord-Snake-Pit/Dis-Snek
What else do i add to ma bot aaaaaaaaa
Didn't I tell u π€¦
So there are some jpeg and png files in a channel and I want to download them all
Lol EPok
As simple as that
A command to shut up someone
this
I am Bully Maguire
!d discord.TextChannel.history
it is
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destinationβs message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.
Examples
Usage...
maybe
Im jumping off a bridge
!d discord.Message.attachments
A list of attachments given to a message.
π π
no one here except you uses dis-snek even the syntax is different
Tysm
no no no let me jump first
Ok imma add the purge cmd
idk how
Ima just use a random wrapper like kermit.cord
Best discord api wrapper
what is Kermit.cord
help me
Best fork out there jk not a thing
have you tried mr.potato head its really nad
Yeah i have
......
so it was my extensions on phone that made it look good, it doesnt look that good now
π
@sullen shoal Not gonna question why your on discord with your browser
my bot sends a message 2 times whenever it is triggered
like on Hi and LMAO
oh yeah, running that electron shit is same as opening chrome so i forced myself to the browser version
@sullen shoal @slate swan
π
White theme ewwww
helpppppp
Why on event
And not commands if your using bot and not client
ikr
i m using bot
There is a thing called elif
so how
Then use commands
Is there a list somewhere of all the languages discord can highlight, and especially the py or python language indicators?
@bot.commands
ok so disnake is installed but when i try to run it it says no module named disnake
i hope they change the theme to smth like that
Weird
Try reinstalling
And maybe dpy too
how
elif is basically,
if ...:
else:
if ...:```
by using elif we can make it look good,
```py
if ...:
elif ....:```
know when trying to reinstall it i get this error
ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified: 'C:\\Python39\\Scripts\\chardetect.exe' -> 'C:\\Python39\\S
cripts\\chardetect.exe.deleteme'
if #if something blah blah
elif # else if
else: # else
Yes sir
thanks to python for making our life easier
still sends it twice
speak for yourself
anything else wrong
I love elifsπ
Restart the bot
!d str.lower
Or maybe just make them their own function without bot event
!d str.lower
str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to lowercase.
The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
He is using startswith for a reason
so?
finally it works
how do i add task loop to check for message in a channel
message.content.lower().startswith("..")
know to figure out how to add buttons
Goodπ
still sends twice
Dual hosting?
How can I give a role when a button is clicked?
I want to use it as a Verification System
Β―\_(γ)_/Β―
Thanks for telling elif tho
Np!
can something else be done to make it more simple
@bot.event
async def on_message(message):
if message.author == bot.user:
return
elif message.content.startswith('Hello'):
await message.channel.send('Hello Comrade')
elif message.content.startswith('Hi'):
await message.channel.send('Hi. Did ya nuke USA?')
elif message.content.startswith('Comrade'):
await message.channel.send('Shut Up Fool')
elif message.content.startswith('hello'):
await message.channel.send('Hello Comrade')
elif message.content.startswith('hi'):
await message.channel.send('Hi. Did ya nuke USA?')
elif message.content.startswith('comrade'):
await message.channel.send('Fuck You')
elif message.content.startswith('LMAO'):
await message.channel.send('You Dont Laugh In Russia')
if 'i solemnly swear that i am upto no good' in message.content.lower():
role = discord.utils.get(message.guild.roles, id=904021392998146118)
await message.author.add_roles(role)
elif 'mischief managed' in message.content.lower():
role = discord.utils.get(message.guild.roles, id=904021392998146118)
await message.author.remove_roles(role)
await bot.process_commands(message)
i whould also use commands lol


