#discord-bots

1 messages ยท Page 672 of 1

boreal ravine
#

yes

astral cobalt
stark lintel
#

ok, ill go do that...

boreal ravine
astral cobalt
#

It looks like it hangs inside my for loop py for i in range(0, post_to_pick): submission = next(x for x in memes_submissions if not x.stickied) print(submission)

stark lintel
#

@boreal ravine i got the command to show up...now what?

stark lintel
#

let me check

#

nope

astral cobalt
#

It wont print submission, it gets stuck inside the forloop

boreal ravine
# stark lintel let me check

hmm have you tried reading a slash example in the lib your using? maybe you did somthing wrong also show me your slash variable

stark lintel
#

yeah, i copied one from the internet

stark lintel
#

@boreal ravine this is the example i was using. Now, i dont know if this matters, but where it says intents, i removed that because it was raising errors for me...do you think that effected anything?

boreal ravine
#

@stark lintel do you have an error handler?

stark lintel
#

yes

boreal ravine
boreal ravine
#

@astral cobalt wait do you also have an error handler?

stark lintel
boreal ravine
#

remove it for now

stark lintel
#

ok

boreal ravine
#

or just comment the whole function out

stark lintel
stark lintel
boreal ravine
#

yes

astral cobalt
#

@boreal ravine I dont, I have it commented out so it doesent catch it so I can see the erros

stark lintel
#

ok, ill do that...

stark lintel
#

still says this interaction failed

#

and no errors were raised

#

@boreal ravine

boreal ravine
#

hm

#

no idea lmfao

stark lintel
#

rip.

#

ok, thanks for trying though

astral cobalt
#

Makes no scense why this isnt working

boreal ravine
#

hm

astral cobalt
#
async def get_meme(ctx):
    print("In here")
    memes_submissions = await reddit.subreddit('memes')
    print("Memes submission: ", memes_submissions)
    #memes_submissions = await memes_submissions.hot()
    post_to_pick = random.randint(1, 10)
    for i in range(0, post_to_pick):
        submission = next(x for x in memes_submissions if not x.stickied)
        print(submission)
    print(submission.url)
    await ctx.send(submission.url)```
#

It just gets stuck inside the for loop and wont set submission equal to anything

boreal ravine
#

@astral cobalt can u try printing the type of meme submissions

astral cobalt
#

@boreal ravine Memes submission: <class 'asyncpraw.models.reddit.subreddit.Subreddit'>

slate swan
#

how can i make my bot send a certain msg if it sees a certain emoji on a bot's button?

astral cobalt
#

could it be

#

that this isnt authenticating correctly?

#
    user_agent="Hello There)",
    client_id="CLIENT_ID",
    client_secret="CLIENT_SECRET",
    username="USERNAME",
    password="PASSWORD",
)
upbeat otter
#

@stark lintel you need to enable intents from the the discord dev portal in order to use specific data you require

stark lintel
#

it shows the hello command...

#

however, the hello slash command is commented

#

but it doesn't show the test command

upbeat otter
verbal cairn
stark lintel
upbeat otter
#

Then use the, intents=discord.Intents.default()
In your code

stark lintel
#

ok

upbeat otter
stark lintel
#

oh

upbeat otter
#

If you have just started making your bot, I'd recommend you to use disnake

stark lintel
#

ok though, why is it still saying interaction failed?

upbeat otter
stark lintel
#

like, a screenshot of what happens?

upbeat otter
stark lintel
#

OHHHHHH

upbeat otter
#

Ye

stark lintel
#

OH MY GOD, LET ME TRY THAT

upbeat otter
#

Sure

#

Ping me

astral cobalt
#

@upbeat otter You have any idea why asyncpraw isnt working for me?

stark lintel
#

IT WORKEDDDD!!!!!!!

upbeat otter
stark lintel
#

NOW how do i make it ephemeral message

upbeat otter
stark lintel
#

also thank you for that solution

upbeat otter
stark lintel
#

i can't believe i didn't see that before

upbeat otter
#

Of the current message

stark lintel
#

ok, ill send one

astral cobalt
#

Do you know of any other ways to retrieve reddit posts with your bot?

stark lintel
#

@upbeat otter

upbeat otter
stark lintel
#

let me try that, ill ping you how it goes

upbeat otter
#

Ye

stark lintel
#

@upbeat otter ok, it worked, however, just for the future in case you are helping someone with a similar issue, change ephermal=True to hidden=True. this is what worked for me

#

THANK YOU SO MUCH THOUGH

#

im pretty excited rn

upbeat otter
#

Ohk, thanx

stark lintel
#

NP, thank you

upbeat otter
stark lintel
#

lol ๐Ÿ’€

#

wait @upbeat otter ONE MORE QUESTION

upbeat otter
upbeat otter
boreal ravine
stark lintel
# upbeat otter Yesh?

so it shows my two slash commands in my code, but only my one shows up, you said it will update eventually, correct?

boreal ravine
upbeat otter
#

Mhm

rigid hatch
#

._.

stark lintel
#

mhm me or mhm kayle

upbeat otter
stark lintel
#

oh, ok, so how long should i leave my code running to let it update

upbeat otter
stark lintel
#

damn, actually

upbeat otter
#

thats why use disnake

stark lintel
#

lol, ill look into that

#

but in the meantime, you do think it should update on its own

novel bolt
#

Hey is there a way to get attachments from slash commands?

astral cobalt
#

should my .env contain data like this? PASSWORD=randompassword USERNAME=randomusername or like this? PASSWORD="randompassword" USERNAME="randomusername"

stark lintel
#

and you too @boreal ravine thanks for the help earlier

novel bolt
stark lintel
#

oh, im in US

#

its 10:30 PM

upbeat otter
novel bolt
upbeat otter
novel bolt
#

Hmm ok

astral cobalt
#

@upbeat otter Why do you check everything you write out in discord with the line through it?

novel bolt
#

thanks and now Lemme go have by breakfast ๐Ÿ˜…

upbeat otter
#

Bye..m

astral cobalt
#

does it mean something?

upbeat otter
astral cobalt
#

Lol

#

Is asyncpraw broken or am I just not doing it right -____-

boreal ravine
#

your not doing it right

slate swan
astral cobalt
#
async def meme(self, ctx, subred="memes"): # default subreddit is memes, later in the command you can select one of your choice (example: !meme python --> chooses r/python reddit post)
    msg = await ctx.send('Loading ... ')

    reddit = asyncpraw.Reddit(client_id='CLIENT_ID',
                              client_secret='CLIENT_SECRET',
                              username='USERNAME',
                              password='PASSWORD',
                              user_agent='useragent')



    subreddit = await reddit.subreddit(subred)
    all_subs = []
    top = subreddit.top(limit=250) # bot will choose between the top 250 memes

    async for submission in top:
        all_subs.append(submission)

    random_sub = random.choice(all_subs)

    name = random_sub.title
    url = random_sub.url

    embed = Embed(title=f'__{name}__', colour=discord.Colour.random(), timestamp=ctx.message.created_at, url=url)

    embed.set_image(url=url)
    embed.set_author(name=ctx.message.author, icon_url=ctx.author.avatar_url)
    embed.set_footer(text='Here is your meme!')
    await ctx.send(embed=embed)
    await msg.edit(content=f'<https://reddit.com/r/{subreddit}/> :white_check_mark:') # < and > remove the embed link
    return```
#

@slate swan Then im just stupid lol, i have 0 clue why it wont work, it doesent even throw an error

#

it just simply doesent work

slate swan
#

why is the reddit var in the func?

#

it should be a global var idk why you put that their

astral cobalt
#

Found this one online

#

My other one was global

slate swan
#

give me one sec

astral cobalt
#

thought that might have been why

#
async def get_meme(ctx):
    print("In here")
    memes_submissions = await reddit.subreddit('memes')
    print("Memes submission: ", memes_submissions)
    #memes_submissions = await memes_submissions.hot()
    post_to_pick = random.randint(1, 10)
    for i in range(0, post_to_pick):
        submission = next(x for x in memes_submissions if not x.stickied)
        print(submission)
    print(submission.url)
    await ctx.send(submission.url)
``` this is what mine actually looks like
slate swan
# astral cobalt ```@client.command() async def get_meme(ctx): print("In here") memes_sub...

ik this is spoonfeeding but im bored:

@bot.command()
@commands.cooldown(1,120,commands.BucketType.user)
async def setup(ctx):
    print("setup command has been executed")
    subreddit = await reddit.subreddit("setups")
    all_subs = []

    top = subreddit.top(limit = 200)

    async for submission in top:
        if not submission.is_self:
            all_subs.append(submission)
    random_sub = random.choice(all_subs)

    name = random_sub.title
    url = random_sub.url
    
    em = disnake.Embed(title = name)
    if "jpg" not in url or "png" not in url:
        pass
    if "jpg" in url or "png" in url:
        em.set_image(url = url)
    await ctx.send(embed = em)
#

its old btw lol

boreal ravine
#

@upbeat otter ?

upbeat otter
boreal ravine
#

what was that for ๐Ÿค”

astral cobalt
#

Wdym indent? @upbeat otter

slate swan
#

indents are right lol

upbeat otter
slate swan
astral cobalt
#

-_-

slate swan
#

ok bye now

upbeat otter
#

Bye

upbeat otter
boreal ravine
#

eh me too im sure eevee will help with his problem

slate swan
slate swan
slate swan
#

did you steal that code from somewhere?

#

didnt bother to change it

slate swan
upbeat otter
#

I never used praw before so meh

slate swan
slate swan
slate swan
#

works so i didnt even bother

#

sadgeCry i wont even bother helping

upbeat otter
slate swan
slate swan
#

you indeed need help

boreal ravine
#

hence "async"

slate swan
#

just the async instance of praw

astral cobalt
#

Somone online said its not worth using the async version

slate swan
#

asynchronous synchronised async function

slate swan
slate swan
#

ok bye now

upbeat otter
slate swan
upbeat otter
slate swan
#

hold up how you know you stalker๐Ÿšถ

#

okay cya

astral cobalt
#

6:43? Where do you live @slate swan

slate swan
#

bye๐Ÿšถ

slate swan
upbeat otter
slate swan
slate swan
slate swan
upbeat otter
slate swan
boreal ravine
#

!ot

unkempt canyonBOT
slate swan
upbeat otter
#

Lol

slate swan
#

bye now๐Ÿงโ€โ™‚๏ธ ๐Ÿšถ

#

bye

upbeat otter
#

Me too bye

slate swan
astral cobalt
#

@slate swan The setup function does the same thing as my last it just freezes inside the forloop

boreal ravine
#

how does something freeze inside a for loop? that doesnt make sense unless the values inside the iterable your trying to unpack is really big

astral cobalt
#

Doesent make sense to me either, it just wont iterate

lost wolf
#

can someone send me a example uptime code?

maiden fable
#

Hmmm

boreal ravine
lost wolf
#

i completely forgot how to code in python lol

#

i quit using python for so long

upbeat otter
#

everybody wants the code, no one wants the explanation

#

Just their things should work

boreal ravine
#

I dont give free code, but heres an example```py
from datetime import datetime as dt

bot = ...
bot.uptime = dt.utcnow().timestamp()

async def timestamp(ctx):
...

maiden fable
#

@lost wolf do u know about the discord's unix timestamp feature?

lost wolf
#

no

boreal ravine
boreal ravine
#

does time have a timestamp attr?

lost wolf
#
@client.command(pass_context=True)
async def uptime(ctx):
        current_time = time.time()
        difference = int(round(current_time - start_time))
        text = str(datetime.timedelta(seconds=difference))
        embed = discord.Embed(colour=0xc8dc6c)
        embed.add_field(name="Uptime", value=text)
        embed.set_footer(text="<bot name>")
        try:
            await ctx.send(embed=embed)
        except discord.HTTPException:
            await ctx.send("Current uptime: " + text)
#

shouldnt that work?

#

what should i define start_time as?

boreal ravine
boreal ravine
#

oh your using time

#

Is that copied code? I see pass_context and thats useless now

lost wolf
boreal ravine
#

define start_time as a time.time obj then

#

!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.
lost wolf
#
@client.command()
async def uptime(ctx):
        start_time = time.time()
        current_time = time.time()
        difference = int(round(current_time - start_time))
        text = str(datetime.timedelta(seconds=difference))
        embed = discord.Embed(colour=0xc8dc6c)
        embed.add_field(name="Uptime", value=text)
        embed.set_footer(text="NeoBot")
        try:
            await ctx.send(embed=embed)
        except discord.HTTPException:
            await ctx.send("Current uptime: " + text)
#

that?

boreal ravine
#

dont put it inside the function

#

make it global, somewhere near your bot variable

lost wolf
#

huh

#

like where i defined client?

boreal ravine
#
bot = ...
start_time = ...

boreal ravine
#

Same thing

lost wolf
#

it works thanks

boreal ravine
#

๐Ÿ‘

maiden fable
boreal ravine
lost wolf
#

can you send the link to the docs of making cogs please?

#

@boreal ravine

boreal ravine
#

uh

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.
stark lintel
#

@upbeat otter when i implemented to slash command, it broke all of my other commands that have buttons, do you know why that may be, and how to fix it?

#

i can ss the error it gives

#

big old glob of red

#

lmfao

#

i fixed it

#

but i have no clue how

#

i just typed the comment "#poop"

#

and it magically fixed my code

#

if this doesn't sum up python, i dont know what does ๐Ÿคฃ

lost wolf
#

`

#

discord.ext.commands.errors.ExtensionNotFound: Extension 'info' could not be loaded.

#
import discord
from discord.ext import commands

class info(commands.cog):
    def __init__(self, bot):
        self.bot = bot
        self._last_member = None

    @commands.command()
    async def hello(self, ctx, *, member: discord.Member = None):
        member = member or ctx.author
        if self._last_member is None or self._last_member.id != member.id:
            await ctx.send(f'Hello {member.name}~')
        else:
            await ctx.send(f'Hello {member.name}... This feels familiar.')
        self._last_member = member



bot.add_cog(info(bot))
#

?

#

nvm i fixed it

#

now i got another error

#

TypeError: module() takes at most 2 arguments (3 given)

#
class info(commands.cog):
#

thats the line its finding the error on

#

@boreal ravine can you help pls

#

someone help

#

@marble cradle

#

@cinder horizon do you know?

cinder horizon
#

do you know?
@lost wolf innit commands.Cog?

lost wolf
#

huh

cinder horizon
#

i mean cant help wen m not shore myself...so nope sorry idk

boreal ravine
lost wolf
#

AttributeError: module 'discord.ext.commands.bot' has no attribute 'add_cog'

cinder horizon
lost wolf
#

discord.ext.commands.errors.ExtensionNotFound: Extension 'info' could not be loaded.

#

why is it having so much trouble loading cogs

lost wolf
maiden fable
#

@lost wolf is info the class name?

lost wolf
#
class info(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self._last_member = None
maiden fable
#

Okay...

cinder horizon
#
import discord
from discord.ext import commands

class info(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self._last_member = None

    @commands.command()
    async def hello(self, ctx, *, member: discord.Member = None):
        member = member or ctx.author
        if self._last_member is None or self._last_member.id != member.id:
            await ctx.send(f'Hello {member.name}~')
        else:
            await ctx.send(f'Hello {member.name}... This feels familiar.')
        self._last_member = member


def setup(bot):
  bot.add_cog(info(bot))
``` @lost wolf run exactly this and say waz its showing
maiden fable
#

Yea

cinder horizon
#

self._last_member = Nonewt exactly is this for i dint get tht...

lost wolf
#
Traceback (most recent call last):
  File "/home/allans/Bot/main.py", line 31, in <module>
    client.load_extension("info")
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/bot.py", line 676, in load_extension
    raise errors.ExtensionNotFound(name)
discord.ext.commands.errors.ExtensionNotFound: Extension 'info' could not be loaded.
cinder horizon
#

...

lost wolf
#

?

cinder horizon
#
for filename in os.listdir('./cogs'):
      if filename.endswith('.py'):
        <client/bot>.load_extension(f'cogs.{filename[:-3]}')
        print(f'Loaded {filename[:-3]}')
```add this in ur `on_ready` and try
lost wolf
stiff nexus
#
    @commands.command(hidden=True)
    async def translate(self, ctx, *, message: commands.clean_content = None):
        loop = self.bot.loop
        ret = await loop.run_in_executor(None, self.trans.translate, message)
        embed = discord.Embed(title='Translated', colour=0x4284F3)
        src = googletrans.LANGUAGES.get(ret.src, '(auto-detected)').title()
        dest = googletrans.LANGUAGES.get(ret.dest, 'Unknown').title()
        embed.add_field(name=f'From {src}', value=ret.origin, inline=False)
        embed.add_field(name=f'To {dest}', value=ret.text, inline=False)
        await ctx.send(embed=embed)
```help??```py
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/cogs/test.py", line 67, in translate
    ret = await loop.run_in_executor(None, self.trans.translate, message)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/client.py", line 182, in translate
    data = self._translate(text, dest, src, kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/gtoken.py", line 194, in do
    self._update()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/googletrans/gtoken.py", line 62, in _update
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
boreal ravine
#

something is None in your code

#

or it's a library issue

lost wolf
#

how tf is that even possible

#
   @commands.command()
    async def botinfo(self, ctx):
        embed = discord.Embed(title="BotInfo")
        embed.add_field(name="Server Count", value=str(len(bot.guilds)))
        await ctx.send(embed=embed)
#

@boreal ravine

stiff nexus
# boreal ravine something is `None` in your code

ok removed None (ret = await loop.run_in_executor(None, self.trans.translate, message)) but

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/cogs/events.py", line 191, in on_command_error
    raise error
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/Trust-Worthy-Runtime-Bot-2/cogs/test.py", line 67, in translate
    ret = await loop.run_in_executor( self.trans.translate, message)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 783, in run_in_executor
    executor.submit(func, *args), loop=self)
AttributeError: 'function' object has no attribute 'submit'
slate swan
boreal ravine
#

!d discord.Intents.guilds

unkempt canyonBOT
boreal ravine
slate swan
boreal ravine
#

o

lost wolf
#

how do i

pliant gulch
boreal ravine
pliant gulch
#

Well, if no intents are passed to the constructor your client identifies to the gateway with an intents value of 0. If you identify with Intents.default it will identify with an intents value of 32509, meaning all intents except for privileged ones

dim vapor
#

How to make a command both slash and a user command?
in pycord

lost wolf
patent surge
#

I got rate limit

quick gust
true forge
#

can anyone tell whats the error in this

@client.event
async def on_reaction_add(ctx, user, reaction):
    channel = reaction.message.channel
    if reaction.emoji == '๐ŸŽ€':
        await ctx.message.send('hoii')
maiden fable
cinder horizon
unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesnโ€™t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโ€™s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
maiden fable
#

It takes only reaction and user, nothing else

true forge
#

but if i want to send msg to a channel too then?

quick gust
#

you defined channel did u not? just do channel.send then

true forge
#

like this u mean?

#

the error is

maiden fable
#

message.channel.send or channel.send

true forge
#

i did channel.send

#

channel.message.send

#

is that wrong?

maiden fable
#

Yea

true forge
#

oh

hazy agate
#

am a coder

#

who wants to beat me

true forge
slate swan
maiden fable
hazy agate
boreal ravine
upbeat otter
hazy agate
#

sussy baka

maiden fable
#

Lmao

small igloo
#

how to prevent this error from showing and how long does this cooldown last?

slate swan
#

Don't use replit , this lasts for 3-4 hr usually

#

There's no fixed time

slate swan
slate swan
slate swan
#

pls help me

#

how i can show my bot ping in embed msg

#

?

slate swan
slate swan
slate swan
#

Regenerate it quickly

#

i want show my ping

slate swan
#

Regenerate the token first.

slate swan
#

Alr so whats the problem?

slate swan
#

Ping what?

#

Ah the latency

slate swan
#

can u write new code ?

#

Add f

#

So it will be a f str

#

oh that is works tnx

#

Yw

#

have is error

slate swan
#

Use only a f str?

#

yes

#

just adding f

#

Your using format and f str a f str does the same thing as format

#

what is new code

#

pls type that

#

im confused

#

Just delete .format

#

No need

small igloo
#

btw how to connect discord.py to some game renderer? like uh... unity smth

slate swan
small igloo
slate swan
small igloo
slate swan
#

No idea

small igloo
slate swan
small igloo
#

if i not wrong replit hav it's own hosting web, should i use it or friggin change to heroku

slate swan
#

Dont host your bot at that point

small igloo
#

waht why

slate swan
#

Im joking

#

Go for heroku

#

Limited tho

small igloo
#

sadge

slate swan
#

Its 3am and i need to wakeup at 6am so Bye guys๐Ÿšถ

quick gust
small igloo
slate swan
small igloo
slate swan
slate swan
#

๐Ÿ•ด๏ธ

small igloo
quick gust
slate swan
#

Now i will leave infernum have fun ๐Ÿšถ

quick gust
#

Yes gn

small igloo
slate swan
#

Gn

slate swan
#

Atlantic standard time๐Ÿ•ด๏ธ

small igloo
slate swan
#

๐Ÿšถ

slate swan
#

my stats command not working and dont have error ๐Ÿ˜

mellow barn
#

Hello, my command gives me an error that says: ```
Ignoring exception in command user:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 467, in _actual_conversion
return converter(argument)
TypeError: 'types.UnionType' object is not callable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1329, in invoke
await self.prepare(ctx)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 552, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 505, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "/usr/lib/python3.10/site-packages/discord/ext/commands/core.py", line 476, in _actual_conversion
raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "UnionType" failed for parameter "user".```
Code:

#
@_user.command(
        name="avatar", 
        description=_("castle.bot.commands:utility:user:avatar.description"),
    )
    async def avatar(self, ctx: commands.Context, user: User | int = None):
        user = self.bot.get_user(
            user.id
            if isinstance(user, User)
            else user
        )

        user.avatar_url_as(format="gif" if user.is_avatar_animated() else "png")

        async with ClientSession() as session:
            async with session.get(avatar) as response:
                image = await response.read()
        
        with BytesIO(image) as file:
            await ctx.send(
                "{0} {1}".format(
                    _("castle.bot.strings:utility:user:avatar.user_avatar"),
                    user
                ),
                file=discord.File(file)
            )
    ``` `_user` is `commands.Group`.
mellow barn
slate swan
#

stupid

#

tnx

small igloo
#

how to make custom playing status E

#

lol, 8 ball?

#

thanks ๐Ÿ˜„

unkempt canyonBOT
#

@rare roost Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!

small igloo
#

maybe the "f" is not neccesarry? just response

#

title=response, description="" (if u want blank)

#

try remove it and screenshot the error code

slate swan
#

File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 33, in on_ready
await channel.send(f"Fluxo is now online | Current Ping:"+ {bot.latency * 1000})
TypeError: can only concatenate str (not "set") to str

small igloo
#

hmm, try to change @commands.cooldown from bottom of @client.command() to the top of that

#

oh nvm, not like that, lemme see again...

quick gust
#

why have u passed self?

#

its not a class

#

wdym

#

ah alright no worries

small igloo
#

oh ok, nvm, found it

quick gust
#

where did game.reset() come from

mild birch
small igloo
quick gust
quick gust
mild birch
quick gust
#

okay

slate swan
#

"C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 33, in on_ready
await channel.send(f"Fluxo is now online | Current Ping:", {bot.latency * 1000})
TypeError: send() takes from 1 to 2 positional arguments but 3 were given

#

please don't judge me i dont kno much about f strings

weary gale
#

how can i embed a servers icon?

mild birch
weary gale
#

as a thumbnail

mild birch
weary gale
#

thx lol

#

set_thumbnail*

mild birch
#

No.

#

i meant for footer

#

for the thumbnail near title yes

weary gale
#

ye

#

thx

mild birch
#

okokokkkok

verbal cairn
small igloo
#

hi

mellow barn
#

You don't need self when it's not in a cog.

upbeat otter
mellow barn
slate swan
#

help plz

small igloo
upbeat otter
#

do NOT shit on the on_ready event, changing presence in on_ready makes your bot even more vulnerable to losing connection

untold token
#

Exactly

upbeat otter
untold token
#

Do not put any API calls in an on_ready event

mellow barn
#

It's not necessary because you're doing same thing while just giving your variable as keyword argument, giving f-string isn't actually needed if you're passing only one variable.

upbeat otter
slate swan
upbeat otter
mellow barn
# slate swan

Wrap your keyword arguments for better readability.

upbeat otter
#

close it

#

why not

untold token
#

No, you posted a wrong answer, so we fixed it

#

Never make API calls in an on_ready event

#

It's a dispatch event that can get called multiple times and if you make API calls the moment, your bot connects to discord Gateway, there is a high chance that Gateway will completely disconnect your bot

#

Use the bot constructor to set the status, when your bot gets online

#
bot = commands.Bot(..., activity=....)
untold token
velvet tinsel
#

If you want to code it on unity I guess you can learn C# and make discord bots from there

#

iirc there is a module for it

velvet tinsel
maiden fable
velvet tinsel
#

Bro

#

Itโ€™s just a simple hi

maiden fable
#

Hmm

velvet tinsel
#

๐Ÿ˜ญ

#

Spare me

slate swan
#

everyone how i can find server member with guild , i use {ctx.guild.owner.id} but bot say None !

velvet tinsel
#

Show code

slate swan
#

what's the ctx for mentoining a certain user or could i just do @slate swan

sullen shoal
#

Member and User object has an attribute called mention

#

that returns the string to be used to mention them

slate swan
#

soo.. mention(521325126722125874)?

sullen shoal
#

no?

slate swan
#

what is it then

sullen shoal
#

!d discord.Member.mention

unkempt canyonBOT
sullen shoal
#

im not going to explain basic use of classes here

velvet tinsel
rigid mesa
#

ImportError: DLL load failed while importing _brotli: Specified module not found.

#

how to fix

velvet tinsel
#

Have you tried pip install?

upbeat otter
velvet tinsel
#

Please

upbeat otter
#

lol

velvet tinsel
#

Stop bullying me

#

๐Ÿ˜ญ

upbeat otter
velvet tinsel
#

What

#

Did you just say

rigid mesa
velvet tinsel
#

I canโ€™t understand that language , but have you tried pip install?

sullen shoal
velvet tinsel
#

Did it work?

rigid mesa
#

PS C:\Users\Laxuzer> pip install _brotli
ERROR: Invalid requirement: '_brotli'

velvet tinsel
#

Have you tried it in the terminal?

upbeat otter
unkempt canyonBOT
upbeat otter
#

!pypi Brotli

velvet tinsel
#

And also whatโ€™s _brotli

unkempt canyonBOT
rigid mesa
velvet tinsel
#

Does it have an underscore behind it?

upbeat otter
#

Everybody ignores my answer

velvet tinsel
#

Which answer

rigid mesa
upbeat otter
velvet tinsel
#

The module doesnโ€™t exist

upbeat otter
#

,-,

velvet tinsel
#

With an underscore behind it

upbeat otter
#

they just simply ignored it

rigid mesa
# upbeat otter !pypi Brotli

PS C:\Users\Laxuzer> pip install brotli
Requirement already satisfied: brotli in c:\users\laxuzer\appdata\local\programs\python\python310\lib\site-packages (1.0.9)

already install

velvet tinsel
#

Or is it brotlipy?

#

Pip install brotlipy

velvet tinsel
#

I have no idea whatโ€™s happening

#

Listen to Eevee my brain is dead

rigid mesa
velvet tinsel
#

Itโ€™s Eevee

#

Thank Eevee

#

Not me

rigid mesa
#

@upbeat otterthanks

velvet tinsel
#

They gave the answer

upbeat otter
#

I'll just live in the shadows, its okay

upbeat otter
velvet tinsel
sullen shoal
#

does that thing even has to do anything with discord bots

velvet tinsel
#

โ€ฆ.no ig

upbeat otter
#

lol

velvet tinsel
#

We answered it anyways

#

I have a question

upbeat otter
#

yep?

velvet tinsel
#

How do you make a discord bot

upbeat otter
velvet tinsel
#

Omg tysm

upbeat otter
#

welcome

velvet tinsel
#

That answer changed my life

velvet tinsel
#

Ok

novel bolt
#

can we set multiple owner ids in commands.bot?

upbeat otter
novel bolt
#

like in this only my id is set

sullen shoal
#

!d discord.ext.commands.Bot.owner_id

unkempt canyonBOT
novel bolt
#

i want to add one more person

upbeat otter
sullen shoal
#

i dont think its possible

#

doesn't make sense either

velvet tinsel
#

I donโ€™t think and would work either

sullen shoal
#

only one person should own the bot

upbeat otter
novel bolt
novel bolt
upbeat otter
velvet tinsel
#

Teams there is a discord teams thing

novel bolt
novel bolt
upbeat otter
velvet tinsel
#

Yes

upbeat otter
#

thats where you create the app

novel bolt
#

oh

slate swan
#

i am trying to make a command which adds the argument in a txt file but the file isnt getting updated

@bot.command()
async def ban(ctx, *, argument):
    with open('curse.txt', 'w') as f:
        f.writelines(argument)
    await ctx.send(f'yoyo{argument}')
```help pls
upbeat otter
rigid mesa
#

how can i write an text to a file

sullen shoal
novel bolt
#

no problem then

#

thank u guys

upbeat otter
slate swan
upbeat otter
#

anyways, Myxi will help, igtg

sullen shoal
#

also that isn't async, it will block the entire script until the IO is complete

velvet tinsel
#

Myxi activate god mode

novel bolt
velvet tinsel
#

Yay

upbeat otter
velvet tinsel
#

What if theyโ€™re a girl?

novel bolt
novel bolt
#

lol

slate swan
velvet tinsel
slate swan
#

can anyone run me through something with sql real quick? ive got my primary command working fine with writing 3 arguments on the database file using sqlite3, now i have a secondary command in which im trying to make my bot read those arguments, using databases with sqlite3 how can i read the file?

velvet tinsel
slate swan
velvet tinsel
#

Alright then

slate swan
#

i need to know how i can make my secondary command read those columns in the database

sullen shoal
shadow wraith
#

when specifying an emoji arg, it has to be str right?

slate swan
#

how to download libopus DLLs?

#

or how to make an mp3 file opus encoded?

quick gust
slate swan
#
@bot.event
async def on_message(message):
    if message.author.id == bot.user.id:
        return
    msg_content = message.content.lower()

    with open('curse.txt', 'r') as f:
        f.readlines()

    if any(word in msg_content for word in f):
        await message.delete()
        await message.channel.send(f'bhasha bro {message.author.mention}')```
erro:
ValueError: I/O operation on closed file.
#

is the indentation wrong of with open?

maiden fable
#

Ah

#

No

#

U should do file_lines = f.readlines() and then use that variable

rigid mesa
#

how to send message to user with discum?

maiden fable
rigid mesa
#

!pypi discum

unkempt canyonBOT
heavy folio
#

how do i get the bot to reply to the mentioned user

maiden fable
#

Against ToS

heavy folio
#

not ctx.reply

#

e.g. i do this:

heavy folio
heavy folio
maiden fable
heavy folio
maiden fable
#

Ah

#

!d discord.Message.reference

unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

maiden fable
#

!d discord.MessageReference.resolved

unkempt canyonBOT
#

The message that this reference resolved to. If this is None then the original message was not fetched either due to the Discord API not attempting to resolve it or it not being available at the time of creation. If the message was resolved at a prior point but has since been deleted then this will be of type DeletedReferencedMessage.

Currently, this is mainly the replied to message when a user replies to a message.

New in version 1.6.

slate swan
#

how to download libopus DLLs?

#

or how to make an mp3 file opus encoded?

maiden fable
slate swan
heavy folio
maiden fable
heavy folio
#

got it thanks

craggy cloak
#

Every time after some time I restart my bot I have to install discord.ui again and then I get this error Someone who can help me?

valid perch
#

Are you making sure to install 2.x

craggy cloak
valid perch
#

Should work then

tacit horizon
#

how to use on_message with ctx

winter knoll
#

idk whats wrong im brand new to this

#

the 4th line capital C worked on the video and thats not the syntax error

verbal cairn
#

Itโ€™s a separate function

#

And the client.run(โ€œtokenโ€) is seperate as well

sullen shoal
#

looks like they're following freecodecamp's tutorial

winter knoll
#

oh ok ill try that

#

yeah i am

sullen shoal
#

don't follow that guy, his code is outdated and bad

winter knoll
#

ive only just started doing gcse coding

#

oh

#

i wanted to push myself so yh, thanks for the advice, ill find a different tutorial

sullen shoal
#

best way to learn discord bot development is by learning python's intermediate stuff and then have a look at the examples and docs

verbal cairn
#

Look over docs and the girhub

#

Git*, itโ€™s better than most yt tutorials

winter knoll
#

yeah ive heard github is really good, thanks!

sullen shoal
#

other ways will teach you how to make a specific thing working and you will be stuck doing absolute basic stuff

verbal cairn
#

But copy pasting code not knowing what itโ€™s doing isnโ€™t much of a push and wonโ€™t help u that much

sullen shoal
slate swan
#

friends

#

how i can use multiple commands like this

sullen shoal
#

like wjat

slate swan
slate swan
upbeat otter
slate swan
#

what

#

pls say code

upbeat otter
#

ask @slate swan

sullen shoal
#

yeah say code

upbeat otter
#

I'm going to sleep, bye

slate swan
# slate swan

use the aliases kwarg, also, they need to be a string

slate swan
#

no bro wtf

upbeat otter
#

smh

slate swan
#

that's literally basic python, you're on your own here

quick gust
slate swan
slate swan
slate swan
upbeat otter
#

"say" the code @slate swan

slate swan
#

๐Ÿ˜Ž

upbeat otter
quick gust
slate swan
unkempt canyonBOT
#

@discord.ext.commands.command(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or if called with [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.group "discord.ext.commands.group"), [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").

By default the `help` attribute is received automatically from the docstring of the function and is cleaned up with the use of `inspect.cleandoc`. If the docstring is `bytes`, then it is decoded into [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") using utf-8 encoding.

All checks added using the [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") & co. decorators are added into the function. There is no way to supply your own checks through this decorator.
slate swan
#

even gave you the docs smh

#

one of the attributes the .command can take

#

what is true code

#

that is ||code||

#

๐Ÿ˜‚

quick gust
#

makes no sense at all

slate swan
#

ngl i'm confused on how subclassing views work , i've understand buttons but views noCat . mind linking me some place that shows examples and stuff ?

coral vessel
#

How to make a Discord Bot reply to a specific message rather than every message including a word?

untold token
slate swan
#

oh shrug let me see

untold token
keen pelican
#

hello, I am getting an error in the backup software, everything is being copied but the channel permissions are not being copied can anyone help?

untold token
slate swan
rare shard
#

Hi what discord library shd i use now that discord.py is deprecated?

#

Any suggestions

quick gust
#

disnake

untold token
#

Well I use disnake

#

It's a very good library and supports all interactions

untold token
#

But if you want an entirely different library then use hikari

#

Hikari is very good

quick gust
keen pelican
#

cmd crashes and closes

quick gust
#

how do you "backup"

#

what is the error

keen pelican
boreal ravine
#

can I use a select menu and a wait_for method together?

untold token
#

But why

boreal ravine
untold token
#

Well I didn't try it, but ofcourse you cab

#

Can

boreal ravine
#

but like will it work?

untold token
#

You can always try it yourself

boreal ravine
#

i cant

#

im on mobile rn

slate swan
#

can you get guild by name?

coral vessel
#

bot.command not working if there is @bot.event writted
for example in the picture, how to make bot.command & bot.event work together?
my prefix blank I didn't fill it in.

twin moon
#
if any(word in message.lower() for word in guilds[str(message.guild.id)]["words"]):
    await message.channel.purge(limit=1)``` KeyError: Guild ID
untold token
#

This is event is overriding the default message event

#

and I would recommend you to use a listener

#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").

Example...
twin moon
# untold token Your complete traceback
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 42, in on_message
    if any(word in message.lower() for word in guilds[str(message.guild.id)]["words"]):
KeyError: '894122745271566356'```
#

@untold token

upbeat otter
#

its simply written there

twin moon
upbeat otter
twin moon
#

so what should I do?

upbeat otter
#

your code please

twin moon
# upbeat otter your code please
async def update_guild(message):
  with open("guilds.json","r") as f:
    guilds = json.load(f)
  if not str(message.guild.id) in guilds:
    guilds[str(message.guild.id)] = {}
    guilds[str(message.guild.id)]["words"] = []
    with open("guilds.json","w") as f:
      json.dump(guilds,f,indent=2)

@client.event
async def on_message(message):
  with open("guilds.json","r") as f:
    guilds = json.load(f)
    await update_guild(message)

  if any(word in message.lower() for word in guilds[str(message.guild.id)]["words"]):
    await message.channel.purge(limit=1)```
upbeat otter
#

<indentation>

slate swan
#

Any good library out there for util commands on my bot? I have a google crawler and a wiki command atm

upbeat otter
slate swan
upbeat otter
slate swan
#

it doesn't really matter, do u guys know any fun or good library for bot commands

twin moon
# upbeat otter your update_guild and the if statement should be outside the with open()
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 42, in on_message
    if any(word in message.lower() for word in guilds[str(message.guild.id)]["words"]):
  File "main.py", line 42, in <genexpr>
    if any(word in message.lower() for word in guilds[str(message.guild.id)]["words"]):
AttributeError: 'Message' object has no attribute 'lower'```
slate swan
upbeat otter
#

,-,

slate swan
upbeat otter
patent bluff
#

you could try doing text commands

#

etc snakecase, camelcase

slate swan
# upbeat otter ~~then~~

A library such as google crawler or wiki that lets the user do fun stuff, it could be anything

upbeat otter
#

@slate swan when you call the on_ready event you can do this

import sys #at the top of course 

@client.event
async def on_ready():
  sys.exit()
  print("have fun")
slate swan
#

wait what the

#

torture lemon_angrysad

#

why not do it in a esoteric way xD

upbeat otter
upbeat otter
#

thank me later

#

@slate swan You can use the google module to do google searches

slate swan
upbeat otter
unkempt canyonBOT
slate swan
#

in the event

upbeat otter
sinful pasture
#

is there a way to have a bot restart itself?

jovial osprey
#

is there something like "button_click.author" ?

#

im trying to do a ticket system that when you click a button you would be added to a text channel but by name not by role

tawdry smelt
#

hello so im trying to make my bot delete a role from the server i use guild.roles and specifie what one to delete yet it doesnt delete it and i cant seem to see why not, it has admin it can delete other things just not roles, the role of the bot is higher than what it is trying to delete

manic wing
unkempt canyonBOT
#

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

Closes the connection to Discord.
manic wing
unkempt canyonBOT
#

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

Deletes the role.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.
tawdry smelt
#

this is an error but it doesnt make any sense

#

since if i print the list of guild.roles it shows correct

#

then i use await role.delete()

manic wing
#

how did you get your role instance?

#

did you do guild.roles? because that returns a list

tawdry smelt
#

i do that

upbeat otter
manic wing
#

what role do you want to delete? you can't delete all of them

tawdry smelt
#

for role in guild.roles:

manic wing
upbeat otter
tawdry smelt
#

cause i have to loop all the roles

jovial osprey
#

can someone please answer me ?

tawdry smelt
#

to see what one has the right name

manic wing
upbeat otter
tawdry smelt
jovial osprey
upbeat otter
tawdry smelt
twin moon
#
if amount.lower() == "all":
    amount = int(guilds[str(ctx.guild.id)]["warns"][str(member.id)])```

```json
{
  "894122745271566356": {
    "words": [],
    "warns": {
      "770210759359070209": 4
    }
  }
}```Failed to convert from string to int
tawdry smelt
#

im not trying to delete using the whole list

manic wing
manic wing
#

@everyone is the first index in guild.roles, so thats why its erroring

tawdry smelt
#

so it would pass that still doesnt delete other

twin moon
upbeat otter
twin moon
upbeat otter
twin moon
upbeat otter
manic wing
maiden fable
jovial osprey
upbeat otter
maiden fable
#

๐Ÿ˜

#

ML?

quick gust
#

machine learning

manic wing
#

martin luther

maiden fable
#

O

upbeat otter
quick gust
jovial osprey
upbeat otter
#

not just a single line

tawdry smelt
#

i just havving to specifie directly from the list

upbeat otter
#

and I dont think colons are a thing like that

maiden fable
#

Yes they ain't

jovial osprey
# upbeat otter the codeblock
@bot.command()
@commands.guild_only()
@commands.has_guild_permissions(manage_channels=True)
@commands.bot_has_guild_permissions(manage_channels=True)
@commands.has_role("ใ€Œ๐Ÿ’ปใ€ Bot Developer")
async def skin(ctx):
    embed = discord.Embed(
        title = "Vytvorenie skinu",
        description = "Toto je popisok.",
        colour = discord.Colour(0x80ff80)
        )

    embed.set_footer(text="bot made by samuelll hehe")
    embed.add_field(name="Meno poฤพa", value="Nieฤo 1", inline=False)
    await ctx.send(embed=embed)
    await ctx.send(type=InteractionType.ChannelMessageWithSource, content="Len testujem buttny", components=[Button(style=3, label="Default Button", custom_id="button")])

    res = await bot.wait_for("button_click")    
    role = discord.utils.get(ctx.author.guild.roles, name="cekam na skin voe")
    await ctx.author.add_roles(role)
    await res.respond(content="Otvoril si ticket !" )
    overwrites = {
    ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
    ctx.guild.me: discord.PermissionOverwrite(read_messages=True),
    role: discord.PermissionOverwrite(read_messages=True),
    variable.user: discord.PermissionOverwrite(read_messages=True)
    }
    channel = await ctx.guild.create_text_channel(name="objednavka - skin", overwrites=overwrites, category=bot.get_channel(902994748556574740))
upbeat otter
#

smh

#

where's the error?

manic wing
#

these checks gonna make me act up

#

your code is looking christmasy with all these decorations ;)

slate swan
#

i am trying to add emoji in ad text but its not replying with anything

@bot.command()
async def test(ctx):
    message = await ctx.send('test')
    emoji = '<rick_roll:899653182081351680:>'
    await message.add_reaction(emoji)```
jovial osprey
# upbeat otter where's the error?

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Object of type member_descriptor is not JSON serializable

manic wing
#

get it? decorators...

dapper cobalt
jovial osprey
upbeat otter
twin moon
dapper cobalt
#

!e

data = {
  "subdata": {
    "a": "b",
    "c": "d"
  }
}

subdata_count = len(data["subdata"])
print(subdata_count)
manic wing
unkempt canyonBOT
#

@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.

2
maiden fable
#

what's the error @jovial osprey

jovial osprey
upbeat otter
dapper cobalt
upbeat otter
dapper cobalt
#

Show me your code.

upbeat otter
#

@jovial osprey it will be- res.user

jovial osprey
# upbeat otter huhhh

when i replaced variable with discord.user (found it on discord_components) i got this TypeError: Object of type member_descriptor is not JSON serializable

slate swan
#

what to do if on_message ate all comands?

maiden fable
#

Imagine studying

maiden fable
slate swan
jovial osprey
upbeat otter
verbal cairn
boreal ravine
#

!d discord.ext.commands.Bot.process_commands

unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the messageโ€™s author is a bot and doesnโ€™t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
boreal ravine
#

requires an argument

#

don't forget that ๐Ÿ™

manic wing
#

oh kayles here

#

yeah you do notbot.process_commands(member)

boreal ravine
#

notbot MUST be a commands.Bot/discord.Client object though

upbeat otter
manic wing
#

thats the point

manic wing
#

๐Ÿคฆ

#

๐Ÿคฆโ€โ™€๏ธ

boreal ravine
#

anyways can I ask for api help here I keep getting 401 code when trying to run my bot

maiden fable
#

Sure

upbeat otter
boreal ravine
#

I don't know why it's unauthorized

manic wing
boreal ravine
#

cry about it

manic wing
#

she did on_member_join(ctx)

manic wing
maiden fable
boreal ravine
manic wing
upbeat otter
slate swan
verbal cairn
#

bot might not be bot idk

manic wing
verbal cairn
#

Also u need the argument

boreal ravine
slate swan
# verbal cairn bot might not be bot idk
@bot.listen()
async def on_message(message):
    if message.author.id == bot.user.id:
        return
    msg_content = message.content.lower()

    with open('curse.txt', 'r') as f:
        hm = f.readlines()

    if any(word in msg_content for word in hm):
        await message.delete()
        await message.channel.send(f'Watch Your Language {message.author.mention}')
        await bot.process_commands()

i even changed listen to event but still

manic wing
maiden fable
verbal cairn
#

bot.event

#

Idk why ur using listen

maiden fable
#

U specified a space?

boreal ravine
maiden fable
#

Okay

#

Can I see where u r passing them?

boreal ravine
verbal cairn
#

bot.process_commands(message) also

boreal ravine
maiden fable
unkempt canyonBOT
#
class aiohttp.ClientSession(base_url=None, *, connector=None, cookies=None, headers=None, skip_auto_headers=None, auth=None, json_serialize=json.dumps, ...)```
The class for creating client sessions and making requests.
maiden fable
#

Try using that

boreal ravine
#

okay

upbeat otter
boreal ravine
#

im still getting unauthorized

maiden fable
#

Still?

quick gust
boreal ravine
#

code looks like this ```py

        async with ClientSession(headers=headers) as session:
            async with session.post(
                f"https://discord.com/api/v9/channels/{voice_channel}/invites",
                json=data,
            ) as raw:
shadow wraith
#

๐Ÿค” how do check if a member has a role with if statement

maiden fable
#

Can u remove half the token and then show the code with the headers?

upbeat otter
maiden fable
shadow wraith
stiff nexus
#

help?? this works fine but when it creates the role it wont send setup completed ```py
@commands.command()
async def setmute(self, ctx):
role = discord.utils.get(ctx.guild.roles, name="Muted")
if role:
await ctx.error(f"This guild already has the {role.mention} role.")
return
try:
new_role = await ctx.guild.create_role(name="Muted")
for channel in ctx.guild.channels:
await channel.set_permissions(new_role, send_messages=False)
await ctx.send(f"Setup completed, I have create the {new_role.mention} role.")
return
except:
pass

shadow wraith
#

crab game

maiden fable
#

!d discord.Guild.get_role

unkempt canyonBOT
maiden fable
#

!d discord.Member.roles

unkempt canyonBOT
#

property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [โ€˜@everyone](mailto:'%40everyone)โ€™ role.

These roles are sorted by their position in the role hierarchy.
shadow wraith
#

oh

shadow wraith
maiden fable
#

ctx.author.roles

shadow wraith
#

aww man you can only get the user of the command?

boreal ravine
shadow wraith
#

:c

maiden fable
manic wing
#

i didnt even call him an idiot, i just said dont be an idiot

jovial osprey
#

is it possible to make a text channel with name of the one who requested ? i tried with py name="objednavka"+res.user
i get this error :

maiden fable