#discord-bots

1 messages · Page 592 of 1

opaque plinth
#

and enable presence intent in your developer portal

#

yes

#

Np :)

south pewter
#

Hello!
Got a lil' Problem with a Bot I'm making. For whatever reason the Code I'm running locally isn't running the latest version of the code.

Like, I straight up deleted multiple lines of code, yet it still runs them, even on a seperate machine that never saw that code before.

Any help-?

maiden fable
#

Try resetting your token once

maiden fable
#

???

south pewter
maiden fable
#

Tf

south pewter
#

Yeah. Reason I'm extremely confused as well.

maiden fable
#

Well

#

Wait, wym by code running locally?

south pewter
#

On my PC, for testing.

maiden fable
#

You running the code somewhere else too?

south pewter
#

Nope.

maiden fable
#

You are in one weird position

jade tartan
#
async def on_member_join(member, ctx):
        guild = client.get_guild(730651046459998218)
        channel = guild.get_channel(885464532959526913)
        myEmbed = discord.Embed(title = f"Welcome",
        description= f"You are member {guild.member_count}, \n Enjoy your stay here and dont forget to read the await #rules", color=0x0ff00)
        myEmbed.set_image(url=f"{member.avatar_url}")
        await channel.send(embed=myEmbed)
        autorole = discord.utils.get(member.guild.roles, name='Unverified')
        roles =  discord.utils.get(ctx.guild.roles,name= "•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•")
        roles =  discord.utils.get(ctx.guild.roles,name= "•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•")
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

maiden fable
#

@south pewter uhhhhh

jade tartan
#

sorry i am just sending my code and then my error

boreal ravine
#

on_member_join only takes 2 params

jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord.py\bot.py", line 65, in on_member_join
    json.dump(users, f, intent=4)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 173, in dump
    iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
TypeError: JSONEncoder.__init__() got an unexpected keyword argument 'intent'```
maiden fable
#

U sure u running the correct files?

jade tartan
#

yes

reef shell
south pewter
boreal ravine
reef shell
#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
maiden fable
south pewter
#

Yep.

#

All my other pals got no idea either. Dunno what else I could even try.

maiden fable
#

I mean, u have even tried to reset the damn token

jade tartan
#
@client.event
async def on_member_join(member, ctx):
        guild = client.get_guild(730651046459998218)
        channel = guild.get_channel(885464532959526913)
        myEmbed = discord.Embed(title = f"Welcome",
        description= f"You are member {guild.member_count}, \n Enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)", color=0x0ff00)
        myEmbed.set_image(url=f"{member.avatar_url}")
        await channel.send(embed=myEmbed)
        autorole = discord.utils.get(member.guild.roles, name='Unverified')
        roles =  discord.utils.get(ctx.guild.roles,name= "•.¸¸.•:Verification:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•")
        roles =  discord.utils.get(ctx.guild.roles,name= "•.¸¸.•:Age:•.¸¸.•``•.¸¸.•``•.¸¸.•``•.¸¸.•")
Ignoring exception in on_member_join
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\Desktop\discord.py\bot.py", line 65, in on_member_join
    json.dump(users, f, intent=4)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 173, in dump
    iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
TypeError: JSONEncoder.__init__() got an unexpected keyword argument 'intent'
maiden fable
#

indent*

#

Not intent

#

Lol

reef shell
#

Nice role name

jade tartan
south pewter
reef shell
south pewter
#

Reinstalled Python too.

boreal ravine
maiden fable
jade tartan
#

wdym

#

I dont have any nsfw

boreal ravine
#

Dating servers are against discord's tos

south pewter
jade tartan
#

with their own discord bot

maiden fable
boreal ravine
maiden fable
#

Having a discord bot doesn't tell that if a server is against ToS or not, since discord doesn't have access to the underlying code

jade tartan
south pewter
jade tartan
#

nvm

maiden fable
south pewter
#

Sure!

tawdry perch
#

Discord bots are again a bit fun when I got it to server to test some features

slate swan
#

Is it possible to mix discord bot with speech recognition and pytts3

maiden fable
#

Nope, since dpy won't have Voice Receive

#

But if u mean to use message content for that then sure

slate swan
#

huh

fresh crystal
#

hii

boreal ravine
#

👋

slate swan
boreal ravine
slate swan
#

how does the bot do that then?

boreal ravine
#

i mean

#

doesn't say anything about receiving voice

tiny ibex
#

Can someone tell me how lavalink works??

maiden fable
slate swan
maiden fable
#

Well yea

#

Nextcord has implemented it

slate swan
#

i see , thanks

tiny ibex
slate swan
#

not disnake?

#

lol

maiden fable
#

Nope, not en

#

Rn***

tiny ibex
#

Hmm

slate swan
#

Hello, can someone please tell me how to get a list of all membersids that reacted to a message? (discord.py)

maiden fable
#

!d discord.Message.reactions

unkempt canyonBOT
maiden fable
#

U gotta iterate

slate swan
#

It gives me this [<Reaction emoji=':tada:' me=False count=1>], how to get the members from it

maiden fable
#

Yea

#

!d discord.Reaction.users

unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Examples

Usage

```py
# I do not actually recommend doing this.
async for user in reaction.users():
    await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
slate swan
#

I tried reaction.users() and it gave me this: <discord.iterators.ReactionIterator object at 0x7f2eb53589a0>

maiden fable
#

Yea

#

U gotta iterate asynchronously

slate swan
#

Should I do this? ```py
for reaction in message.reactions:
users.append(await reaction.users().flatten())

#

you cannot get users for a reaction without awaiting xd

#

they are same either way

#

uh

slate swan
#

shouldn't i use that then?

#

both are same

#

what are the same

#

async for user in reaction.users()
is same as py await reaction.users().flatten()

maiden fable
#

Yea

#

Second one is recommend

tiny ibex
boreal ravine
#

!pypi nextcord

unkempt canyonBOT
tiny ibex
#

It's a fork which supports it ig

#

So I am asking for the fork's git repo

boreal ravine
boreal ravine
tiny ibex
boreal ravine
tiny ibex
tiny ibex
boreal ravine
tiny ibex
#

It'd be great if you can link the documentation about this shit

boreal ravine
tiny ibex
#

Well is there any other repo which supports it too?

boreal ravine
tiny ibex
boreal ravine
tiny ibex
#

😑

boreal ravine
tiny ibex
#

Any code examples or anything like that

boreal ravine
#

it's still in review

tiny ibex
tiny ibex
boreal ravine
tiny ibex
#

Any other ready to use repository?

boreal ravine
tiny ibex
#

¯\_(ツ)_/¯

slate swan
#

use on_message event , and check if the bot is mentioned in the message

#

!d discord.User.mentioned_in

unkempt canyonBOT
shadow wraith
#

hey could someone show me an example of a on_reaction_add and on_reaction_remove event

because im having issues trying to get my bot to send a message when someone has reacted to any message

unkempt silo
#

hey, quick question
can we click a button using request, like we can send msgs using authentication ?

slate swan
shadow wraith
#

ye but how do you send a message in an event

#

can you still use ctx

#

wait lemme try that

unkempt silo
slate swan
#

why would you be using context ?

#

when its not even defined

shadow wraith
slate swan
boreal ravine
#

!d discord.ClientUser.mention_in

#

!d discord.ClientUser.mentioned_in

unkempt canyonBOT
slate swan
#

client.user.mentioned_in

#

also , it works even if someone pings everyone so take care about it

shadow wraith
#
@bot.event
async def on_reaction_remove(ctx, reaction, user):
    channel = reaction.message.channel
    await ctx.channel_send(channel, '{} has reacted with {} to the message content of:  {}'.format(user.name, reaction.emoji, reaction.message.content))```
me trying to figure out something be like
loud junco
#

how do i print user's name

shadow wraith
#

oh lol

shadow wraith
slate swan
#

a better way to do that is py if bot.user in message.mentions

upbeat otter
#

Guys, how do I delete a command used by a member like if they write !add rolename it should only delete that message and not some other message

slate swan
shadow wraith
slate swan
shadow wraith
#

then how do i send a message

#

😔

slate swan
#

the channel variable you defined and send

#

!d discord.TextChannel.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
shadow wraith
#

oh you mean that

#

im being stupid so i thought you mean

loud junco
#

how can i make it HydroRICO_1209 instead of HydroRICO_1209#8868

shadow wraith
loud junco
#

just catto dont understand python

proud island
shadow wraith
#

but mentioning def removes the tag

#

btw sarthak i got an error @slate swan
await channel.send(channel, '{} has reacted with {} to the message content of: {}'.format(user.name, reaction.emoji, reaction.message.content))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord_components/client.py", line 48, in send_component_msg_prop
return await self.send_component_msg(ctxorchannel, *args, **kwargs)
TypeError: send_component_msg() takes from 2 to 3 positional arguments but 4 were given

#

ik its the reaction.crap and stuff but how do you get the information about the message then 🥺

loud junco
proud island
#

no prob

slate swan
#

read the embed that bot sent above , your code is outdated

shadow wraith
#

oh

#

i dont use classes btw

#

i just use the simple version

slate swan
#

thats not related to class anyways

maiden fable
#

.....?

slate swan
#

and you dont use anything in python without classes xd

maiden fable
#

Bro Spooshed, why do u think your code is related to classes tho 😐

maiden fable
shadow wraith
slate swan
maiden fable
shadow wraith
#

i dont use classes when making a discord.py bot just saying all crap and formatting is different when you do

#

just to make things and examples clear i said it? no tantrum over this alr?

slate swan
#

what makes it related to classes

shadow wraith
#

nah dawg dont throw a tantrum over this im just saying

slate swan
#

oh , do you mean cogs by class?

shadow wraith
#

i dont use cogs or classes :c i dont want alt versions of my bot running

slate swan
#

cogs aint meant to run different versions of your bot

shadow wraith
#

it can be used to load different languages which is kinda cool :P

slate swan
#

no?

shadow wraith
#

i mean if you make the cog file translated lmao

slate swan
#

!d discord.ext.commands.Cog

unkempt canyonBOT
#

class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.

A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.

When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
slate swan
#

it would always be pythonic

shadow wraith
#

i did try running cogs

#

apparently it always runned the cog first lmao and i didnt pay attention to the os path which was mentioning the file not the folder itself lmao

slate swan
#

depends on how you designed your code

#

if it loads the cogs before starting the bot , it will do the same
if you do that in some on_ready event or something it happens after the bot runs

shadow wraith
#

i originally thought loading extensions through cogs wasn't possible since it's already in an extension

shadow wraith
#

gtg now cya

maiden fable
#

@slate swan

#

just change the decorator from bot.event to bot.listen()

slate swan
#

i just do py [perm[0] for perm in member.guild_permissions if perm[1]]

maiden fable
#

😂🤣

#

Ikrrrrrr

#

Wait

slate swan
#

i mean , who makes a list of all the permissions

maiden fable
#

guild_permissions returns a dict

#

Shouldn't u first convert it to items()?

slate swan
maiden fable
slate swan
maiden fable
#

But does things on the backend

slate swan
simple kettle
slate swan
#

or just use jishaku

supple thorn
simple kettle
#

Oh

slate swan
#

!pypi jishaku

unkempt canyonBOT
maiden fable
slate swan
#

wait imma show

maiden fable
#

Weird

#

I thought it returned a dict like perm: True/False

patent surge
#

Command throws error for user id type argument

maiden fable
#

Member*

#

Capital M

boreal ravine
maiden fable
#

Yea

slate swan
#

[1] is the index of the perm tuple which is a bool

maiden fable
boreal ravine
maiden fable
#

Breh, dpy confuses me sometimes

slate swan
boreal ravine
maiden fable
#

Forgot it's implementing the dunder methods for looping so that it loops through dict.items()

slate swan
#

its just returning the object , try ctx.send()

boreal ravine
patent surge
maiden fable
slate swan
#

looks like you need to iterate anyways

slate swan
#

yea the dunder/magic methods

#

How do i make my bot leave a guild with its id?

dense swallow
#

how to get command signature for the commands in a cog (discord.ext.commands.HelpCommand)?

maiden fable
unkempt canyonBOT
#

await leave()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Leaves the guild.

Note

You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.delete "discord.Guild.delete").
maiden fable
unkempt canyonBOT
slate swan
dense swallow
#

cog.get_commands.get_command_signature?

maiden fable
visual island
#

get_all_commands is a function

maiden fable
#

!d discord.ext.commands.Cog.get_commands

unkempt canyonBOT
dense swallow
visual island
#

oh wait its get_commands

maiden fable
#

Yea

#

Too much disthon for the day?

waxen granite
#

How do i get epochtime?

maiden fable
#

!d time.time

unkempt canyonBOT
#

time.time() → float```
Return the time in seconds since the [epoch](https://docs.python.org/3/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.

Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
gaunt herald
#

is there any command in @unkempt canyon for discord music bot

#

tell me pls

waxen granite
#

No

gaunt herald
#

oops

#

sad

gaunt herald
#

show ppls

maiden fable
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
gaunt herald
#

youtube_dl?

maiden fable
#

That's used to make a discord music bot (:

ornate lichen
#
@command.error
async def on_message_error(ctx, error):
    if isinstance(error, discord.ext.commands.errors.CommandNotFound):
        await ctx.send("Unknown command")```
#

how do i fix this

gaunt herald
#

i tried it but it take lot of times to download video and after downloadinng music not playing

ornate lichen
#

im not sure what to put at the @

maiden fable
#

U need to use the global handler

gaunt herald
#

try with @quaint axle.event

maiden fable
#

Delete it please

gaunt herald
#

why

ornate lichen
#

?

maiden fable
#

Music Bots are against ToS

#

Read the embed

#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
ornate lichen
#

gg

#

but its not like we are publishing the bot

gaunt herald
#

@ornate lichen can you dm link pls

maiden fable
#

YouTube ToS

#

🤷‍♂️

maiden fable
#

And move that thing to the main.py file with other events

ornate lichen
#

thanks

visual island
waxen granite
#
Ignoring exception in on_raw_message_edit
Traceback (most recent call last):
  File "/home/Mechanic/.local/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/Mechanic/cogs/logs.py", line 141, in on_raw_message_edit
    if payload.cached_message.attachments:
AttributeError: 'NoneType' object has no attribute 'attachments'```
#

i have a msg which updates every 10 seconds and has an image

#

its giving this error

#

only some text part of that embed msg gets updated

slate swan
#

cached_message somehow returns None

#

Use a variable for the client. The value will be restarted if the client is restarted

waxen granite
#

bot.get_member(id)

#

bot.fetch_member(id)

warm mirage
#

guys i have a problem i found an issue i do not know what it wants from me

slate swan
#
@bot.command()
async def commandBro(ctx):
  var = var + 1
  await ctx.send(c"U used this {var} times")
waxen granite
#

u have to use a db and save everytime the user invokes a cmd in that and get it from there

waxen granite
maiden fable
maiden fable
slate swan
#

This also works in an @client.event , too. Just replace await ctx.send() to await message.channel.send()!

warm mirage
#

the um check mark which one?

waxen granite
#

discord application? frm where u get the bot?

warm mirage
#

yeah ik that but what is the intent idk where to find it withing the thingy idk how to enable it

waxen granite
slate swan
#

tag how2intents

warm mirage
#

how

warm mirage
#

ok nvm

#

thanks tho

visual island
visual island
slate swan
#

!event

#

:x

shadow wraith
#

but usefu;

#

whats a emoji which relates to tictactoe

slate swan
#

Ive been trying to mame a command to leave a guild but im not even close anybody know how?

shadow wraith
#

needed for my bot

maiden fable
maiden fable
visual island
pliant gulch
#

Might as well just join lefi dev team

#

Pepega I added slash commands last night

visual island
slate swan
pliant gulch
#

as long as you follow the codestyle I will fix all the bugs you make icy

#

I will clean up for you pepecry

slate swan
#

Lmao

visual island
waxen granite
#

How do i get the traceback for the errors in a channel?

pliant gulch
shadow wraith
#

oh zamn you use asyncio but idk how to help

#

time.sleep also works i think

#

about what, asyncio?, embeds? copy paste or screenshot the error here

crystal wind
#

I'm trying to install the default discord.py package through my env, although it somehow doesn't download it? Did they take their pip install down?

shadow wraith
#

... you forgot about await did you do it

#

oh wait

#

lemme see the code again

#

wait a second

#

yea they mentioned the error 7 times

#

lmao

#

np

#

idk if it works never used asyncio.sleep i always used time.sleep

crystal wind
shadow wraith
#

do pip3 install discord.py i forgor how u install it actually

crystal wind
#

I did that xD

shadow wraith
#

does it work?

crystal wind
#

not really

shadow wraith
crystal wind
#

I think it has to do with the environment I tried to make

#

ok good

shadow wraith
#

the updates stop coming at april 2022

#

wait that seems sus

crystal wind
#

I have that

#

But I'm not sure how I can like, yk.

shadow wraith
#

i use vsc 😔

slate swan
#

File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 606, in _load_from_module_spec
spec.loader.exec_module(lib)
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "c:\Users\rrfda\OneDrive\Desktop\sublime\commands\mod_commands.py", line 8, in <module>
from main import prefix
File "c:\Users\rrfda\OneDrive\Desktop\sublime\main.py", line 38, in <module>
bot.load_extension(f'commands.{filename[:-3]}')
bot.load_extension(f'commands.{filename[:-3]}')
File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 608, in _load_from_module_spec
del sys.modules[key]
KeyError: 'commands.mod_commands'

crystal wind
#

how is it?

shadow wraith
#

awesome, got a bunch of extensions and stuff installed

#

and i got a bot with 350 lines of code

#

still doesnt seem that much to me lmao

crystal wind
#

kk

shadow wraith
#

@slate swan works?

slate swan
#

Wait is it even possible to make your bot leave a guild with its id?i think not

slate swan
shadow wraith
#

k send me dm server thing

crystal wind
#

Ah I see imma try to create a condo environment in this case

shadow wraith
ornate lichen
#

it just shows my bot is typing and nothing shows up

#

when i run the command

shadow wraith
#

your bot does typing? why :troll:

ornate lichen
#

idk

shadow wraith
#

it looks cool but just hwy

pliant gulch
#

You leaked your API key

crystal wind
#

SORRY

ornate lichen
#

wait

#

i deleted the wrong thjing

full valley
slate swan
#

How do you mess up that badjam_cavedude

#

Who is familiar with rassbery pi

languid river
slate swan
#

Do you know how to connect python script to rassbery @languid river

#

With linux windows 11 subsystem

slate swan
#

Why

#

But can i use windows

#

Linux terminal

#

In the appstore

full valley
#

How would I go about this without using classes:

class Foo:
    # init
        self.queues = defaultdict(list)
    # command queue
        self.queues[ctx.channel_id].append(ctx.author.id)
        if len(self.queues[ctx.channel.id]) == 6:
                ...```
sage otter
#

are you asking how to ssh or something?

slate swan
#

Ys

#

Yes

#
@bot.event
async def on_ready():
    role = discord.utils.get(ctx.guild.roles, name="rainbow")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(5)
        except:
            break

Help me plz, I don't understand why ctx doesn't work

#

I want to make sure that when the bot is turned on, the role changes color

bronze pilot
#

That's interesting, I never knew asyncio has a sleep() method. I ended up using threading.Timer()

bronze pilot
bronze pilot
#

It's passed as a parameter e.g. ```python
@bot.command()
async def ping(ctx):

author_id = ctx.message.author.id
await ctx.channel.send(f"pong <@{author_id}>")

sage otter
bronze pilot
#

My guess is it shouldn't work because there is no context unless you try to pass in a ctx argument

slate swan
#

Ok and i need to connect to my pc or something

#

Like that

#

Is my first time but i didnt buycit yet

sage otter
#

yeah you connect to the host with ip and port

slate swan
#

Will the rassbery pi have ip port

bronze pilot
#

For example, I'm not sure about on_ready() event handler, but I have ctx implemented in on_command_error()

slate swan
#

@sage otter in the instructio

#

When i buy it

bronze pilot
#
@bot.event 
async def on_command_error(ctx, error): 
    if isinstance(error, commands.CommandNotFound): 
        await ctx.channel.send("***Invalid Command*** Use !help to show list of commands")
bronze pilot
bronze pilot
slate swan
#

😄

slate swan
#

async def on_ready(ctx):

bronze pilot
#
@bot.event
async def on_ready(ctx):
    role = discord.utils.get(ctx.guild.roles, name="rainbow")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(5)
        except:
            break
#

yep

slate swan
#

Look

#
TypeError: on_ready() missing 1 required positional argument: 'ctx'```
thick sigil
#

on ready takes no parameters

bronze pilot
#

I thought so

#

Should use the server id with discord.utils.get then, no?

thick sigil
#

or simple bot.get_server(serverid)

#

guild*

#

get_guild()

bronze pilot
#

yes, use that dont listen to me lol

#

I haven't used the get method at all with my bot

thick sigil
#

it is related to an instance

slate swan
#

How to do it then?

thick sigil
#

get the guild then get the role

slate swan
#

I have a bot but im scared that someone will add it to his server and just spam my bots commands how can i avoid this or does discord rate limit the user?if not how do i make all commands ignore a guild?

tawdry perch
#

is the bot public?

slate swan
tawdry perch
#

yes

slate swan
#

Iirc yes

slate swan
tawdry perch
#

you can make a decorator or global check that sees if command was run in x guild or you can also put cooldown to commands

slate swan
tawdry perch
#

erm not sure how to limit a certain guild

slate swan
#

I have logs of what guilds uses the commands so i know what guild uses the command and i get their id but idk how i could remove the bot if someone made a server just too spam commands

maiden fable
slate swan
#

can anyone help me to make my discord bot use dropbox api and send files as an output when requested?

frozen drift
#

Maybe if you show the code you have and ask about a specific issue you are having; someone might help.

frozen drift
slate swan
#

I just want my bot to have the best performance it can have without trolls

frozen drift
#

So you are wanting a way to blacklist guilds from using it?

slate swan
frozen drift
#

I don’t understand what you want. So you want a whitelist? So you have to approve people before they can use it?

elder spoke
#

Hi people, I have been working on my discord bot for over 2 months. Yesterday I was trying to run it but it raises an SSL error. I have already verified my certificates and they are all valid.
If anyone can help me I would be grateful.

This is the error:

raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
slate swan
#
@bot.event
async def on_ready():
    guild = 905639743402967110
    role = discord.utils.get(guild.roles, name="admin")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(5)
        except:
            break

error:

  File "D:\gg$\Bot py\GROS PROJET\bot.py", line 41, in on_ready
    role = discord.utils.get(guild.roles, name=908373553555079179)
AttributeError: 'int' object has no attribute 'roles'
#

help me :x

frozen drift
#

It sounds like you already do that

slate swan
#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
slate swan
#

You can't just assign it to an integer and consider it as a Guild object

#

Hello everyone btw 59

slate swan
slate swan
#

@slate swan how did you get the badge ? :x

#

¯\_(ツ)_/¯

slate swan
#

You can't get it anymore

silent ermine
#

how do I put an error message for this error py An unexpected error has occured! The error: Command raised an exception: NotFound: 404 Not Found (error code: 0): Interaction is unknown (you have already responded to the interaction or responding took too long)

Like Error: Interaction was responded or took too long

slate swan
#

If you just do bots for a few pixels on a profile, then you can already stop doing them

thick sigil
#

kek

slate swan
#

Because of people like you kek

slate swan
#

It ended up spamming the verification queue with random bots to get the badge

#

The queue got filled with botted bots

#

rip

#

People created a bot, made it online, invited to random servers and applied for the pixels

#

I don't do that

#

Still, if your only motivation are pixels on a profile then you can stop making bots

elder spoke
#

i can't run my bot because of this can anyone help me?

This is the error:

raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
slate swan
slate swan
slate swan
#

gg

#

I create bots for experience and for my future job

slate swan
#

Zzz

#

😭

#

Then stopped coding it and made it offline, dropped at ~350 servers

slate swan
#

What was the name of your bot?

#

'Wumpus'

#

Discord decided to not let me use that name

#

So I gave up

#

And now I don't do bots anymore

slate swan
#

😔

slate swan
#

I try*

slate swan
#

I do try, indeed

#

Hi

slate swan
#

Ive been outsmarted

#

:)

#

Bots are just boring at some point

#

Moved on to bigger projects

slate swan
#

hmmm

#

Shouldn't talk about it to be honest

#

A integer is a whole number and a float is a decimal correct?

#

I keep confusing them

#

Yup

slate swan
#

😪

#

Wait nvm

#

Remember now

#

Its what ever can be a var or sm like that

slate swan
#

It's a custom data type basically

slate swan
#

Which can contain different information

#

Oh

#

I see

#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
slate swan
#

Context is data inside something?

#

That's an object, containing different information

slate swan
#

Context is not really a thing, at least never heard of it

#

Mm

slate swan
#

But it means context but its a object?

#

!d discord.ext.commands.Context

unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
slate swan
#

Also an object containing different information

#

Ohhhh i get it now

#

And this object returns in what context the command has been executed. So by who, where, what, etc.

#

Im bad at my terminology but meh at python so thank you bropithink

#

So how to use get_guild in my code

@bot.event
async def on_ready():
    guild = 905639743402967110
    role = discord.utils.get(guild.roles, name="admin")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(5)
        except:
            break```
Plus I'm French so it doesn't make it any easier \:)
#

get_guild(id) is a method you can use on your bot variable

#

So instead of doing guild = <id> you need to use the method

#

ho ok

#

Oh yeah and just as side note

#

Rainbow roles will get your bot banned

#

For api abuse & spam

#

They're not allowed

#

How do i make a bot leave a guild ive tried await leave
and stuff related to it but nothing im trying to leave a specific guild with its id do you know about it @slate swan sorry for the ping btw

slate swan
#

It's just for me

#

Pretty sure it's simply await guild.leave()

#

!d discord.Guild.leave

unkempt canyonBOT
#

await leave()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Leaves the guild.

Note

You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.delete "discord.Guild.delete").
slate swan
#

Yeah

slate swan
#

Well you need to get the guild object from its id

slate swan
#

Well share your code :)

slate swan
#

Patience is the key of success :p

#
@bot.event
async def get_guild(id=905639743402967110):
    role = discord.utils.get(guild.roles, name="admin")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(5)
        except:
            break

So I do like this?

slate swan
#

Nvm

slate swan
#

Sorry I'm not good at it

#

All good :)

#

I love the emails I get...

slate swan
#

Hey man is there a way to know who has been hacking my stuff do they leave a mark behind, can there phone be back traced to there current location?  Any help would be great!

slate swan
#

Not the point tho😭

#

Yeah I know, but why do they ask that to me goaWeirdChamp

slate swan
#

Maybe need to change it then

#

No emails anymore

#

Easy

#

x)

#

Fits you ngl

#

Will be right back, got to finish my todo list of today ^^

slate swan
slate swan
#

@slate swan
How can I make the rainbow work on all the servers where the bot is?

#

Hi Guyz

slate swan
#

whats problem

slate swan
#

but interacted

slate swan
#

Dont know but im familiar with the error

#

now you think ?

#

Not familiar with buttons 🤷‍♂️

#

how >

#

?

#

@slate swan How can I make the rainbow work on all the servers where the bot is?

slate swan
#
@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Streaming(name="EN DEVELLOPEMENT", url="https://www.twitch.tv/Inferzel"))
    print("Pret")
    guild = bot.get_guild(905639743402967110)
    role = discord.utils.get(guild.roles, name="rainbow")
    while True:
        try:
            await role.edit(role=role, colour=RandomColor())
            await asyncio.sleep(2)
        except:
            break
#

I just want it to interact with the other servers

slate swan
#

And if its in all servers even more

#

I know it but it's not for me

#

This is for all my servers

#

Your still gonna get rate limited

#

You might even get flagged by the api as a spammer and your api key could get limited or banned🤷‍♂️

#

Idk

#

It doesn't matter, it's just for 5 servers of mine

#

Doesn't change anything

slate swan
#

Making a single rainbow role already gets you rate limited

slate swan
#

So I guess you can imagine what happens when you do it 5 times more

#

Any repetive action will get rate limited

#

Not all but most

#

Ok, I get it

#

Not really any repetitive action, any action that is being repetitive within a small timespan

slate swan
#

Changing the role color every day for example won't get you rate limited

#

Every hour i think wont get you rate limited

#

ok

#

There's a rate limit section on the documentation you can take a look at

slate swan
#

It is true you are right

#

For roles it's 1000 requests per 24 hours

#

how do i make embed images smaller or bigger?

#

So ~41 per hour

#

big brain

opaque plinth
slate swan
#

Yeah this too, should create a task loop instead

slate swan
#

Nope

#

this is my code to leave guilds and yes its horrible

@bot.command()
async def leave(ctx,arg):
    for guild in bot.guilds:
        if guild.name == arg:
            t = guild.id
            bot.get_guild(t)
            await guild.leave()
        else:
            await ctx.send("guild not found")

it just says guild not found

#

can i atleast put them on side?

#

I mean, it depends on the size of the image of course

slate swan
#

instead of down

#

Only bottom or top right (thumbnail)

#

how do i make thumbnail??

slate swan
#

from a image link

#

The guild variable is already of type Guild

slate swan
#

So you can just use .leave() on it

slate swan
unkempt canyonBOT
#
Nah.

No documentation found for the requested symbol.

slate swan
#

hm

#

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
slate swan
#

Just give the URL as string parameter

opaque plinth
slate swan
vocal lance
#

Hey! I need your help guys. python @client.command(description="list") async def list(ctx : str): print((datetime.now().strftime('%H:%M:%S'))+" Someone used !List") BTC = cryptocompare.get_price("BTC", currency) BTC1 = str(BTC) print(BTC1) #gives me back {'BTC': {'USD': 64886.29}} so now how do I index this that it returns only the integer so i can use it for more things?

slate swan
#

You don't

#

That's how the library works I guess

#

You just get the price (get_price)

opaque plinth
slate swan
# opaque plinth yes ig

this is how it looks rn

@bot.command()
async def leave(ctx,arg,guild:disnake.Guild):
    for guild in bot.guilds:
        if guild.name == arg:
            t = guild.id
            await guild.leave()
        else:
            await ctx.send("guild not found")
#

Personally

#

I would pass the guild id

#

When executing the command

#

And forget about the name check

vocal lance
slate swan
#

Like !leave <id>

slate swan
opaque plinth
#

oh try it and see if it works

slate swan
#

Then you can just try arg.leave() and if it fails the guild probably doesn't exist

#

Would rename arg to guild though

#

ok

opaque plinth
slate swan
#

And keep the type hint to disnake.Guild

slate swan
#

it left all the guilds now i think i forgot to add break:

@bot.command()
async def leave(ctx,guild:disnake.Guild):
    for guild in bot.guilds:
        try:
            t = guild.id
            await guild.leave()
        except:
            await ctx.send("guild not found")
#

No need to loop

#

Just .leave() and handle the exceptions

boreal ravine
#

whats the variable for?

slate swan
#

And don't forget to restrict it to only you bravemmlol

#

You don't want people to make it leave guilds

#

yes ik

#

im going to make a check for it

#

All right gopherhappy

slate swan
# slate swan All right <:gopherhappy:783721688852070420>

this is how it looks rn it just says guild not found

@bot.command()
async def leave(ctx,guild:disnake.Guild):
    if ctx.author.id == 637458038915203127:
        try:
            await leave()
        except:
            await ctx.send("guild not found")
    else:
        await ctx.send(f"{ctx.author.mention}You do not have permissions for this command")
#

Need to leep it as guild.leave() though

vocal lance
#

I have a list with called money = [Card1, Card2, Card3]. How can I make a loop which sets them to a random number? I already have this: python Card1 = 0 Card2 = 0 Card3 = 0 money = [Card1, Card2, Card3] i = 0 while i < len(money): money[i] = random.randint(1, 500) i = i+1 print(money[0], money[1], money[2])yeah something isn't working I know. And I'm unsure if I really should set these Cards before i add them to a List. I'm not that good in python sry

slate swan
#

Yup

#

thank you for showing me about the objects btw

slate swan
vocal lance
slate swan
#

And you can change to i += 1, does the same and it's sorter/more understandable

#

@slate swan it worked thank you so much bro your the man

slate swan
shadow wraith
#

can anyone link me a hexadecimal color picker so i can freaking put a custom color in an embed

#

wait how do you put a custom color in an embed

worn patio
#

Hi! I need your help! I have this code:

# Biblioteka
import nextcord as discord
import datetime
import config

from nextcord.ext import commands
from nextcord import Embed
from nextcord.ext import tasks

# Kod
class Taskloop(commands.Cog):
    def __init__(self, client):
        self.client = client
        self.test.start()

    @tasks.loop(seconds = 5.0)
    async def test(self, ctx):
        kanal = self.client.get_channel(908367227860942848)
        server = ctx.message.guild
        channels = len(server.channels)

        embed = discord.Embed(title = f"{config.name} | Statystyki", description = "asd", url = config.url, timestamp = datetime.datetime.utcnow(), color = 0x00aff4)
        embed.add_field(name = "Właściciel serwera:", value = f"{ctx.guild.owner}", inline = False)
        embed.add_field(name = "ID serwera:", value = f"{ctx.guild.id}", inline = False)
        embed.add_field(name = "Region serwera:", value = f"{ctx.guild.region}", inline = False)
        embed.add_field(name = "Serwer stworzony:", value = f"{ctx.guild.created_at}", inline = False)
        embed.add_field(name = "Ilość użytkowników:", value = server.member_count, inline = False)
        embed.add_field(name = "Ilość kanałów tekstowych/głosowych:", value = f"{channels}", inline = False)
        embed.set_footer(text = f"© 2021 CS-owo.pl • {ctx.author.name}#{ctx.author.discriminator}")
        await kanal.send(embed = embed)

def setup(client):
    client.add_cog(Taskloop(client))

Errors:

Unhandled exception in internal background task 'test'.
Traceback (most recent call last):
  File "C:\Users\fixed\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\nextcord\ext\tasks\__init__.py", line 168, in _loop
    await self.coro(*args, **kwargs)
TypeError: test() missing 1 required positional argument: 'ctx'
#

Do you know what's going on? : /

shadow wraith
#

wat does line 168 hav

slate swan
#

You must have called test() look without passing ctx so test(ctx)

shadow wraith
#

hey how do you get a custom color for an embed

slate swan
#

Oh

slate swan
#

like 0xffff..

elder spoke
#

i can't run my bot because of this can anyone help me?

This is the error:

raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
shadow wraith
#

ye where to find those color codes link me a website

slate swan
#

Like blue colour hex

worn patio
shadow wraith
#

not the hexadecimal code which is compatible

slate swan
shadow wraith
#

can you just link me a website

slate swan
#

0x00ff00

shadow wraith
#

oh

slate swan
#

Try that

#

Don't include the hashtags

shadow wraith
#

how to get hexadecimal code goes like this?
get hexadecimal and then remove hash and add a 0x before the numbers and letters right

slate swan
#

yeah

elder spoke
# slate swan Ah, iOS?

macOS but yes I was coding on replit and I decided to use VSC again but when a try to run the program it rises this i check the SSL certificates and it's all good with that.

worn patio
shadow wraith
shadow wraith
#

lol

slate swan
#

!d discord.Colour.value

unkempt canyonBOT
slate swan
#

colour

worn patio
# slate swan You must have called `test()` look without passing `ctx` so `test(ctx)`

But when I remove ctx, I get this error:

Unhandled exception in internal background task 'test'.
Traceback (most recent call last):
  File "C:\Users\fixed\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\nextcord\ext\tasks\__init__.py", line 168, in _loop
    await self.coro(*args, **kwargs)
  File "J:\DISCORD\xBOT\komendy\stats\stats.py", line 19, in test
    server = ctx.message.guild
NameError: name 'ctx' is not defined
slate swan
boreal ravine
slate swan
#

lol

boreal ravine
#

oop

shadow wraith
#

i got the hexadecimal code working thanks for teaching me how to get a hexadecimal code lmao!

#

nah seriously it works

#

my steps were true lmfao

worn patio
# slate swan That's something else.. send the code
# Biblioteka
import nextcord as discord
import datetime
import config

from nextcord.ext import commands
from nextcord import Embed
from nextcord.ext import tasks

# Kod
class Taskloop(commands.Cog):
    def __init__(self, client):
        self.client = client
        self.test.start()

    @tasks.loop(seconds = 5.0)
    async def test(self):
        kanal = self.client.get_channel(908367227860942848)
        server = ctx.message.guild
        channels = len(server.channels)

        embed = discord.Embed(title = f"{config.name} | Statystyki", description = "asd", url = config.url, timestamp = datetime.datetime.utcnow(), color = 0x00aff4)
        embed.add_field(name = "Właściciel serwera:", value = f"{ctx.guild.owner}", inline = False)
        embed.add_field(name = "ID serwera:", value = f"{ctx.guild.id}", inline = False)
        embed.add_field(name = "Region serwera:", value = f"{ctx.guild.region}", inline = False)
        embed.add_field(name = "Serwer stworzony:", value = f"{ctx.guild.created_at}", inline = False)
        embed.add_field(name = "Ilość użytkowników:", value = server.member_count, inline = False)
        embed.add_field(name = "Ilość kanałów tekstowych/głosowych:", value = f"{channels}", inline = False)
        embed.set_footer(text = f"© 2021 CS-owo.pl • {ctx.author.name}#{ctx.author.discriminator}")
        await kanal.send(embed = embed)

def setup(client):
    client.add_cog(Taskloop(client))
slate swan
#

hm

worn patio
# slate swan `async def test(self, ctx)` maybe try this?
Unhandled exception in internal background task 'test'.
Traceback (most recent call last):
  File "C:\Users\fixed\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\nextcord\ext\tasks\__init__.py", line 168, in _loop
    await self.coro(*args, **kwargs)
TypeError: test() missing 1 required positional argument: 'ctx'
#

: /

elder spoke
#

maybe is the @commands.command?

boreal ravine
elder spoke
#
@commands.command(name='yourcommand', aliases=['your aliases'])
async def _yourcommand(self, ctx: commands.Context):
#

try that

boreal ravine
#

he isnt making a command

worn patio
#

+1

slate swan
#

just get the guild in another way

#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
slate swan
elder spoke
#

don't use ctx

slate swan
#

get the guild from the bot's cache or fetch it instead

#
    @commands.command()
    async def kick(self, ctx, member: discord.Member = None, reason = None):
        await noset(ctx)
        db = sqlite3.connect("database.db")
        cursor = db.cursor()
        cursor.execute(f"SELECT language FROM language WHERE guild_id = {ctx.author.guild.id}")
        wynik1 = cursor.fetchone()
        if wynik1 == "ENG":
            if member == None:
                await ENGMemberembed(ctx)
                return
            elif reason == None:
                reason = "Administrator didn't say reason"
            await ENGkickembed(ctx, member, reason)
            await member.kick(reason=reason)
        elif wynik1 == "PL":
            if member == None:
                await PLMemberembed(ctx)
                return
            elif reason == None:
                reason = "Administrator nie podał powodu"
            await PLkickembed(ctx, member, reason)
            await member.kick(reason=reason)

It stops at wynik1 = cursor.fetchone

#

we don't know what's in your db

#

and what is wynik1 and why is everyone using the same var name yert

slate swan
#

wynik = result in polish

#

and almost everyone in Poland uses it

#

and almost everyone that uses wynik uses sqlite3 and don't know what to do

slate swan
elder spoke
#

so you are trying to translate the kick command? @slate swan

slate swan
river kindle
#

i'm creating a serverinfo command, it works everything except loading the server image.
For example when I call the command, it sends all the data and should also send the server image inside the embed, but it doesn't.

code:

async def serverinfo (ctx):
  role_count = len (ctx.guild.roles)
  icon = str (ctx.guild.icon_url)



  serverinfoEmbed = discord.Embed (timestamp = ctx.message.created_at, color = ctx.author.color)
  
  serverinfoEmbed.add_field (name = 'Name', value = f "{ctx.guild.name}", inline = False)
  serverinfoEmbed.add_field (name = 'Total members', value = ctx.guild.member_count, inline = False)
  serverinfoEmbed.add_field (name = 'Verification level (security)', value = str (ctx.guild.verification_level), inline = False)
  serverinfoEmbed.add_field (name = 'Top role', value = ctx.guild.roles [-2], inline = False)
  serverinfoEmbed.add_field (name = 'Total roles', value = str (role_count), inline = False)
  serverinfoEmbed.set_thumbnail (url = icon)

  await ctx.send (embed = serverinfoEmbed)```
unkempt canyonBOT
#

Hey @slate swan!

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

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

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

https://paste.pythondiscord.com

elder spoke
slate swan
#

nope

#

in the database I have who to choose which language

unkempt canyonBOT
river kindle
#

yay

elder spoke
#
icon = str(ctx.guild.icon_url)

embed.set_thumbnail(url=icon)
sick birch
#

not just the letter

elder spoke
slate swan
#

I want to make a choice of Polish or English

sick birch
#

that's literally what they did lol

sick birch
#

and it's not the default grey/white letter icon?

river kindle
#

nope

sick birch
#

that's odd, the code is perfect

river kindle
#

uhmm

elder spoke
#

send me a pic of the embed

sick birch
#

perhaps you're missing intents?

river kindle
#

WTH

#

now works

sick birch
#

yeah, was probably just a server issue

river kindle
#

uhmm, probably

sick birch
#

discord.Reaction has a count attribute

#

poll.reactions is probably empty

#

your intents may be screwed up

#

is the poll message actually getting reactions?

#

perhaps it's the key messing with it

#

try to print poll.reactions to see what it outputs

#

also keep in mind the bot won't see your own reactions

#

yeah that's why

slate swan
#

are there any free online courses for discord.py so i dont have to barely understand anything in the documentation?

sick birch
#

the bot doesn't count its own reactions

slate swan
sick birch
#

you should avoid youtube tutorials on this

faint echo
#

Not in this case Robin

#

he goes in deep into discord py

sick birch
#

perhaps

faint echo
#

I wouldn't recommend youtube tutorials either but he is good

sick birch
#

maybe

#

how long after the initial message are you reacting?

#

also i remember having an issue like this, refetch the message

#

something about the actual message not being the one in the cache

#

get the id, refetch from the servers

slate swan
sick birch
#

the message in the cache doesn't reflect the actual message server-side

#

awesome, i remember having the same issue a year back and spending like 2 days on it haha

#

always glad to pass around little nitpick info like that around to save others the headache

silent ermine
#

nvm

outer violet
#

how do groups work?

steady flume
#

Robin, if you remember me, I want to say that I solved all my problems 🙂

silent ermine
#
@bot.command()
async def eval(ctx, *, code):
  runCode = code
  exec(runCode)```

How do I send the runned code (after the `exec(runCode)`)
manic wing
silent ermine
manic wing
#

just make a full eval

silent ermine
sturdy tapir
#
@client.event
async def on_ready():
    print("Bot's ready!")
    while True:
        r = requests.get("http://RbxMods.com")
        if r.status_code == 200:
            channel = client.get_channel(907898359535263774)
            if channel.content.startswith('https://RbxMods Is Up'):
                time.sleep(1)
                print("no")
            else:
                await channel.send_message("https://RbxMods Is up")
        elif channel.message.content.startswith("https://RbxMods Is down, Please wait while we finalize things."):
            await channel.send_message("https://RbxMods Is down, Please wait while we finalize things.")
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\IT Solutions\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "d:/code/RbxMods/RbxMods.py", line 21, in on_ready
    if channel.content.startswith('https://RbxMods Is Up'):
AttributeError: 'TextChannel' object has no attribute 'content'

How do I make this work

silent ermine
full lily
silent ermine
full lily
#

🤨

silent ermine
sturdy tapir
#

How's that dangerous

silent ermine
sturdy tapir
#

so funny

full lily
sturdy tapir
#

what's arbitrary code lmfao

full lily
#

you'd have to have some sort of container like this server does with snekbox

sturdy tapir
#

ah

#

it's a vulnerability?

full lily
#

oh yes.

sturdy tapir
#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

sturdy tapir
#

@silent ermine screw off lmfao

outer violet
#

im making a calculate command but its giving me this error :/

@client.command(aliases=['calc'])
async def calculate(ctx, operation, *nums):
    if operation not in ['+', '-', '*', '/']:
        await ctx.send('Please type a valid operation type.')
    var = f' {operation} '.join(nums)
    await ctx.send(f'{var} = {eval(var)}')
maiden fable
outer violet
maiden fable
#

Lmao wtf is that error

sturdy tapir
#

try and execute again

maiden fable
#

Yea try running it again

outer violet
#

i just did *calc 4+5 and it gave me that error

silent ermine
#

@unkempt canyon has it

maiden fable
sturdy tapir
#

it does he wants to execute a vulnerability

maiden fable
#

that person doesn't know what he is doing

maiden fable
sturdy tapir
#

on a persons pc

#

In computer security, arbitrary code execution (ACE) is an attacker's ability to run any commands or code of the attacker's choice on a target machine or in a target process. ... A program that is designed to exploit such a vulnerability is called an arbitrary code execution exploit.

maiden fable
#

Bro....

#

pithink Do you know you don't know stuff about the dpy lib?

#

!d discord.ext.commands.is_owner exists cz of this reason only

unkempt canyonBOT
#

@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.

This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").

This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
outer violet
silent ermine
silent ermine
maiden fable
opaque plinth
sturdy tapir
maiden fable
sturdy tapir
#

@full lily

maiden fable
maiden fable
maiden fable
#

You took it the other way

silent ermine
silent ermine
#

Ok

opaque plinth
outer violet
maiden fable
#

By executing arbitrary code, bones means that without the owner deco, anyone could have ran arbitrary code even when Vin doesn't want it

maiden fable
full lily
maiden fable
full lily
#

he would be the vulnerable person, by allowing other people to execute code on his machine

maiden fable
#

yup

outer violet
silent ermine
#

so not my machine

maiden fable
maiden fable
silent ermine
#

Replit is

opaque plinth
outer violet
#

copied

full lily
maiden fable
#

Lucas? Idk

silent ermine
maiden fable
silent ermine
#

ok afk

opaque plinth
silent ermine
full lily
silent ermine
#

ok here ill quit the command

#

there.

maiden fable
#

Even I have an eval command in my bot