#discord-bots

1 messages · Page 659 of 1

cloud dawn
#

Okay but this is Python server..

full valley
cloud dawn
#

yes i noticed i still sended the wrong one

full valley
#

I've coded a discord python bot, but ive installed discord js things

cloud dawn
#

Why..?

full valley
#

I was brainlessly following a tutorial

#

I dont wanna talk about it KEKW

#

Until I remembered I wrote the 2000 lines of code in python

cloud dawn
full valley
cloud dawn
full valley
slate swan
cloud dawn
slate swan
#

@cloud dawn please help ( i dmed you )

severe field
#

how to connect a bot to voice? using Message

cloud dawn
cloud dawn
full valley
#

how can I pip install a certain discord version

severe field
slate swan
cloud dawn
full valley
#

do I need py -m?

cloud dawn
unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

cloud dawn
unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

This requires [`Intents.voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
full valley
#

can I just do pip3 install discord==1.7.3?

cloud dawn
slate swan
cloud dawn
#

I don't want to make you feel uncomfortable but i prefer it here.

#

You can also send the part that isn't working instead of the whole code and tell us what isn't working.

tawdry perch
#

You have better changes of getting help in this channel than in DMs afaik

severe field
#

why my bot saying that i'm not in voice?

tawdry perch
#

You were not in voice channel?

severe field
#

i'm was in voice channel

tawdry perch
#

Show the code + trackback?

slate swan
#

Problem:
Nothing happens when used

severe field
#

sorry i just needed to install PyNaCl

cloud dawn
verbal cairn
#

anyone know how to access rich presence

slate swan
#

!d discord.Member.activities

unkempt canyonBOT
#

The activities that the user is currently doing.

Note

Due to a Discord API limitation, a user’s Spotify activity may not appear if they are listening to a song with a title longer than 128 characters. See GH-1738 for more information.

slate swan
cloud dawn
slate swan
#

print in console instead?

#

if so please tell me how

#

just check the member_count , see if its below 5 , if True , leave it

steep estuary
#

i lost my discord bot's file and code but it is in heroku, how i can download it ?

slate swan
#

!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").
cloud dawn
cloud dawn
#

😉

slate swan
slate swan
#

it will

steep estuary
#

is there any way to download my app's files and folders from heroku ?

steep estuary
#

ok

slate swan
#

or if you have jishaku or something in your bot just make it send all the files

steep estuary
#

idk about jishaku

slate swan
shadow wraith
#

basic question, how do you basically like send a user a message with ctx/context

steep estuary
#
heroku git:clone -a APP-NAME
heroku slugs:download -a APP_NAME

these 2 commands are enough to download the source code and files ?

slate swan
#

you should filter the guilds as soon as the bot joins a guild tbh

slate swan
#

didn't leave anything

#

nvj im stoopid

slate swan
shadow wraith
#

how could you do the same like this in ctx 🤔

slate swan
#

ctx.author.send

slate swan
shadow wraith
slate swan
#

oh the person who uses the command?

#

acey sent it

shadow wraith
#

yes

slate swan
# cloud dawn ```py @client.command() async def server(self, ctx): for guild in client.gui...

Ignoring exception in command server:
Traceback (most recent call last):
File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\ADMIN\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing.

shadow wraith
#

bruh define ctx

slate swan
#

also you cant dm a user only members

slate swan
slate swan
shadow wraith
shadow wraith
verbal cairn
#

so rich presence anyone

shadow wraith
#

still geniunely correct

verbal cairn
#

for disnake

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

you can

slate swan
unkempt canyonBOT
#

The activities that the user is currently doing.

Note

Due to a Discord API limitation, a user’s Spotify activity may not appear if they are listening to a song with a title longer than 128 characters. See GH-1738 for more information.

slate swan
#

you cant it will return an error cuz you can only dm a person that has a mutual guild with the bot

#

a user can share a guild with the bot too

verbal cairn
cloud dawn
slate swan
verbal cairn
slate swan
#

!d disnake.ext.commands.Bot.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = disnake.Game("with the API")
await client.change_presence(status=disnake.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
verbal cairn
#

ty

slate swan
shadow wraith
#

so something similar to the code below is what i should do

var = bot.get_id(ctx.author.id)
await var.send("bru")
slate swan
#

dont get it

#

just ctx.author.send

#

^^^

shadow wraith
#

🤔 alright

#

oh yeah and would some handling inside a command like this still work becuase i didnt get the dm

@bot.command()
@commands.has_any_role(914534709986467890, 912631582681092117)
async def warm(ctx: commands.Context, member: discord.Member):
    if member not in ctx.guild.members:
        await ctx.message.delete()
        await ctx.author.send("That is not a valid member to bean!")
    else:
        Warmed = discord.Embed(title=f"{member} has been warmed", description=f"{member} has been         warmed", color=discord.Colour.gold())
    await ctx.send(embed=Warmed, view=KCIHM)
#

and yes kcihm class exists

#

was trying to figure out how to get buttons working in a discord bot host

slate swan
#

member is in the ctx.guild.members simple

shadow wraith
#

what about elif ok

verbal cairn
slate swan
#

do you get some error ? if no
do you have an error handler ? if yes
add else : raise error in it

verbal cairn
#

its just online, offline, idle, or dnd right?

slate swan
cloud dawn
slate swan
#

bots cannot have rich presence for now

verbal cairn
#

cant js bots have rich presence

slate swan
#

none of the bots can have it

verbal cairn
#

oh

#

nvm ic

cloud dawn
#

They indeed cannot, at most the about me page.

cloud dawn
shadow wraith
#
@bot.command()
@commands.has_any_role(914534709986467890, 912631582681092117)
async def warm(ctx: commands.Context, member: discord.Member):
    if member in ctx.guild.members:
        Warmed = discord.Embed(title=f"{member} has been beaned",description=f"{member} has been beaned.", color=discord.Colour.gold())
    else:
        raise Error
``` 🤔
#

no output stil

#

wait lemme try is in

slate swan
cloud dawn
slate swan
#

Anyone who’s experienced with bots I need help with making embedded leaderboard bot that you can give points with command

slate swan
cloud dawn
slate swan
shadow wraith
#

i have no idea if and else statements which check your commands and are known as "checks" can also be considered error handlers ¯_(ツ)_/¯

slate swan
#

I’m semi New to coding I’ve coded for 8 months but I’m still skidd as I don’t Know any good python tutorials for discord bots

shadow wraith
#

wait i just realized what you meant by error handlers

#

like @<cmd>.error

#

wait im literally stupid i couldve just done

#

!d discord.ext.commands.BadArgument

unkempt canyonBOT
#

exception discord.ext.commands.BadArgument(message=None, *args)```
Exception raised when a parsing or conversion failure is encountered on an argument to pass into a command.

This inherits from [`UserInputError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.UserInputError "discord.ext.commands.UserInputError")
shadow wraith
#

im stupid

earnest ferry
#

yo @slate swan @prisma spoke ur guiding plz?

earnest ferry
#

coding obv!

#

u know downloaded vsc

prisma spoke
earnest ferry
#

now how to run it??\

prisma spoke
#

Bruh

cloud dawn
#

we are getting presents! 🥳

prisma spoke
#

u pinged for this?

earnest ferry
#

the code breh

prisma spoke
earnest ferry
#

afer itz??

prisma spoke
#

test ur bot then if it shows no errors

#

bruh u r noob in tech

#

alright so whos familiar with pillow here?

earnest ferry
#

breh... will ya shut up?? my mistake i pinged u

slate swan
#

Good day mates

earnest ferry
#

yo bro

#

taco ?? pokeventure mod??

prisma spoke
slate swan
earnest ferry
verbal cairn
#

So in disnake it says to await bot.change_presence(self, *, activity, status)

prisma spoke
verbal cairn
#

But how do u actually implement that

earnest ferry
slate swan
prisma spoke
#

its a complicated question

#

needs a complicated math

verbal cairn
slate swan
earnest ferry
#

nais ig discord gona leak nitro codes

verbal cairn
earnest ferry
#

@slate swan u are Indian? (ofc im indian and christian)

verbal cairn
#

Idk like where to add it

prisma spoke
#

but who tf cares bout religion

slate swan
#

I love my indians bros

prisma spoke
#

i am not christian

verbal cairn
#

Like is there a bot event for it or do I add it when loading a cog

prisma spoke
earnest ferry
slate swan
earnest ferry
slate swan
#

Lol

earnest ferry
#

okimi what new file? to open?

prisma spoke
#

anyways back to the topic.. does nyone know pillow?

earnest ferry
#

it asked to mention the name

prisma spoke
earnest ferry
#

enter python??

prisma spoke
#

learn computers before using it please

visual island
slate swan
earnest ferry
prisma spoke
earnest ferry
#

askin to mention

visual island
#

ik

earnest ferry
#

animated

slate swan
# earnest ferry

Oh no just in file press new and then it will ask language and type in python

earnest ferry
#

ohk thanks

prisma spoke
slate swan
#

Looks clean to me

prisma spoke
visual island
earnest ferry
#

ye ikr?

#

lel

earnest ferry
#

okimmi

slate swan
earnest ferry
#

kay

verbal cairn
#

await self.bot.change_presence(activity=disnake.Game("**with /bazaar**"))

#

that is essentially what I want to do

#

but idk a good place to implement that

slate swan
earnest ferry
#

oo

slate swan
earnest ferry
#

new file?

#

@slate swan ?

slate swan
earnest ferry
#

thanks!

slate swan
#

Ywpithink

earnest ferry
#

wait?

#

its askng download python

kindred drum
#

yo AttributeError: 'RawReactionActionEvent' object has no attribute 'role'

async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
    if payload.member.bot:
        return 
    channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
    if str(payload.emoji) == "👍":
        if payload.role.id != 915363576867344435:``` anyone know the thing I use?
earnest ferry
#

if we dont download the python we cant code? @slate swan

slate swan
verbal cairn
slate swan
slate swan
slate swan
kindred drum
earnest ferry
slate swan
#

dk how to describe it

kindred drum
slate swan
kindred drum
#

for a command that doesn't work

slate swan
#

i did, its in the pastebin

kindred drum
#

send the one that works

slate swan
#

its a basic help command, below the event

earnest ferry
#

@slate swan

kindred drum
#

@commands.check(checkk)

slate swan
#

its not some over the top code its just a command + embed

kindred drum
#

remove that line and try

slate swan
slate swan
kindred drum
earnest ferry
slate swan
#

alright ill let you know if anything changes

slate swan
earnest ferry
#

exe.??

kindred drum
slate swan
earnest ferry
#

ohk

earnest ferry
#

okimmi click on install now?

slate swan
slate swan
earnest ferry
#

now?

slate swan
#

Install now

earnest ferry
#

click on it?

slate swan
#

Yes

earnest ferry
#

downloadin

slate swan
#

Alright

tiny ibex
#

How is installing python related to discord bots?

slate swan
#

i went and removed the event for a second as well, same thing. nothing happens

#

and i dont get errors either pepeugh

earnest ferry
slate swan
#

theres no global or local handlers so irdk

tiny ibex
tiny ibex
#

Cuz installation of a program is not related to discord bots at all

#

As a matter of fact that's not even related to coding

slate swan
tiny ibex
final iron
#

Now that's just false

slate swan
tiny ibex
#

Installation of a program is not related to coding

slate swan
tiny ibex
final iron
#

Installation of python is

tiny ibex
#

So installation of spotify is listening to Spotify?

#

From that logic looks like that

slate swan
#
@bot.command()
async def verify(ctx):
    embed = discord.Embed(title=f'Verification', description=f'You have `1` attempt to verify. If you fail, you may be re-evaluated by executing the command again', color=clr)
    failbed = discord.Embed(title=f'Verification', description=f'You have failed the verification process! Please try again', color=clr)
    passbed = discord.Embed(title=f'Verification', description=f'You have passed the verification process! Enjoy your stay', color=clr)
    captcha = random.randint(1, 4)
    if captcha == '1':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283179843452970/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'KZEXEH':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)
    elif captcha == '2':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283141130006578/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'SXOXMM':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)
    elif captcha == '3':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283129163669524/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'KHBLHC':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)
    elif captcha == '4':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917282861734842418/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'GVPWVK':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)``` no errors, dont know what to do
#

yikes i didnt realise how big that was sorry

tiny ibex
#

Not before installing

slate swan
tiny ibex
#

Installation of any program is not related to coding

final iron
earnest ferry
#

hu??

#

what the hec

tiny ibex
slate swan
#

Spotify Installer > spotify > listen to music

earnest ferry
#

ye

slate swan
#

How is that not related

final iron
slate swan
#

Exactly

dusk pumice
#

How to add reaction to user's message???

earnest ferry
#

ye

tiny ibex
#

Ok then

final iron
slate swan
earnest ferry
#

my my lol

tiny ibex
earnest ferry
#

@slate swan now?/

slate swan
#

what else will you use python for ? except for if you use linux

tiny ibex
#

So the question doesn't fit here

earnest ferry
tiny ibex
slate swan
slate swan
dusk pumice
#

I mean users message

#

XD

verbal cairn
#
    @tasks.loop(hours=1.0)
    async def status(self):
        member_count = sum([count.member_count for count in self.bot.guilds])
        await self.bot.change_presence(activity=disnake.Game(f"with {member_count} Users!"))

but I get this traceback

Unhandled exception in internal background task 'status'.
Traceback (most recent call last):
  File "C:\Users\Vader\PycharmProjects\pythonProject1\venv\lib\site-packages\disnake\ext\tasks\__init__.py", line 166, in _loop
    await self.coro(*args, **kwargs)
  File "C:\Users\Vader\PycharmProjects\pythonProject1\taskscog.py", line 114, in status
    await self.bot.change_presence(activity=disnake.Game(f"with {member_count} Users!"))
  File "C:\Users\Vader\PycharmProjects\pythonProject1\venv\lib\site-packages\disnake\client.py", line 1417, in change_presence
    await self.ws.change_presence(activity=activity, status=status_str)
AttributeError: 'NoneType' object has no attribute 'change_presence'
slate swan
slate swan
earnest ferry
slate swan
#

Yeah

tiny ibex
visual island
#

oops

#

!d discord.ext.commands.Bot.wait_until_ready

unkempt canyonBOT
#

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

Waits until the client’s internal cache is all ready.
earnest ferry
verbal cairn
# visual island the bot isn't ready yet
@tasks.loop(hours=1.0)
    async def status(self):
        await self.bot.wait_until_ready()
        member_count = sum([count.member_count for count in self.bot.guilds])
        await self.bot.change_presence(activity=disnake.Game(f"with {member_count} Users!"))
#

ty, that worked, the code looks good

earnest ferry
visual island
verbal cairn
#

well, idk if im supposed to use the wait until ready there every time

slate swan
#

Why does everybody say my name with one i 😭

tiny ibex
#

How to get a user's hypesquad badge?

earnest ferry
#

tnaks

maiden fable
#

!d discord.User.public_flags

unkempt canyonBOT
maiden fable
#

@tiny ibex

tiny ibex
earnest ferry
tiny ibex
#

It returns all the badges ig?

slate swan
maiden fable
#

Yea

#

!d discord.PublicUserFlags

unkempt canyonBOT
#

class discord.PublicUserFlags```
Wraps up the Discord User Public flags.

x == y Checks if two PublicUserFlags are equal.

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

hash(x) Return the flag’s hash.

iter(x) Returns an iterator of `(name, value)` pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.

New in version 1.4.
tiny ibex
#

How to find the hypesquad one?

maiden fable
#

!d discord.PublicUserFlags.hypesquad

unkempt canyonBOT
tiny ibex
#

Ah thanks

maiden fable
#

!d discord.PublicUserFlags.hypesquad_bravery

unkempt canyonBOT
tiny ibex
#

Understood

maiden fable
#

That events is the yellow badge

#

U gotta do hypesquad_name

tiny ibex
#

Alr

#

Tysm

kindred drum
#

yo why does not search through the file and pass? py if newRole in Json_Items[i][x]['roles']: print("passed as they have this role") pass else: print(newRole) Json_Items[i][x]['roles'].append(str(newRole)) json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1) print(Json_Items[i][x]['roles']) just ignores the if x in x

verbal cairn
kindred drum
tropic briar
#

Is it possible to create a graph showing member count in the last week or maybe month or anything

verbal cairn
unkempt canyonBOT
summer flume
#

how to add time on embed footer

maiden fable
lament mesa
maiden fable
#

In the embed constructor

summer flume
#

thanks

slate swan
#
  SolverProblemError

  Because no versions of discord match >1.7.3,<2.0.0
   and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
  Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
   and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
  Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
  So, because repl-python3-rabdi depends on both aiohttp (^3.8.1) and discord (^1.7.3), version solving failed.

  at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238except OverrideNeeded as e:
      239return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240except SolveFailure as e:
    → 241raise SolverProblemError(e)
      242243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes
exit status 1

#

what is error

maiden fable
#

What u tryna install?

slate swan
#

nothing

maiden fable
#

😐

slate swan
#

just run

#

python main,py

maiden fable
#

Hmmmm

slate swan
maiden fable
#

Idrk, seems like a poetry problem

earnest ferry
#

@slate swan i ran the code and debugged it but no its still offline

slate swan
#

Show

earnest ferry
#

see bro any mistake?

slate swan
#

Regenerate your token btw

earnest ferry
#

i will

#

tell the problem

vague gulch
#

Can someone give me the code of the voting bot, it doesn't need to be complete

royal lichen
boreal ravine
#

!d disnake.ext.commands.Bot.run

#

oops

royal lichen
#

remove the spaces before bot.run

visual island
#

it supports disnake?

boreal ravine
boreal ravine
slate swan
visual island
#

oh

boreal ravine
slate swan
boreal ravine
#

or he has that weird "module not resolved" bug which you can fix by changing your interpreter iirc

slate swan
# earnest ferry ohk
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!",help_command=None)

@bot.event 
async def on_ready():
     print("Your bot is ready") 

@bot.command() 
async def hello(ctx):
    await ctx.send("whatsup") 

@bot.command()
async def send(ctx,arg):
    await ctx.send(arg) 
    
bot.run("TOKEN")

basic bot

boreal ravine
#

the run functions in one file

earnest ferry
#

ohk thanks

slate swan
quaint epoch
#

does anyone know why bot's pinged went up FOUR TIMES?!

slate swan
#

u can also do like case_intensive = true/fasle in ur commands.bot

#

and other stuff

boreal ravine
slate swan
#

i just never use it lol

quaint epoch
visual island
quaint epoch
boreal ravine
# slate swan i just never use it lol

eh, I've seen people do weird shit py @bot.command( aliases = ('ping', 'PING', 'pong', 'pING', 'pinG',) ) and they don't even know that a case_insensitive kwarg exists

quaint epoch
#

i def knew that it existed...

quaint epoch
slate swan
#

i know it exist i just dont really care lol

boreal ravine
# quaint epoch yes

what do you mean? give more context
if you mean messages dont get deleted after you delete them, that looks like a you issue

quaint epoch
#

it's only happening now

boreal ravine
visual island
quaint epoch
#

not the latency itself

#

and, whenever i enter a limit for my command on my server, >>>purge 10I have to refresh discord, but the default limit=10 in the code, and it DOESN'T require refreshing then

earnest ferry
#

okimii see

slate swan
#

and regen your token

quaint epoch
earnest ferry
slate swan
#

pip install discord

slate swan
quaint epoch
earnest ferry
#

link me

slate swan
#

i mean pip installl discord does install discord.py so just do that

#

@earnest ferry press alt + r then type cmd and just type pip install discord

#

or u can just use the terminal

quaint epoch
slate swan
earnest ferry
quaint epoch
slate swan
#

i kinda advise u to learn more py then getting into discord.py

quaint epoch
earnest ferry
#

wait with space or without sapce?

slate swan
#

with

quaint epoch
#

bruh

slate swan
#

just copy pip install discord into ur cmd

quaint epoch
#

just copy it

earnest ferry
#

cmd pip install discord

#

lol

slate swan
#

cntrl +r/ type cmd then do pip install

earnest ferry
#

nothing happended

#

happened

slate swan
#

win*

quaint epoch
#

just open your commandline, and type in pip install discord

slate swan
#

just open run

#

windows key + r

#

type cmd in it

quaint epoch
#

fuck i accidentally did pip install discor

earnest ferry
#

how to open command line? (im sorry i dont know)

quaint epoch
slate swan
#

are u using windows

earnest ferry
#

ye

#

ohhhh

slate swan
#

no u type cmd in it

quaint epoch
#

type in CMD in the run window

#

not pip install discord

earnest ferry
slate swan
#

yeah

#

click ok

earnest ferry
#

now

quaint epoch
earnest ferry
quaint epoch
#

nice

earnest ferry
#

this opened

slate swan
#

yeah now do pip install

earnest ferry
#

type there?

quaint epoch
#

now type in pip install discord

quaint epoch
earnest ferry
#

like this?\

slate swan
#

yea

quaint epoch
earnest ferry
#

ok

quaint epoch
earnest ferry
#

ok

mystic grotto
#

getting this error while making a leveling bot
ive installed pip install discord, pip install pymongo and pip install dnspython

slate swan
#

send ur code

quaint epoch
#

yeah

slate swan
#

ur getting an attribute error

earnest ferry
mystic grotto
#

ye

quaint epoch
#

you prob got a wrong object

#

happened to me so many times

mystic grotto
slate swan
earnest ferry
#

wha-

mystic grotto
slate swan
#

u ddint install pip in the process

#

or u can use cmd again to install pip

boreal ravine
quaint epoch
mystic grotto
boreal ravine
#

ah it should work

quaint epoch
#

don't uninstall python, because version 3.4+ come w/ pip

earnest ferry
quaint epoch
earnest ferry
#

enter?

quaint epoch
earnest ferry
#

see

royal lichen
quaint epoch
#

reinstall python

slate swan
#

yeah u dont have pip installed

royal lichen
#

py -m ensurepip

earnest ferry
#

what is pip??

slate swan
#

u use pip

#

to install libraries

royal lichen
quaint epoch
earnest ferry
#

k

quaint epoch
#

ensurepip.bootstrap() does what again?

royal lichen
#

ensures that pip is installed, and if not installs pip

quaint epoch
slate swan
#

@earnest ferry i still advise you to learn more py then coming to discord.py because u will face obstacles

royal lichen
#

Yeah I was annoyed when i found this out

earnest ferry
#

ok thnx synthethic

royal lichen
#

ages of not knowing it existed, and it turned out to be one command

earnest ferry
quaint epoch
quaint epoch
earnest ferry
#

clicked enter

slate swan
#

result?

quaint epoch
earnest ferry
#

c:\Users\Public\Documents\Wondershare\CreatorTemp\tmptq_urln_
Processing c:\users\public\documents\wondershare\creatortemp\tmptq_urln_\setuptools-58.1.0-py3-none-any.whl
Processing c:\users\public\documents\wondershare\creatortemp\tmptq_urln_\pip-21.2.4-py3-none-any.whl
Installing collected packages: setuptools, pip

slate swan
#

yeah ur good

earnest ferry
#

what it mean?

royal lichen
#

ensurepip, from what i understand, is just a very specific utility made to install pip itself, as such it doesnt need much of the complexity of pip

slate swan
#

its downloading

earnest ferry
#

ohk

quaint epoch
earnest ferry
#

how muuch time to download

slate swan
#

like 2 sec

quaint epoch
#

bro i REALLY suggest you go ahead an learn about objects and classes before discord.py otherwise it will be HELL

slate swan
#

kinda disagree with OOP but yeah

royal lichen
quaint epoch
#

git gud

slate swan
#

@slate swan in 13 saleshone

quaint epoch
mystic grotto
earnest ferry
#

so... they didnt tell us abot python

#

now run the code????

slate swan
#

like u kinda need to know what ur writing

earnest ferry
#

oh..

quaint epoch
earnest ferry
#

wth

#

well nvm

slate swan
#

does ur school teach u?

quaint epoch
#

i don't trust the school system when it comes to optional stuff because they will just sleep on it

royal lichen
#

Hey at least you didnt have to learn in java 🥲

quaint epoch
earnest ferry
slate swan
#

if school teaches u , i advise u to learn it urself

quaint epoch
#

the school teachers are shit at programming

slate swan
#

like i rmemeber they were teaching us c++ in school

slate swan
#

and we wrote them on a piece of paper

earnest ferry
mystic grotto
slate swan
#

no indentation

#

or anything

quaint epoch
lament mesa
#

regenerate it

quaint epoch
#

they taught us code.org, and it didn't even run most of the time, cuz the compiler was shit

quaint epoch
earnest ferry
#

regenerated it again

quaint epoch
lament mesa
slate swan
#

it was trash

quaint epoch
mystic grotto
#

bruh can anyone help

quaint epoch
#

otherwise you will not learn

quaint epoch
mystic grotto
#

ok

slate swan
#

it was a long time ago and my main language is py anyways

#

self taught

earnest ferry
#

pls tell now

#

what to do

quaint epoch
#

I think that most people started coding as kids in html, js or css, is that true?

unkempt canyonBOT
#

Hey @mystic grotto!

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

peak loom
#

Can someone hep me fix this?

slate swan
#

ur indentation

earnest ferry
slate swan
#

just do shift tab

#

durating needs to be under secounds

lament mesa
slate swan
#

my spelling lol

earnest ferry
#

where to place the cursor?

quaint epoch
#

ah, i remember the days when i used to code user-unfriendly websites in html on windows notepad

slate swan
#

lol

boreal ravine
#

preferably tab (4 spaces)

earnest ferry
#

@slate swan @quaint epoch

slate swan
#

wat

quaint epoch
earnest ferry
#

C:\Users\Holy>py -m ensurepip
Looking in links: c:\Users\Public\Documents\Wondershare\CreatorTemp\tmpb5xgvd02
Requirement already satisfied: setuptools in c:\users\holy\appdata\local\programs\python\python310\lib\site-packages (58.1.0)
Requirement already satisfied: pip in c:\users\holy\appdata\local\programs\python\python310\lib\site-packages (21.2.4)

#

indent

#

where to indent

slate swan
#

pip is already installed

earnest ferry
#

ye ik

mystic grotto
slate swan
#

so wats the problem

earnest ferry
slate swan
#

btw was pip install discord successful?

earnest ferry
earnest ferry
slate swan
#

u do it again and if it says its already satisfied then its ok

earnest ferry
slate swan
#

or do pip list

slate swan
#

can u open the terminal in

#

vs code

serene lynx
#

Excuse me for asking, is there a replacement for the avatar_url_as method in the discord.Member class in the py-cord framework?

earnest ferry
serene lynx
earnest ferry
slate swan
serene lynx
slate swan
earnest ferry
#

@slate swan tell in vsc? the upper tabs??

slate swan
#

visual studio code

#

like open the temrinal

earnest ferry
#

ye

slate swan
#

does it even open

earnest ferry
serene lynx
#

okay, thanks @royal lichen @slate swan

slate swan
#

new terminal

earnest ferry
#

click on it?

royal lichen
#

and reset your token you've leaked it now

earnest ferry
#

its the old one

#

my new one is safe

royal lichen
#

ah, ok

earnest ferry
slate swan
#

yeah does it open

earnest ferry
#

clicked on new terminal

slate swan
#

go to terminal

#

ur on problems

earnest ferry
#

ik

slate swan
#

do pip there

earnest ferry
#

type it?

slate swan
#

uhm sure

earnest ferry
slate swan
#

press etner

earnest ferry
#

just went to other line thats it

slate swan
#

so like nothing happened

earnest ferry
#

no ...

slate swan
#

i would advise you to just reinstall python

#

and make sure to install pip in the process

#

like make sure pip is checked in the process

#

and add to path

earnest ferry
#

ok thanks .....

#

i am quiting (im a nub) ill learn all first then ill come again back

slate swan
#

good luck ❤️

earnest ferry
#

lemon_wink see ya!!

slate swan
#

btw delete your messages you exposed your token ;-;

earnest ferry
#

i regenerated

peak loom
night seal
#

Hi peeps Have a doubt

boreal ravine
#

?

maiden fable
night seal
#

my flipacoin feature is not working

#

@client.command(name = "flipacoin")
async def coin(x):
headsortails=random.randint(0, 1) #Gives a 50% chance for each

if headsortails == 0:
    flip="Heads" #Sets the name based on the number gotten
else:
    flip="Tails"

await x.message.channel.send("I flipped my coin and got..."+ flip+"!")
#

this is the code

maiden fable
#

Why not just do x.send tho

#

And does it give any error?

night seal
#

no error it just doesnt work

maiden fable
#

Wait, uhhh

#

Okay

#

Wait can u try doing random.choice([1, 0])

night seal
#

no like a flip a coin feature

maiden fable
#

Yea

#

Just exchange random.randint with that

night seal
#

if the user puts $flipacoin it should take a random choice between heads or tails and send it

night seal
maiden fable
#

Yea

night seal
#

ok

#

like this?

#

@client.command(name = "flipacoin")
async def coin(x):
headsortails=random.choice([1, 0]) #Gives a 50% chance for each

if headsortails == 0:
    flip="Heads" #Sets the name based on the number gotten
else:
    flip="Tails"

await x.message.channel.send("I flipped my coin and got..."+ flip+"!")
maiden fable
#

Sure

#

Also

#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

night seal
#

let me try

maiden fable
#

Also instead of x.message.channel.send, u can also use x.send

night seal
#

ok

#

but x.message.channel.send works right

maiden fable
#

Yea

night seal
#

but it doesnt work

royal lichen
#

@maiden fable shouldn't your name be "retnuH"[::-1] 👀

maiden fable
#

Isn't that what my name is tho

#

Ah nvm

Thanks

maiden fable
night seal
#

yes

maiden fable
#

Okay...

#

Add a print statement on the top of the function

#

And print anything, to see if it's even getting printed

final iron
maiden fable
#

Isn't that what I said lol

night seal
maiden fable
#

And it's his wish if he wanna do heads and tails or 0 and 1 :D

night seal
#

ah ok

#

let me see if it workd

#

nope

#

It doesnt

maiden fable
#

Welp

#

Can u try printing headsortails

final iron
#

Using 0 and 1 is pointless and slows it down but if you like it then use it

royal lichen
#

You could just always return heads or tails statically, if they cant see your code they dont know if it's truly random :)

maiden fable
#

Well yea

night seal
royal lichen
#

joke about random numbers

#

in theory a random number gen could always return True

#

how would you prove it isnt random without the code 😉

maiden fable
night seal
#

ok

#

can I use f string here

maiden fable
#

Sure

#

I just showed u an example

night seal
#

ok

#

doesnt work :(

#

I will watch a tutorial

boreal ravine
#

!e

...
unkempt canyonBOT
#

@boreal ravine :warning: Your eval job has completed with return code 0.

[No output]
boreal ravine
#

eval works again 🗿

maiden fable
#

Can I see what did you write as code?

night seal
maiden fable
#

And how r u running the command?

night seal
#

wdym

maiden fable
#

Like what r u sending in the chat

verbal cairn
#

whats ur prefix

#

like !flipacoin

maiden fable
#

$

night seal
#

$

verbal cairn
#

$flipacoin

night seal
#

yes thats what i put

verbal cairn
#

that should work lol

night seal
#

it doesnt

#

idk why

verbal cairn
#

let me try with my bot rq

final iron
#

@night seal do you have a event in your code?

maiden fable
#

Ah yea do u have an on_message?

maiden fable
#

If yes, then instead of using client.event, use client.listen()

grand yew
#

Anyone code bots for free?

final iron
#

There we go

night seal
maiden fable
verbal cairn
#

use bot.process_commands

#

or something

final iron
#

Client in this case

verbal cairn
#

ill find it

#

yeah client, but dont use listen

night seal
#

OK stop

#

One person talk at a time

maiden fable
maiden fable
verbal cairn
#

await client.process_commands(message)

maiden fable
verbal cairn
night seal
maiden fable
verbal cairn
#

changing the decorator will cause problems later on, and isnt as useful as this

#
@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    await bot.process_commands(message)
verbal cairn
maiden fable
#

How can an on_message be a command...?

verbal cairn
#

I can make on_message work like a command, even if it doesnt use a command decorator

night seal
#

wait

#

one sec ppl

slate swan
#

exe format error - errno 8 in line 41

verbal cairn
#
@bot.command()
async def cf(ctx):
    choices = random.choice(["heads", "tails"])
    await ctx.send(f"I flipped and got {choices}!")

this works @night seal

night seal
#

i have not used bot.commad at all

#

wait where should this code be?

verbal cairn
maiden fable
verbal cairn
maiden fable
#

Smh leave it. U won't understand

verbal cairn
#
from disnake.ext import commands

bot = CustomBot(command_prefix="$")


@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))


@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    await bot.process_commands(message)


@client.command()
async def cf(ctx):
    choices = random.choice(["heads", "tails"])
    await ctx.send(f"I flipped and got {choices}!")

bot.run("TOKEN")
#

should be all it takes tho ^

night seal
#

where do i put the client.command

verbal cairn
#

the command decorator goes before a command, like above ur coinflip function

night seal
#

no

#

is it below or above the client.event

verbal cairn
#

can u show me your code

#

the order of ur functions doesnt matter that much in general

#

a command decorator is separate from an event decorator

night seal
verbal cairn
#

Yes that should work, assuming u don’t have an on_message(message) without await client.process_commands(message)

night seal
#

It doent work

verbal cairn
#

Show me all of u code, if u can

stone forge
#

How to do it?

slate swan
#
@bot.command()
async def verify(ctx):
    embed = discord.Embed(title=f'Verification', description=f'You have `1` attempt to verify. If you fail, you may be re-evaluated by executing the command again', color=clr)
    failbed = discord.Embed(title=f'Verification', description=f'You have failed the verification process! Please try again', color=clr)
    passbed = discord.Embed(title=f'Verification', description=f'You have passed the verification process! Enjoy your stay', color=clr)
    captcha = random.randint(1, 4)
    if captcha == '1':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283179843452970/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'KZEXEH':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)
    elif captcha == '2':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283141130006578/wickCaptcha.png')
        await ctx.send(embed=embed)
        def check(m):
            return m.author.id == ctx.author.id
        msg = await bot.wait_for('message', check=check)
        if msg.content == 'SXOXMM':
            await ctx.send(embed=passbed)
            await user.add_roles(917654915311099944)
        else:
            await ctx.send(embed=failbed)``` no errors, dont know what to do
stone forge
slate swan
#

this is what captcha 1 is

#

so if they type ^verify it randomly selects a captcha and wait_for()'s their response

tidal hawk
#

and no errors?

slate swan
verbal cairn
slate swan
#

For the checks

verbal cairn
#

the def check(m)

slate swan
#

Which is normal

verbal cairn
#

Why not just check with an ic statement

#

If*

slate swan
#

It's not the same

#

They way they did is correct.

slate swan
dusk dust
#

how can I send a dm to a user using their id?

slate swan
slate swan
#

You need to use get_role

stone forge
#

This isn't the server to solicit developers. This server is for asking questions on the Discord API

slate swan
#

!d discord.Guild.get_role

unkempt canyonBOT
slate swan
#

thanks

slate swan
#

and that would solve everything?

stone forge
#

exusme

#

sry

dusk dust
slate swan
stone forge
slate swan
#

Has nothing to do with that

verbal cairn
slate swan
#

youll have to use argument statements though

#

so something like ctx, user : Union[discord.Member, discord.User], explain):

#

and pass with await user.send(pass)

#

im not sure if thats the proper attr for dming members but

#

thats the basic idea of it

grand yew
#

Anyone made a modmail bot before?

slate swan
#

Why does that matter?

#

Just ask your question :p

red blade
grand yew
slate swan
slate swan
#

im assuming it would

slate swan
grand yew
slate swan
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
grand yew
#

Like @novel apex

slate swan
#

thatd be a good start

stone forge
#

How do I make an emoji appear under your message after a successful kick?
And the bot's message was deleted after a couple of seconds

from discord.ext import commands

client = commands.Bot(command_prefix = '!')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, user: discord.Member, *, reason=None):
 await user.kick(reason=reason)
 await ctx.send(f"{user} был успешно кикнут.") ```
tidal hawk
#

msg = await ctx.send(f"{user} был успешно кикнут.")
await msg.add_reactions('emoji')

stone forge
#

It's going to look like this, right?

from discord.ext import commands

client = commands.Bot(command_prefix = '!')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, user: discord.Member, *, reason=None):
 await user.kick(reason=reason)
 msg = await ctx.send(f"{user} был успешно кикнут.") 
 await msg.add_reactions('✔️') ```
red blade
stone forge
#

Thx

red blade
#

there

red blade
#

no

stone forge
#

Why?

boreal ravine
#

its msg.add_reaction()

#

not msg.add_reactions()

red blade
#

wait it actuaally is

grand yew
red blade
#

ive done a ticket one but that would be a start to a modmail

boreal ravine
#

!d discord.Message.add_reaction use the class name

unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
stone forge
#

one problem

boreal ravine
#

?

stone forge
red blade
stone forge
#

No problem
Hold 🙂

import discord
from discord.ext import commands

client = commands.Bot(command_prefix = '!')

@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, user: discord.Member, *, reason=None):
  await user.kick(reason=reason)
  msg = await ctx.send(f"{user} был успешно кикнут.") 
  await add_reaction(✔️)

# ban
@commands.has_permissions(ban_members=True)
async def ban(ctx, user: discord.Member, *, reason=None):
  await user.ban(reason=reason)
  msg = await ctx.send(f"{user} был успешно забанен") 
  await add_reaction(✔️)
#unban
async def unban(ctx, *, member):
  banned_users = await ctx.guild.bans()
  member_name, member_discriminator = member.split('#')

  for ban_entry in banned_users:
    user = ban_entry.user
  
  if (user.name, user.discriminator) == (member_name, member_discriminator):
    await ctx.guild.unban(user)
    msg = await ctx.send(f"{user} был успешно разбанен") 
    await add_reaction(✔️)
    return
red blade
#

how would it know what message it is adding a reaction to

stone forge
#

Okay, can you tell me how to do it? Please

#

I added the buckets

red blade
#

just like what i did

grand yew
#

Did you ask me if i wanna see it?

severe field
#

How to check if bot fully connected to voice and ready to play audio?

verbal cairn
#

anyone know if you can specify which loop you want to use with the @tasks.after_loop?

stone forge
#

What's wrong here?

from discord import member
from discord.ext import commands
from dislash import InteractionClient, ActionRow, Button, ButtonStyle

TOKEN = "my token"

intents = discord.Intents.all()
bot = commands.Bot(command_prefix = "!", intents = intents)

@bot.command()  # Выдача ролей при помощи select menu
async def roles(ctx):
    await ctx.channel.purge(limit=1)

    give_roles = discord.Embed(
        title = 'Автоматическая выдача ролей',
        description = '**Вы можете самостоятельно получить роль вашего сервера выбрав ее название в меню. \
            \n При выборе определённых ролей Вам будут открываться соответствующие текстовые и голосовые каналы. \
            \n Если Вы не играете ни на одном из серверов, то Вам будет доступен** **__только общий чат.__**\n \
            \n **Роли доступные для получения в данный момент:** \
            \n🎭 — <@&889169786121097296>\n🌅 — <@&881961587559243877>\n🌈 — <@&881962331544891443>',
        color = 0xfff700,)

    give_roles.set_thumbnail(url='https://images8.alphacoders.com/102/1026336.jpg')
    give_roles.set_footer(text='© Bumbazzz')

    await ctx.send(
        embed=give_roles,
        components = [
            Select(
                placeholder = "Выберите Ваш сервер",
                options = [
                    SelectOption(label = "Insquad", value = "Insquad🎭", description = "GTA 5 RP | InSquad", emoji = '🎭'),
                    SelectOption(label = "Sunrise", value = "Sunrise🌅", description = "GTA 5 RP | Sunrise", emoji = '🌅'),
                    SelectOption(label = "Rainbow", value = "Rainbow🌈", description = "GTA 5 RP | Rainbow", emoji = '🌈')
                ]
            )
        ]
    )


    interaction = await bot.wait_for("select_option")
    # member = ctx.member()
    # await member.add_roles(interaction.values[0])
    await interaction.send(content=f"Роль {interaction.values[0]} была вадана!", embed=embed)
slate swan
#

How can i change a buttons color on disabled

sullen shoal
#

just change it before disabling

#

i haven't tried it before, not sure if discord allows to change color of a button

severe field
#

why await voice.connect raise TimeoutError?

sullen shoal
#

the docs says why it raises too

#

!d discord.VoiceChannel.connect

unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

This requires [`Intents.voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
sullen shoal
#

asyncio.TimeoutError – Could not connect to the voice channel in time.

severe field
#

How to fix this?

sullen shoal
#

fix your internet

slate swan
#

Not in docs or git examples

sullen shoal
#

!d discord.Button.style

unkempt canyonBOT
slate swan
#

Thats settings a buttons color

#

I want to change it after it set like edit it on disabled

sullen shoal
#

dont you get the discord.Button instance

#

to disable it

stone forge
#

What to do? Interaction error!
Code:

sullen shoal
#

just like disabled, it is an attribute

stone forge
#
# Выдача ролей при помощи select menu
@bot.command() 
async def rolesp(ctx):
    await ctx.channel.purge(limit=1)

    give_roles = discord.Embed(
        title = 'Автоматическая выдача ролей',
        description = '**Вы можете самостоятельно получить роль выбрав ее название в меню. \
            \n При выборе своей гендерной роли вы будете выделяться ее цветом. \
            \n Роли доступные для получения в данный момент:** \
            \n:female_sign: — <@&864246807353884722>\n:male_sign: — <@&864246881667383336>',
        color = 0x36393E,)

    give_roles.set_thumbnail(url='https://media.discordapp.net/attachments/865681789493051423/917820894234169454/static.png?width=172&height=172')
    give_roles.set_footer(text=':zap:Cascade:zap:')

    await ctx.send(
        embed=give_roles,
        components = [
            SelectMenu(
                placeholder = "Выберите гендерную роль",
                options = [
                    SelectOption(label = "Девушка", value = "Девушка:female_sign:", description = "Вы получите гендерную роль женского пола!", emoji = ':female_sign:'),
                    SelectOption(label = "Парень", value = "Парень:male_sign:", description = "Вы получите гендерную роль мужского пола!", emoji = ':male_sign:'),
                ]
            )
        ]
    )


    interaction = await bot.wait_for("select_option")
    # member = ctx.member()
    # await member.add_roles(interaction.values[0])
    await interaction.send(content=f"Роль {interaction.values[0]} была вадана!", embed=embeds)

bot.run(TOKEN) ```
sullen shoal
#
Button.disabled = True
Button.style = ...```
slate swan
#

I dont

sullen shoal
slate swan
sullen shoal
#

View.children?

slate swan
slate swan
#
self.children[int].disabled = bool
sullen shoal
#

arent you subclassing discord.ui.View?

slate swan
#
@bot.command()
async def verify(ctx):
    def check(m):
        return m.author.id == ctx.author.id
    msg = await bot.wait_for('message', check=check)
    role = message.guild.get_role(917654915311099944)
    embed = discord.Embed(title=f'Verification', description=f'You have `1` attempt to verify. If you fail, you may be re-evaluated by executing the command again', color=clr)
    failbed = discord.Embed(title=f'Verification', description=f'You have failed the verification process! Please try again', color=clr)
    passbed = discord.Embed(title=f'Verification', description=f'You have passed the verification process! Enjoy your stay', color=clr)
    captcha = random.randint(1, 4)

    if captcha == '1':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283179843452970/wickCaptcha.png')
        await ctx.send(embed=embed)
        if msg.content == 'KZEXEH':
            await ctx.send(embed=passbed)
            await ctx.author.add_roles(role)
        else:
            await ctx.send(embed=failbed)

    elif captcha == '2':
        embed.set_image(url=f'https://cdn.discordapp.com/attachments/910579746205745283/917283141130006578/wickCaptcha.png')
        await ctx.send(embed=embed)
        if msg.content == 'SXOXMM':
            await ctx.send(embed=passbed)
            await ctx.author.add_roles(role)
        else:
            await ctx.send(embed=failbed)``` no errors, not sure what to do
sullen shoal
sullen shoal
#

MyView is a subclass of it, it has everything the original class has

#

including View.children

#

!d discord.ui.View.children

unkempt canyonBOT