#discord-bots

1 messages Β· Page 609 of 1

slate swan
#

.name or .owner?

#

.owner can be None if you dont have member intents

kindred epoch
#

f

#

is there any other way i can get the owners name?

slate swan
#

nah , you can get the id tho

kindred epoch
#

yes

slate swan
#

!d discord.Guild.owner_id

unkempt canyonBOT
steel oasis
#

and then just let it do this

kindred epoch
#

ty

lone aurora
#
    @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?
steel oasis
#

<@{discord.Guild.owner_id}>

kindred epoch
#

lmfao

#

this guy is making spam servers for my bot

#

πŸ˜‚

lone aurora
#
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

slate swan
#

oh nvm , do you have member.client somewhere>

lone aurora
#

nope

manic wing
#

@lone aurora

#

search for .client in your code

#

tell us what it shows

lone aurora
#

all other commands within the cog are working error free

sullen shoal
lone aurora
#

1 sec

#

wow ok im brain dead...

#
    def __init__(self, client):
        self.client = client```i forgot to add this..
steel oasis
#

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

slate swan
#

Either use slash commands or execute the command like

!compare "Username one" "Username two"

steel oasis
#

Will it work without changing the code like I can just go and try it with ""?

slate swan
#

Yes

#

However you might need to URL encode the spaces

steel oasis
#

What do you mean?

slate swan
#

Just try it

brittle ingot
#

severe deja vu

slate swan
#

And you shouldn't use requests

steel oasis
#

ok

brittle ingot
#

use aiohttp instead, as its asynchronous

steel oasis
#
,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

brittle ingot
#

instead of args and kwargs do: literal params.

#
async def compare(ctx, player1, player2):
    ... code

it will take: .compare player1 player2

brittle ingot
#

that's ur current code?

#

oh i gotcha

slate swan
#

Apparently it is

brittle ingot
#

are you in a cog? Good Name?

steel oasis
#

sorry i was afk

gaunt ice
#

guys..... i need halp, im trying to connect mongo db in my repl

steel oasis
#

;-;

gaunt ice
#

oki

brittle ingot
#

would offer some worthwhile help on that.

steel oasis
#
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

unkempt canyonBOT
#

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.

slate swan
#
> 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
steel oasis
slate swan
#

Why do you have so many spaces

steel oasis
brittle ingot
#

i think its their console. mine used to do that a lot on my chromebook

slate swan
steel oasis
slate swan
#

Same for player2 below

gaunt ice
#

i need halp with my mongo db connection pls halp anybody #databases

slate swan
#

Don't ask people here for help

#

Be patient and wait

gaunt ice
#

okk

slate swan
#

And you might want to ask a question there...

steel oasis
#

!paste

unkempt canyonBOT
#

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.

gaunt ice
#

ok

steel oasis
slate swan
#

You haven't changed anything

steel oasis
#

I change the stats.json to player1.json

slate swan
lone aurora
#
@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?
steel oasis
#
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
steel oasis
#

my space bar is broken i think

steel oasis
#

@brittle ingot you there?

steel oasis
#

!paste

unkempt canyonBOT
#

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.

steel oasis
brittle ingot
#

taking a look

steel oasis
gaunt ice
#

its not BotMissingPermissions ig

#

its just MissingPermissions

lone aurora
#

lemme try

#

nope didnt work

gaunt ice
#

hmmoki

lone aurora
#

in commands.MissingPermissions is there anything that can replace commands

gaunt ice
#
            em=discord.Embed(title='Error!', description=f"{error}.", colour=discord.Colour.red())```
slate swan
#

MissingPermissions is for @commands.has_permissions BotMissingPermissions is for @commands.bot_has_permissions

slate swan
gaunt ice
#
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)
slate swan
#

typehint the role arg to discord.Role so you dont need to get it

lone aurora
brittle ingot
#

what error prints to the console when there is a conflict with the roles position compared to the bots role.

lone aurora
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions ```
slate swan
brittle ingot
#

in laymens terms they mean. Assuming they don't know what typehinting is.

steel oasis
brittle ingot
brittle ingot
lone aurora
south bane
#

How to delete all the channels in a server?

gaunt ice
#

remove BotMissingPermissions

slate swan
#

!d discord.Guild.channels

unkempt canyonBOT
gaunt ice
slate swan
#

Loop through that and use .delete()

south bane
#

Ty

brittle ingot
# steel oasis Okok

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

gaunt ice
#

ye loop

slate swan
lone aurora
south bane
#

This command is a bit abusive tho-

gaunt ice
#

sry remove Bot from BotMissingPermissions , i meant

lone aurora
#

alr tried that

slate swan
#

And you should keep Bot

#

Since the bot can't give the role, not the user itself

brittle ingot
gaunt ice
south bane
#

Nah

gaunt ice
#

hm

south bane
#

Just asking xd

gaunt ice
#

XD

slate swan
#

Good days guys yert

#

ola

steel oasis
brittle ingot
# gaunt ice nuking ofc lul

yeh we don't help with that stuff, anytime anyone asks for that stuff we need to make sure their intentions are correct.

steel oasis
#

the entire json thing

gaunt ice
#

oop

gaunt ice
slate swan
brittle ingot
slate swan
slate swan
south bane
#

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.

steel oasis
lone aurora
brittle ingot
#

correct.

steel oasis
slate swan
slate swan
south bane
slate swan
south bane
#

I thought it was private

slate swan
brittle ingot
slate swan
#

Thats why:
Replit = bad

brittle ingot
#

lol

south bane
slate swan
#

Vsc = Good

gaunt ice
lone aurora
#

is it possible for the bot to send a message in case there's ANY error?

slate swan
south bane
lone aurora
#
@role.errror
async def role_error(ctx, error):
    if isinstance(error, commands.WhatToAddHere):```
slate swan
#

Just remove the if-statement and send a message

south bane
#

3 r's

gaunt ice
#

remove that 'if' line and add 'await ctx.send("Error!")'

slate swan
#

Not all errors are of this type

#

Just remove the if check

gaunt ice
#

yes

slate swan
#

And send the message straight up

south bane
#

errors.Forbidden deals with all the roles and perm thing

slate swan
#

in case there's ANY error?

brittle ingot
lone aurora
#

well this is working, might as well go with any type of error

gaunt ice
#

oof

slate swan
#

I suggest to look at error handlers in docs

lone aurora
south bane
#

Just use try except

slate swan
#

ew

gaunt ice
#
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)```
slate swan
#

ah yes

#

spammy floody

gaunt ice
#

this is my error handler

#

.....

slate swan
#

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 shrug

gaunt ice
#

im......

slate swan
#

Bro why do kids be hating on vsc for not being able to host like replit yert

lone aurora
#
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
slate swan
#

They call vsc bad cause of that reason

gaunt ice
#

they like free stuff

slate swan
#

Did i ever state your name lmfao

slate swan
south bane
#

Vsc is a text editor or sometimes ide while replit is texteditor,ide aswell as hoster

slate swan
#

I mever pointed my opinion at anybody

slate swan
slate swan
gaunt ice
#

he mever pointed on anybod

lone aurora
slate swan
#

It's a source code editor

#

That has ide-like features

slate swan
south bane
#

Nah

gaunt ice
south bane
#

Pycharm is only for community

lone aurora
gaunt ice
#

naw cap

south bane
#

Pycharm provides community support

gaunt ice
#

pycharm kooler than vsc

slate swan
#

Vsc == pycharm

gaunt ice
#

how so piro

south bane
#

The only reason it has an edge over vsc is because of enterprise support and that too the community version needs u to pay

gaunt ice
#

ye

south bane
#

Community more like enterprise

slate swan
slate swan
#

You're saying you need to pay for community?

south bane
#

No

gaunt ice
#

na u dont

south bane
#

The enterprise i meant

slate swan
#

Pycharm is morw for experienced programmers

south bane
#

Pycharm professional

#

I had to edit

slate swan
#

Thanks

south bane
#

If your working as a team then u go for pycharm

slate swan
#

Needed that

slate swan
slate swan
#

What matters are the tools you use outside of your IDE

#

Yall all trash i use notepad😎 yert

south bane
#

Yes

slate swan
#

nano > notepad KEKW

slate swan
#

hell yeah

gaunt ice
#

ew

slate swan
#

Ain't this lovely

#

I use notepad and windows vista

maiden fable
slate swan
#

Yeah realized that thanks

#

Talking about IDEs for bot development

#

And nano is definitely the best

slate swan
slate swan
#

imagine hating over nano

slate swan
gaunt ice
slate swan
maiden fable
gaunt ice
#

my english badbad

slate swan
maiden fable
slate swan
gaunt ice
slate swan
lone aurora
#

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

lone aurora
#
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)```
slate swan
#

if role1 not in ctx.author.roles

maiden fable
#

Oh, hmm

#

Yea

gaunt ice
#

ye

maiden fable
#

Or why not just do get(ctx.author.roles, name=role)

#

😐

slate swan
#

:kek:

slate swan
south bane
#

Isnt that obvious huh?

slate swan
slate swan
slate swan
gaunt ice
#

or if role1 != ctx.author.roles:

slate swan
lone aurora
gaunt ice
#

im bad at typing

slate swan
lone aurora
slate swan
slate swan
gaunt ice
#

nvm

#

well

#

does anybody know how to check whether a user is having mutual guilds as me

slate swan
#

Selfbottum moment?

slate swan
slate swan
quick gust
#

yes it has it in the docs

gaunt ice
#

its there in the docs

quick gust
#

Read them

gaunt ice
#

but idk how to implement them

slate swan
gaunt ice
slate swan
#

y'all still on the outdated dpy??

quick gust
#

but mutual guilds was deprecated in v1.7

gaunt ice
slate swan
#

oh yeah surprisingly it is still there

gaunt ice
#

C:

slate swan
#

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

quick gust
slate swan
#

and surprisingly it still works

quick gust
#

Oh

gaunt ice
slate swan
#

its in every repl

slate swan
#

How do you even use those property stuff and what is it never used them before

gaunt ice
slate swan
#

Bruh😭

#

you can't change the value of a property

#

unless you make a setter for it

#

I seejam_cavedude

#

and unlike an attribute, you can add some code in the property

slate swan
patent surge
#

How do I invoke command by an url ?

slate swan
quick gust
slate swan
patent surge
slate swan
#

wdym

#

U need to make an api

slate swan
#

Just gonna say it
disnake > any forkyert

patent surge
slate swan
patent surge
#

I want like this

slate swan
#

Disnake or .py 2.0?

slate swan
slate swan
slate swan
patent surge
slate swan
slate swan
slate swan
#

Does it have slash?

#

yes

slate swan
#

has slash since day one

slate swan
gaunt ice
slate swan
#

let me try disnake

slate swan
#

To change libraries can i just install via pypi and then change import and everything else same?

#

if im disapointed its your fault

unkempt canyonBOT
#

@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

slate swan
#

what

gaunt ice
#

oof

unkempt canyonBOT
#

@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

gaunt ice
#

oof

slate swan
#

Click on top right of the website

#

πŸ€”

quick gust
#

I should probably check this myself but, will everything change from discord to disnake if I switch to disnake? for example

embed = disnake.Embed()```
slate swan
#

Or juat import disnake as discord which is bad pratice so noyert

#

There's a discord button

#

And you get to the server

#

or yeah use the docs to join

quick gust
#

Okay cool

slate swan
#

You have to change everything from discord to disnake everything

quick gust
#

pain

slate swan
#

And youll be good

#

Oh thats gay

#

Search replace bravemmlol

#

how do i import dissnake

slate swan
#

import disnake

quick gust
slate swan
quick gust
slate swan
#

disnake* please

#

@slate swan what version of disnake you use?

#

And make it case sensitive

slate swan
#

then it won't change

slate swan
#

Tbh it is trivial

#

Its just annoying

slate swan
#

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?

slate swan
slate swan
slate swan
slate swan
#

for example in disnake when you edit a message all params are kwargs, content isn't an arg anymore but a kwarg basically

gaunt ice
#

who knows to connect mongo db better here

slate swan
#

Whats a kwarg

#

keyword argument

slate swan
#

blah=blah

gaunt ice
#

oof

slate swan
#

Lmao

#

Whats a keyword argument

slate swan
#

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

arctic python
slate swan
#

^

#

So if i normally do arg = None for example thats a kwarg already?

#

no, you're just giving it a default value

arctic python
#

So when you call function like some_func(param=value), that's a keyword argument.

slate swan
arctic python
#

As opposed to some_func(value), which is a positional argument.

slate swan
#

I still dont get it tbh

#

Oh wait

#

There

#

Is it based on the function?

slate swan
#

Explained more in depth

arctic python
slate swan
#

I get it now

#

Thanks

sullen shoal
#

i dont think they did tbh

slate swan
#

im trying to import disnake but it wont install

#

explain

quick gust
#

what does it say?

#

did u do python -m pip install disnake?

slate swan
#

yes

sullen shoal
#

are you mac user

slate swan
#

it says package dosent exist

slate swan
quick gust
#

uh

slate swan
#

Mac is sexy

slate swan
quick gust
#

u sure u spelled it correctly?

sullen shoal
#

do python --version

quick gust
#

disnake and not dissnake

slate swan
#

Try pip3

sullen shoal
slate swan
#

Or Disnake

slate swan
slate swan
sullen shoal
#

oh im doing well

#

hbu

slate swan
slate swan
sullen shoal
#

nice

slate swan
#

Yup

#

oops

#

3.18.12

sullen shoal
#

hm

slate swan
#

?

sullen shoal
#

show the terminal output

#

cant trust you

slate swan
#

3.18?

#

Fr

#

He got future python

#

Hes from the future

#

πŸ˜‚ πŸ˜‚ πŸ˜‚

quick gust
#

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'```
slate swan
#

that's a dpy 2.0 breaking change

quick gust
#

o h

slate swan
#

self.context.clean_prefix

quick gust
#

and self.context.invoked_with?

slate swan
#

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

slate swan
slate swan
sullen shoal
quick gust
slate swan
sullen shoal
#

so you dont wanna show the error or what

slate swan
#

i can if you want

slate swan
sullen shoal
#

do it

slate swan
quick gust
#

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
sullen shoal
#

bro

slate swan
slate swan
#

What dimension are you onπŸ’€

#

πŸ’€

#

How do i insert bot token in Vsc in replit i went to secrets and did it

#

Dissnek😭

#

πŸ˜‚

quick gust
#

TOKEN = "yourtokenhere"

quick gust
#

thats literally

slate swan
quick gust
#

so goddamn basic

slate swan
#

token value

slate swan
sullen shoal
#

actually there is a discord api wrapper named disnek

#

which isn't a fork

slate swan
slate swan
#

Just copy paste your token cause its private unlike replit

quick gust
#

does disnake have buttons lol?

slate swan
quick gust
#

oh

slate swan
#

Theirs examples in the git

south bane
#

Why would u use disnake?

slate swan
sullen shoal
#

why not

slate swan
#

But u might aswell copypaste

south bane
#

When dpy 2.0 provides u buttons?

slate swan
#

Also i dunno if vsc will read directly from windows env variables

sullen shoal
#

dont tell me you use those crap old extensions for discord.py

south bane
#

Huh

slate swan
south bane
#

Just use ui.View

slate swan
slate swan
quick gust
sullen shoal
#

discord.py will die once discord forces everyone to use slash commands

south bane
slate swan
quick gust
slate swan
slate swan
south bane
#

No way

quick gust
slate swan
slate swan
south bane
#

No.

quick gust
#

got it

sullen shoal
#

pycord changed the path of Bot

quick gust
#

ty

slate swan
slate swan
# south bane No.

yes stop being such a simp for that yt guy that made vids about pycord lmao πŸ˜‚ πŸ˜‚

slate swan
#

more popular != better

slate swan
sullen shoal
#

freecodecamp bad

slate swan
sullen shoal
slate swan
#

@sullen shoal hates freecodecamp to death

#

it got moved to an organisation from EQ

south bane
#

Damn

#

Whatever...

slate swan
#

πŸ˜‚ πŸ˜‚

#

^

slate swan
#

bad

#

pip install dis-snek

slate swan
south bane
#

Did they ever make a video on pycord?

#

Anyway?

slate swan
sullen shoal
#

lol this guy likes freecodecamp

slate swan
slate swan
#

Docs > any tutorialyert

#

^^

sullen shoal
#

although theres one thing even worse than freecodecamp, wait i gotta find thr link

slate swan
#

Lucas?? πŸ’€ πŸ’€

slate swan
#

πŸ˜‚ πŸ˜‚

#

Its always the lucas simps😭

sullen shoal
#

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...

β–Ά Play video
slate swan
#

oh damn

slate swan
#

You cant call that even programming more like a game or a puzzle

#

something wrong

#

at the end

slate swan
#

the token is None

slate swan
slate swan
sullen shoal
#

bro its gonna be 2 days and you're still stuck with those 35 lines

slate swan
#

Like of the terminal

#

wont show the whole token

sullen shoal
#

uh

slate swan
#

m8 you just showed like 99.99% of it

sullen shoal
#

you exposed the main part of it

slate swan
#

Just do bot.run("your token")

#

.

#

the main part is the one after the 2nd dot where it's discord's HMAC

sullen shoal
#

now go change your token

south bane
#

And what the fuck is keep_alive

slate swan
sullen shoal
#

replit thing

slate swan
south bane
#

Replit in vsc

#

?

slate swan
#

I have no idea what does numbers are for

slate swan
#

what numbers

slate swan
sullen shoal
#

you have to run a webserver along with your discord bot to host your bot there

south bane
sullen shoal
slate swan
south bane
#

?tag rule 11

novel apexBOT
#

This is not a Modmail thread.

slate swan
#

oh that, it's his local server

#

pretty sure that is his ip actually

#

his provider's ip

south bane
#

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.
slate swan
#

Thats basically his city

#

yep πŸ’€

jaunty terrace
#

is aiohttp faster than requests?

slate swan
jaunty terrace
#

i'm trying to make my anti-nuke faster and idk what to use

slate swan
#

i keep shifting between 3diff countries

#

While requests isnt

slate swan
quick gust
#

πŸ’€

jaunty terrace
#

okay but is there anything faster than requests?

slate swan
south bane
#

So your coding in vscode and linking it to replit?

safe turtle
#

does anyone know if theres a way to make a discord bot create/edit/delete events?

slate swan
jaunty terrace
slate swan
south bane
#

Oh-

quick gust
south bane
#

Ic

slate swan
#

i will host it on google cloud or mesoku

slate swan
#

@slate swan bro your coding your bot in vsc and hosting it in replit 😭

safe turtle
#

no this kind of event

slate swan
#

imma do it rn

slate swan
slate swan
safe turtle
#

oh ok thanks

jaunty terrace
#

thought so

safe turtle
maiden fable
#

It's still a new feature

jaunty terrace
#

ohh

slate swan
#

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

maiden fable
#

Gonna be implemented in disnake soon

slate swan
#

Disnake is just to goodπŸ€·β€β™‚οΈ

maiden fable
#

True

slate swan
#

ikr

jaunty terrace
#

ahead of everyone

slate swan
#

Other forks just cant keep upyert

maiden fable
#

Lmao true

jaunty terrace
#

keyword forks

patent surge
#

I want to use the 'click here' Button yo invoke a command rather than url. How can I do this any idea ?

slate swan
#

so should i just host it on heroku

slate swan
#

Replit and heroku = bad

slate swan
south bane
slate swan
slate swan
patent surge
slate swan
slate swan
south bane
#

Send a link to disnake server in dms @slate swan

slate swan
#

i dont have any other free option tho

slate swan
slate swan
#

Sadly

hazy canopy
#

Hi! How can i get the user # numbers with python?

slate swan
hazy canopy
#

just discord

jaunty terrace
#

!d discord.User.discriminator

unkempt canyonBOT
jaunty terrace
#

???

maiden fable
#

Yea this

quick gust
#

I have now switched to disnake and am officially a part of the cool gang

slate swan
#

😎

quick gust
#

surprisingly there weren't any breaking changes

jaunty terrace
#

i only won't switch to disnake cuz i'm to used to writing discord.Embed

quick gust
#

except 1

jaunty terrace
#

and discord.Member

quick gust
#

bro

#

that's the reason....

#

ok..

jaunty terrace
#

disnake.Embed is weird idk

jaunty terrace
#

disthon.Embed isn't to bad

quick gust
sullen shoal
sullen shoal
#

you can use select menu tho

patent surge
#

yeah

#

How will I manage Buttons and Select Menu both at a time ??

sullen shoal
#

what lib you using

patent surge
#

Dislash

sullen shoal
#

idk then

patent surge
#

ah shit

sullen shoal
#

here we go again

maiden fable
sullen shoal
#

tbh they could just replace import discord with import disnake

south bane
#

@maiden fable slash commands are "released" in disnake?

slate swan
#
 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

sullen shoal
#

then from discord to from disnake

maiden fable
#

Node.js

south bane
#

They are quite fast

slate swan
sullen shoal
#

i dont help replit people so gotta stay away

south bane
#

Yes

#

Same

slate swan
#

i wouldnt be useing replit right know if it werent for the fact that my python IDE insnt detecting 3.10

maiden fable
slate swan
# south bane They are quite fast

it's been in the stable ever since it was released and already fully supported slash groups and subcommands, and in cogs too πŸ’€

slate swan
#

although back then the way you added options was kinda shit, now it's a lot better

south bane
#

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.

slate swan
#

heroku >>> replit

south bane
#

Both are shit

slate swan
#

Yes

sullen shoal
#

when i was a kid, i used replit for once, both times as soon as i ran it, i got rate limited lol

south bane
#

But yea i agree heroku is better

maiden fable
#

I never got ratelimited with replit tbh

sullen shoal
#

i got ratelimited twice as soon as i ran it

maiden fable
#

Lmao

#

Seems like I was just lucky

sullen shoal
#

yep

slate swan
#

Dang

#

I jumped from the python idle to vsc so dont know much about replit

sullen shoal
#

i had some idea to code that day but couldnt rip

south bane
#
  • 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.

south bane
#

Xd

slate swan
#

Bro i know how to do cogs but i see them terrifying for a reason

maiden fable
#

!d discord.ext.commands.Bot.wait_for @patent surge

unkempt canyonBOT
#

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**...
slate swan
dapper cobalt
#

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.

slate swan
dapper cobalt
slate swan
#

bad

#

can't even run my bot at all on it

dapper cobalt
#

You've tried it before?

slate swan
#

even tried the most expensive pack

sullen shoal
#

i tried some discord hosts that rich kids run, they provide like 20 percent cpu usage and some bit of ram

slate swan
#

couldn't get my bot to run

slate swan
#
  • it also asks you to stay on some shitty page to get some coins
#

heroku doesn't

dapper cobalt
patent surge
slate swan
dapper cobalt
maiden fable
#

No, u need multiple wait_for then

patent surge
#

But for multiple wait_for it will check one after one

slate swan
#

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?

patent surge
#

I want to check different events at same time

slate swan
#

what bot command should i add

maiden fable
sullen shoal
slate swan
slate swan
maiden fable
#

get_channel is looked up by ID

#

And not name

slate swan
#

when you close the bot you kill the cache

patent surge
#

How to check multiple events at the same time ?

slate swan
#

whenever you start your bot, the cache is empty

maiden fable
#

!d discord.on_guild_channel_update is also there to update the cache (dpy should use that tbh)

unkempt canyonBOT
#

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.
slate swan
#

How do i add status to ma bot

slate swan
tiny ibex
#

Ok so I want the bot to download all the old files that exists in a channel. Is it possible??

slate swan
maiden fable
slate swan
slate swan
#

yes

jaunty terrace
#

!s discord.Client.change_presence

unkempt canyonBOT
#
Command Help

!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.

maiden fable
#

!d discord.ext.commands.Bot.change_presence

unkempt canyonBOT
#

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.
jaunty terrace
#

!d discord.Client.change_presence

maiden fable
#

Ffs I forgot that method tbh. What's happening to meeeee

slate swan
slate swan
sullen shoal
maiden fable
jaunty terrace
#

idk what kind of discord bot to make

slate swan
maiden fable
#

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

slate swan
slate swan
#

i've never had that happen to me

sullen shoal
#

so TextChannel.name could still show the wrong name if the cache isnt updated and they change the name?

slate swan
sullen shoal
#

or it can detect that stuff with some events?

maiden fable
#

This way u can store Discord Objects in a DB by storing their JSONs and making an object manually after calling a class

slate swan
maiden fable
unkempt canyonBOT
#

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.
sullen shoal
#

oh

slate swan
#

whenever something's edited (message/channel/guild/user/member/etc) the cache is also updated

sullen shoal
#

oh

maiden fable
#

Yea

#

That's why there are events

slate swan
#

Thats cool

sullen shoal
#

idk

slate swan
maiden fable
#

u mean disnake? or dis-snek?

sullen shoal
#

also afaik as ik its disnek

slate swan
#

^^^1

maiden fable
#

No, dis-snek is also a thing haha

slate swan
slate swan
maiden fable
slate swan
#

wait wait wait can someone link it

#

** AS SAID JUST CHANGE DISCORD TO DISNAKE BOOM YOU MIGRATED**

maiden fable
#

🀣that name gonna give disnake marketing

slate swan
slate swan
unkempt canyonBOT
slate swan
#

I gave ma bot a status with no errors

#

like how

maiden fable
slate swan
#

Impossible

#

ive been useing dis-snek

sullen shoal
#

idk where i had the link to that api wrapper with good looking docs

slate swan
tiny ibex
#

Ok so I want the bot to download all the old files that exists in a channel. Is it possible??

slate swan
#

we told this guy to use disnake and somehow he ended up with dis-snek wtf

#

you probably downloaded a random exe

tired ravine
#

Discord bot Dashboard template pls bcz i am lazy

slate swan
maiden fable
slate swan
#

wait scratch that

tiny ibex
#

Ok so I want the bot to download all the old files that exists in a channel. Is it possible??

slate swan
sullen shoal
slate swan
#

What else do i add to ma bot aaaaaaaaa

tiny ibex
tiny ibex
#

As simple as that

maiden fable
slate swan
maiden fable
slate swan
unkempt canyonBOT
#

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...
slate swan
#

maybe

slate swan
maiden fable
#

!d discord.Message.attachments

unkempt canyonBOT
slate swan
#

πŸ˜‚ πŸ˜‚

sullen shoal
#

no one here except you uses dis-snek even the syntax is different

tiny ibex
#

Tysm

slate swan
#

Ok imma add the purge cmd

#

idk how

#

Ima just use a random wrapper like kermit.cordyert

#

Best discord api wrapper

tiny ibex
#

what is Kermit.cord

slate swan
slate swan
slate swan
slate swan
tiny ibex
sullen shoal
#

so it was my extensions on phone that made it look good, it doesnt look that good now

slate swan
#

@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

sullen shoal
slate swan
slate swan
#

helpppppp

slate swan
#

And not commands if your using bot and not client

sullen shoal
slate swan
tiny ibex
slate swan
#

so how

slate swan
#

Is there a list somewhere of all the languages discord can highlight, and especially the py or python language indicators?

slate swan
slate swan
#

ok so disnake is installed but when i try to run it it says no module named disnake

sullen shoal
#

i hope they change the theme to smth like that

slate swan
#

Uninstall dis-snek

#

Maybe it will work

tiny ibex
#

And maybe dpy too

slate swan
tiny ibex
#

Β―\_(ツ)_/Β―

sullen shoal
#

elif is basically,

if ...:
else:
    if ...:```
by using elif we can make it look good, 
```py
if ...:
elif ....:```
slate swan
#

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'
slate swan
tiny ibex
sullen shoal
#

thanks to python for making our life easier

slate swan
#

still sends it twice

slate swan
#

anything else wrong

slate swan
tiny ibex
dapper cobalt
#

!d str.lower

slate swan
#

Or maybe just make them their own function without bot eventpithink

dapper cobalt
unkempt canyonBOT
#

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.
tiny ibex
sullen shoal
slate swan
#

finally it works

cobalt jacinth
#

how do i add task loop to check for message in a channel

dapper cobalt
slate swan
#

know to figure out how to add buttons

tiny ibex
slate swan
tiny ibex
slate swan
#

How can I give a role when a button is clicked?
I want to use it as a Verification System

slate swan
#

-_-

tiny ibex
slate swan
tiny ibex
slate swan
#

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