#discord-bots

1 messages Β· Page 20 of 1

slate swan
#

!e

import sys
print(sys.getsizeof("a"),  sys.getsizeof("B"))
unkempt canyonBOT
#

@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.

50 50
slate swan
#

lol

lone lichen
#

!e

print(False)```
unkempt canyonBOT
#

@lone lichen :white_check_mark: Your 3.11 eval job has completed with return code 0.

False
slate swan
#

Lame

lone lichen
#

!e print(False)

slate swan
#

!e print(False is not True)

unkempt canyonBOT
#

@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.

True
slate swan
#

😳

lone lichen
#

!e print(True + True)

unkempt canyonBOT
#

@lone lichen :white_check_mark: Your 3.11 eval job has completed with return code 0.

2
silk fulcrum
#

!e print(bool(False) is not False or True is not (False and True))

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.

True
slate swan
#

Lame

silk fulcrum
slate swan
#

!e

print("".join([chr(int(binary, 2)) for binary in "01010111 01101001 01101110 01100100 01101111 01110111 01110011 00100000 00111110".split(" ")]))
unkempt canyonBOT
#

@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.

Windows >
slate swan
#

credit to okimii I just edited the string

#

!e

unicode_helloworld = [*b"Hello World"]
print(unicode_helloworld, "".join(chr(a) for a in unicode_helloworld))
silk fulcrum
#

Um actually, okimii > anyone and anything

unkempt canyonBOT
#

@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.

[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] Hello World
slate swan
swift pumice
#

buttons or emoji reaction

slate swan
#

buttons

silk fulcrum
#

bttuons

slate swan
swift pumice
#

ok

slate swan
#

reaction ratelimits are 2/1s iircyert

swift pumice
#

ok

slate swan
#

i think its 2/1s or 2/5s i cant remember

swift pumice
#

ok

#

thanks

slate swan
#

amongus

swift pumice
#

😳

swift pumice
grim oar
#

among ducks

slate swan
#

Guys why this not work bot = discord.Bot() # Create a bot object error Exception has occurred: AttributeError module 'discord' has no attribute 'Bot' File "C:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 3, in <module> bot = discord.Bot() # Create a bot object

silk fulcrum
#

discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

Thank you]#

#

sill not help

#

but ok

#

guys why this not working class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View error module 'discord' has no attribute 'ui' File "C:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 6, in <module> class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View

silk fulcrum
#

you are probably not using dpy 2.0

slate swan
#

ah

#

how i check?

silk fulcrum
#

pip show discord

slate swan
#

ok

silk fulcrum
#

in console

slate swan
#

Name: discord Version: 1.7.3 Summary: A mirror package for discord.py. Please install that instead. Home-page: https://github.com/Rapptz/discord.py Author: Rapptz Author-email: License: UNKNOWN Location: c:\users\ibrah\appdata\local\programs\python\python310\lib\site-packages Requires: discord.py Required-by:

silk fulcrum
#

yeah, 1.7.3

slate swan
#

o

#

how update it

silk fulcrum
#

pip install git+https://github.com/Rapptz/discord.py

slate swan
#

what this do?`

silk fulcrum
#

installs dpy 2.0 from github

slate swan
# silk fulcrum `pip install git+https://github.com/Rapptz/discord.py`

Collecting git+https://github.com/Rapptz/discord.py Cloning https://github.com/Rapptz/discord.py to c:\users\ibrah\appdata\local\temp\pip-req-build-vmpt4jxe ERROR: Error [WinError 2] The system cannot find the file specified while executing command git version ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

silk fulcrum
#

uhh

slate swan
#

dowload git???

silk fulcrum
#

you are on windows?

slate swan
#

ye windows 10

silk fulcrum
slate swan
#

o

#

this not hack Joy3D

silk fulcrum
#

wha

slate swan
#

`Other Git for Windows downloads
Standalone Installer
32-bit Git for Windows Setup.

64-bit Git for Windows Setup.

Portable ("thumbdrive edition")
32-bit Git for Windows Portable.

64-bit Git for Windows Portable.`

#

what i click

silk fulcrum
#

id click this

slate swan
#

ok

#

now what

silk fulcrum
#

now pip install git+https://github.com/Rapptz/discord.py

slate swan
#

ok

vocal snow
#

After you run the installer

slate swan
# silk fulcrum now `pip install git+https://github.com/Rapptz/discord.py`

Collecting git+https://github.com/Rapptz/discord.py Cloning https://github.com/Rapptz/discord.py to c:\users\ibrah\appdata\local\temp\pip-req-build-400e3bsi Running command git clone --filter=blob:none --quiet https://github.com/Rapptz/discord.py 'C:\Users\Ibrah\AppData\Local\Temp\pip-req-build-400e3bsi' Resolved https://github.com/Rapptz/discord.py to commit d7070193489cf0e6dc0b4128fa4c56009d25c025 Installing build dependencies ... |

slate swan
slate swan
silk fulcrum
#

ehm

#

you cancelled it

slate swan
#

i not

#

but i will try again

#

done

#

now what

silk fulcrum
#

pip show discord

slate swan
#

Name: discord Version: 1.7.3 Summary: A mirror package for discord.py. Please install that instead. Home-page: https://github.com/Rapptz/discord.py Author: Rapptz Author-email: License: UNKNOWN Location: c:\users\ibrah\appdata\local\programs\python\python310\lib\site-packages Requires: discord.py Required-by:

silk fulcrum
#

it dint update yayy

slate swan
#

loll

#

how to update now

vocal snow
slate swan
#

why

#

wtf???

#

tell me steps

vocal snow
slate swan
#

done

vocal snow
slate swan
#

ok

#

but what it do

#

Name: discord.py Version: 2.0.0a4459+gd7070193 Summary: A Python wrapper for the Discord API Home-page: https://github.com/Rapptz/discord.py Author: Rapptz Author-email: License: MIT Location: c:\users\ibrah\appdata\local\programs\python\python310\lib\site-packages Requires: aiohttp Required-by:

silk fulcrum
#

finale

vocal snow
#

There you have 2.0

silk fulcrum
#

now run code

slate swan
#

ok thank you!

silk fulcrum
#

and get error avatar_url

#

lmao

slate swan
#

;/

shrewd apex
#

to update u need to have -U iirc

slate swan
#

o errors

shrewd apex
#

lots of them

silk fulcrum
#

1000 and 1

shrewd apex
#

the cog loading is async now

slate swan
#

just this error File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 4, in <module> bot = commands.Bot(command_prefix = '!') TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'

silk fulcrum
#

, intents=discord.Intents.all()

slate swan
#

what this mean

silk fulcrum
#

enabling intents

slate swan
#

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

silk fulcrum
#

in brackets

slate swan
#

ok

#

?

#

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

silk fulcrum
#

yes

slate swan
#

ok

silk fulcrum
#

oh but you might have intents not enabled on dev portal

slate swan
#

File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 11, in <module> @bot.slash_command() # Create a slash command AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?

silk fulcrum
#

slash commands dont work like this

slate swan
#

`import discord

bot = discord.Bot() # Create a bot object

class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View
@discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
async def button_callback(self, button, interaction):
await interaction.response.send_message("You clicked the button!") # Send a message when the button is clicked

@bot.slash_command() # Create a slash command
async def button(ctx):
await ctx.respond("This is a button!", view=View()) # Send a message with our View class that contains the button

bot.run("TOKEN") # Run the bot`

silk fulcrum
#

your github thing is stupid

slate swan
#

o

#

so how make buttom??

silk fulcrum
#

uhm, its already done

#

as i see

slate swan
#

and what is this Traceback (most recent call last): File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 9, in <module> client = discord.Client() TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

shrewd apex
#

hoh this is gonna be long

slate swan
#

we know

silk fulcrum
#

where did client come from?

#

im tired alrdywe

slate swan
#

client = discord.Client()

silk fulcrum
#

but you have bot

#

not client, right?

slate swan
#

ah

#

idk i use client too

shrewd apex
#

he has discord.Bot()

silk fulcrum
#

wahtt

slate swan
#

i use bot and clinet

silk fulcrum
shrewd apex
#
import discord

bot = discord.Bot() # Create a bot object

class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View
    @discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("You clicked the button!") # Send a message when the button is clicked

@bot.slash_command() # Create a slash command
async def button(ctx):
    await ctx.respond("This is a button!", view=View()) # Send a message with our View class that contains the button

bot.run("TOKEN") # Run the bot
shrewd apex
#

there u go master 32 is best among us he will help u

silk fulcrum
#

this is your code

slate swan
#

lol

silk fulcrum
#

NONONONO

shrewd apex
silk fulcrum
#

im outta here

slate swan
silk fulcrum
#

bbye guys glhf

slate swan
#

yes help me

#

3 mins :)

silk fulcrum
#

you forgot * 10

slate swan
#

now how fix this

slate swan
#

help ```diff

  • File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 9, in <module>
    client = discord.Client()
    TypeError: Client.init() missing 1 required keyword-only argument: 'intents'```
shrewd apex
#

simple slash commands tutorial

silk fulcrum
#

ye glhf

shrewd apex
#

first setup ur bot then make buttons

slate swan
#

ok

#

does i can

#

use bot and client in same code??

shrewd apex
#

why do u want to in first place?

silk fulcrum
#

you can but that's bbbbbbruh

shrewd apex
#

hybrid_command exists

slate swan
# shrewd apex why do u want to in first place?

i want fix this File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 9, in <module> client = discord.Client() TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

silk fulcrum
#

bbbbbruh

#

having both bot and client wont help u fix this

shrewd apex
#

thats why half knowledge is dangerous kidsπŸ—Ώ

silk fulcrum
#

dangerous kids?

shrewd apex
#

read the tutorials

slate swan
#

i 13 years old ;/

shrewd apex
silk fulcrum
slate swan
#

lol

silk fulcrum
#

im jot noking

slate swan
#

lol

shrewd apex
slate swan
#

o

silk fulcrum
#

excuse is not

shrewd apex
#

when u actually learn some python😁

#

f autocorrect

slate swan
#

;/

#

dude i gtg near

#

tell me = give you nitro

silk fulcrum
#

oooo

#

that is interesting

eternal fox
slate swan
#

client = discord.Client()

silk fulcrum
slate swan
#

no

#

i can't send 400 line

silk fulcrum
#

aight

slate swan
#

down bad asherpithink

#

client = discord.Client() bot = commands.Bot(command_prefix = '!', intents=discord.Intents.all()) responses = ['MayBe' , 'Yes' , 'No' , 'probably' , 'Likey' , 'unlikey'] @bot.event async def on_ready(): await bot.change_presence(activity=discord.Streaming(name='Sky Craft', url='https://www.youtube.com/watch?v=xvFZjo5PgG0')) print("BOT IS ONLINE") channel = bot.get_channel(1004036302594920508) await channel.send("I Am Reloading 🟧") await channel.send("Done Reload βœ…") async def on_message(message): await bot.process_commands(message) if message.author == bot.user:

vale wing
#

Do we consider nitro paid work

silk fulcrum
#

then just put intents=discord.Intents.all() inside discord.Client()

slate swan
#

ok

#

Is there anyway to change the default bot banner color?

honest shoal
slate swan
#

Oh so it's just color of pfp?

honest shoal
#

yes

slate swan
#

Theres really no way to change it?

honest shoal
#

no

slate swan
#

That's wild

honest shoal
#

just change the pfp

tidal hawk
#

it's not possible to gray out component buttons separately for each user.. right?

#

For example: When user clicks component button then it grays out only for him, but other can still press ity

shrewd apex
#

thats not possible

#

but u can make checks to stop the user from pressing

slate swan
#

help @bot.slash_command() # Create a slash command not work error Exception has occurred: AttributeError 'Bot' object has no attribute 'slash_command' File "C:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 11, in <module> @bot.slash_command() # Create a slash command

silk fulcrum
#

oh my gosh

#

nah im not gonna spoonfeed

eternal fox
#

read it

slate swan
#

how to read

silk fulcrum
#

a b c d e f g h i j k l m n o p q r s t u v w x y z

slate swan
#

ah

#

what is this

#

thank you

#

I have this code but it won't work idk why

@client.event
async def on_message(message):
    if (message.channel.id == '1005026300488056942'): 
        if not message.attachments:
            if message.author.id == client.user.id:
                await message.delete()
        if message.attachments:
            async with aiohttp.ClientSession() as session:
                async with session.get(message.attachments[0].url) as resp:
                    if resp.status != 200:
                        return await channel.send('Could not download file...')
                    data = io.BytesIO(await resp.read())
                    channel = client.get_channel(1005027379007193158)
                    await message.author.add_roles(835998999861133372)
                    await channel.send(file=discord.File(data, 'database.png'))   

it has no error

silk fulcrum
#

maybe you are not in the channel with that id

cold tide
cold tide
#

Whats the issue someone tell me

slate swan
slate swan
cold tide
silk fulcrum
#

import asyncio

cold tide
#

Alr

slate swan
#

whyy this not working await ctx.respond("This is a button!", view=View()) # Send a message with our View class that contains the button error

slate swan
#

wdym

#

`import discord
class SlashClient(discord.Client):
def init(self) -> None:
super().init(intents=discord.Intents.default())
self.tree = discord.app_commands.CommandTree(self)
class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View
@discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
async def button_callback(self, button, interaction):
await interaction.response.send_message("You clicked the button!") # Send a message when the button is clicked
async def setup_hook(self) -> None:
self.tree.copy_global_to(guild=discord.Object(id=12345678900987654))
await self.tree.sync()

client = SlashClient()

@client.tree.command(name="ping", description="...")
async def button(interaction: discord.Interaction) -> None:
await ctx.respond("This is a button!", view=View()) # Send a message with our View class that contains the button`

cold tide
#
import discord
class SlashClient(discord.Client):
    def __init__(self) -> None:
        super().__init__(intents=discord.Intents.default())
        self.tree = discord.app_commands.CommandTree(self)
class View(discord.ui.View): # Create a class called View that subclasses discord.ui.View
    @discord.ui.button(label="Click me!", style=discord.ButtonStyle.primary, emoji="😎") # Create a button with the label "😎 Click me!" with color Blurple
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("You clicked the button!") # Send a message when the button is clicked   
    async def setup_hook(self) -> None:
        self.tree.copy_global_to(guild=discord.Object(id=12345678900987654))
        await self.tree.sync()

client = SlashClient()

@client.tree.command(name="ping", description="...")
async def  button(interaction: discord.Interaction) -> None:
    await ctx.respond("This is a button!", view=View()) # Send a message with our View class that contains the button
#

much better

silk fulcrum
slate swan
#

a

cold tide
#

@silk fulcrum still got the same error even when importing asyncio

cold tide
silk fulcrum
#

where's await asyncio.sleep(3) instead of time.sleep(3)?

cold tide
#

Oh...

#

I didnt know mb

slate swan
#

why this not working client = SlashClient() error

silk fulcrum
#

what is in line 100

slate swan
silk fulcrum
#

what if you run the code?

#

i wanna see the traceback, not ide suggestion

slate swan
#

send me error

#

rom_file code = compile(f.read(), fname, 'exec') File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 100 client = SlashClient() ^^^^^^

silk fulcrum
#

what is the error? syntaxerror?

slate swan
#

idk

#

SyntaxError: invalid syntax

#
@client.event
async def on_message(message):
    if (message.channel.id == 1005026300488056942):
        if not message.attachments:
            if message.author.id == client.user.id:
                await message.delete()
        if message.attachments:
            async with aiohttp.ClientSession() as session:
                async with session.get(message.attachments[0].url) as resp:
                    if resp.status != 200:
                        return await channel.send('Could not download file...')
                    data = io.BytesIO(await resp.read())
                    channel = client.get_channel(1005027379007193158)
                    await message.author.add_roles(835998999861133372)
                    await channel.send(file=discord.File(data, 'database.png')) 

identifying the channel won't work anymore idk why

#

it has no error

silk fulcrum
#

wait wth, put setup_hook function inside the SlashClient class @slate swan

vocal snow
slate swan
#

class SlashClient(discord.Client): def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self)

slate swan
vocal snow
silk fulcrum
#

should be inside SlashClient class

slate swan
#

or the attachment

vocal snow
#

maybe in add_roles

#

are you sure it can take int like that

slate swan
#

I think

vocal snow
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
vocal snow
#

*roles (abc.Snowflake)

#

you can use discord.Object(id)

slate swan
silk fulcrum
#

i already said

#

move that method inside the SlashClient class

vocal snow
#

just use Attachment.save

silk fulcrum
#

if you can't understand that, I can't help you

slate swan
#

class SlashClient(discord.Client): setup_hook def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self)

vocal snow
#

what?

silk fulcrum
#

okay sorry im not helping you

slate swan
#

@silk fulcrum he is a beginner

vocal snow
#

clearly

silk fulcrum
#

dpy is not a beginner friendly lib

slate swan
#

just

silk fulcrum
#

especially that it uses OOP

slate swan
#

help me in this part for nitro

silk fulcrum
#

and like.. idk

#

im just tired of that

slate swan
#

He won't give you nitro

#

I can

slate swan
silk fulcrum
#

i dont even care about nitro anymore

slate swan
#

i aready gift 50 people

#

no errors shows

slate swan
slate swan
slate swan
#

And you purchased from us

vocal snow
slate swan
slate swan
# vocal snow can you send your updated code?
@client.event
async def on_message(message):
    if (message.channel.id == 1005026300488056942):
        if not message.attachments:
            if message.author.id == client.user.id:
                member = message.author
                await message.delete()
        if message.attachments:
            async with aiohttp.ClientSession() as session:
                async with session.get(message.attachments[0].url) as resp:
                    if resp.status != 200:
                        return await channel.send('Could not download file...')
                    data = io.BytesIO(await resp.read())
                    channel = client.get_channel(1005027379007193158)
                    member = message.author
                    role2 = discord.utils.get(message.guild.roles, name="Bato Ni Darna")
                    await member.add_roles(role2, atomic=True)
                    await channel.send(file=discord.File(data, 'database.png'))      
slate swan
#

it's like if the message attachment is not working

slate swan
slate swan
slate swan
silk fulcrum
slate swan
slate swan
#

WHAT PART UP DOWN ????

silk fulcrum
#

YOU DONT SEE IT?

slate swan
silk fulcrum
slate swan
#

class SlashClient(discord.Client): def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self)

#

AAAAAAAAAAAAAAA

#

LOL

#

o last line??

#

o i dumb

#

Learn basic python first

slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
slate swan
slate swan
slate swan
slate swan
#

anything just tell me add

silk fulcrum
#

method is not a variable, and you put not inside other method

slate swan
#

waht method

#

give me ex pls :)

#

ex = me leave

#

Methods are defined inside of a class man

#

ah where

#

WHERE WHAT CLASS

#

Wdym where?

#

setup_hook put where??

#

You have one class in the code you sent

#

There are alot of places in the class

silk fulcrum
slate swan
#

ye alot of places

silk fulcrum
#

hahaha you tell people to learn python when you cant count

slate swan
vocal snow
#

lets please chill out ❀️

slate swan
#

I GTg in 10 MINS AND I don't have TIME To make anything

slate swan
slate swan
silk fulcrum
slate swan
#

there are 1 class but

silk fulcrum
slate swan
#

W h e r e

vocal snow
slate swan
silk fulcrum
#

but he knows how to use github ai that will make code for you

slate swan
silk fulcrum
#

ohgosh

slate swan
#

Your so rude master32

vocal snow
silk fulcrum
slate swan
silk fulcrum
vocal snow
slate swan
#

Ashley can help him now

silk fulcrum
#

yeah

slate swan
#

Free πŸ™

slate swan
slate swan
#

😭

#

DUDE YES IN THE CLASS

silk fulcrum
slate swan
#

BUT WHERE IN THE CLASS

#

Tell him where already master32

#

THERE are 4 lines in this class

#

WHAT LINE I SHOULD PUT IN

#

Line 221

#

Dude

slate swan
vocal snow
#

hi ashley

slate swan
slate swan
silk fulcrum
#
class SlashClient(discord.Client):
    def __init__(self) -> None:
        super().__init__(intents=discord.Intents.default())
        self.tree = discord.app_commands.CommandTree(self)
    async def setup_hook(self) -> None:
        self.tree.copy_global_to(guild=discord.Object(id=12345678900987654))
        await self.tree.sync()```
slate swan
#

BYE

silk fulcrum
#

@slate swan

#

see, WAS IT THAT HARD???????

vocal snow
slate swan
#

WHERE @silk fulcrum

#

wheere you even put it

#

wait

#

LOL 😭

slate swan
#

OOOOO JUST TELL ME it in whta linelol

vocal snow
#

can you stop with the uppercase spam

slate swan
#

Where

#

STILL HAVE THE ERROR

vocal snow
slate swan
#

For real

#

@silk fulcrum you did nothing

#

....

silk fulcrum
#

how stuffy it is in here

slate swan
#

Master32 did nothing

slate swan
#

Do you know python? @slate swan

slate swan
#

When did you start learning @slate swan

slate swan
silk fulcrum
slate swan
slate swan
#

But it not working :(

#

sad sky sad

slate swan
slate swan
slate swan
slate swan
slate swan
#

Learn how to talk to people 😭

slate swan
silk fulcrum
slate swan
silk fulcrum
slate swan
#

Lol

silk fulcrum
#

what a m i meant to do

slate swan
#

Im out of your shit, im not commenting

#

you not rude

slate swan
#

python is number 1 AI maker

#

in this world

slate swan
silk fulcrum
#

well im gonna leave then too

slate swan
#

wtf

silk fulcrum
slate swan
#

Guys you will leave me here talk to my self??

#

What the

#

BC I JUST Want help

silk fulcrum
#

Python Sky left alone here

slate swan
#

lol

#

πŸ’€

slate swan
#

client = SlashClient()

vocal snow
#

I'd recommend you block each other instead of continuing your argument

#

and maybe take a walk πŸ‘

slate swan
silk fulcrum
slate swan
#

^^^

#

bot

silk fulcrum
slate swan
#

2 good idea

#

It's 2 am

#

frist good idea is TO HELP ME

slate swan
vocal snow
silk fulcrum
#

0:30 PM

slate swan
#

i some time leep 5 am

slate swan
# slate swan it sitll not work

the error's just stating that you have a decorator
@decorator somewhere in your code that is not above a function, in essence, every decorator needs a function to be defined under it

slate swan
slate swan
slate swan
#

i know

#

:)

slate swan
#

having this problem for a while now, the code doesn't identify if it's an image or not

    if (message.channel.id == 1005026300488056942):
        if message.attachments:
            async with aiohttp.ClientSession() as session:
                async with session.get(message.attachments[0].url) as resp:
                    if resp.status != 200:
                        return await channel.send('Could not download file...')
                    data = io.BytesIO(await resp.read())
                    channel = client.get_channel(1005027379007193158)
                    await channel.send(file=discord.File(data, 'database.png'))  
                    member = message.author
                    role2 = discord.utils.get(message.guild.roles, name="Bato Ni Darna")
                    await member.add_roles(role2, atomic=True)
        else:
            await message.delete()   

how can i fix it?

#

rip

#

I already tried printing the output, it only identify the text

slate swan
#

gay

#

??

silk fulcrum
slate swan
#

EW

silk fulcrum
#

you too?

slate swan
slate swan
vocal snow
# slate swan EW

Homophobes aren't welcome in this server. Or this universe. Thanks

slate swan
#

what wrong if i don't love gay?

silk fulcrum
slate swan
#

does i must love gay???

#

can we stop

#

No ones gonna help you now bro

vocal snow
silk fulcrum
slate swan
#

and it identify text again

vocal snow
#

Are you actually uploading an attachment

slate swan
#

by sending an image to the cahnnel

vocal snow
#

or sending an image URL

slate swan
#

yes

silk fulcrum
#

@slate swan tbh, look at Ashley, isn't she cute?

slate swan
#

attachment

slate swan
silk fulcrum
#

ofc

slate swan
#

Yeahh

vocal snow
vocal snow
#

Please go to OT

#

Take the Python Sky with you

slate swan
#

No !

vocal snow
#

😭

slate swan
#

I blocked him !

#

idk if there's an update on python that change the code :<

silk fulcrum
#

ArgumentError: OT is not defined

vocal snow
slate swan
vocal snow
#

*using

paper sluice
silk fulcrum
#

who cares

slate swan
#

πŸ˜‡

slate swan
#

Whoaaa

slate swan
#

And what intents do you have enabled in the bots code

slate swan
hazy oxide
#

discord.Intents.all()

slate swan
#
discord.utils.get(message.guild.roles, name='test')

how can i use the id instead of the name?

#

okay so someone who's really good at coding told me to set an attribute on self in my command and retrieve it in my task but since im dum and inexperienced i have no idea what that means, pls help with code/examples/emotional support

#

How to fix could not find the satisfied version of random in resources.txt?

torn sail
#

As a kwarg

#

But you may as well use message.guild.get_role

slate swan
#
await client.get_guild(guild.id).leave()```
Can someone help me with it? ![ThinkO_O](https://cdn.discordapp.com/emojis/744344862521950268.webp?size=128 "ThinkO_O")
slate swan
slate swan
slate swan
slate swan
#

does it print None or what

#

theres no output

#

wtf show more of your code

#
    for guild in client.guilds:
        if config(keyword="guildID") != str(guild.id):
            await client.get_guild(guild.id).leave()
silk fulcrum
#

where's print

slate swan
#

^

torn sail
#

No need for get guild

merry cliff
#

why would u want to leave all the servers but ok

crystal glen
#
@client.command()
@commands.has_permissions(administrator=True)
async def enable(ctx, command: str):
    await ctx.message.delete()
    try:
        client.add_command(command)
        await ctx.send(f"{command} has been enabled.")
    except Exception as e:
        print(e)
        await ctx.send(f"{command} is not a command.")

I get this The command passed must be a subclass of Command

slate swan
#

How to fix this?

silk fulcrum
crystal glen
#

so what do I do now

placid willow
silk fulcrum
slate swan
#

When i add the bot to vps host, the button interactions and slash commands dont work sometimes. And it throws error as unknown interaction. And this happens cause the bot makes more than 3 seconds to reply. So added to my code await interaction.response.defer() and underneath await interaction.followup.send(). It works but sometimes it takes some seconds to reply. Is there a solution to reduce that time so the bot reply more fast?

slate swan
#

Help how to turn off the cycle

cold sonnet
#

is this an on_message

#

?

slate swan
cold sonnet
#

okay but the bot is spamming, right?

#

do you have an on_message?

slate swan
slate swan
cold sonnet
#

well can you show your code then

#

the on_guild_join

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

cold sonnet
#

make sure to exclude token

slate swan
#

@cold sonnet nu chto

cold sonnet
#

I don't understand that

#

but you have to deindent the part with the embeds and sends

slate swan
#

what

cold sonnet
#

deindent at line 25 and below

#

so those parts aren't in the for loop

#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

cold sonnet
#

show the isJoinhub function

slate swan
#

nikakoy pomoshchi..

cold sonnet
#

speak English

silk fulcrum
slate swan
cold sonnet
#

!rule 4 😭

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

silk fulcrum
cold sonnet
#

oh ok

silk fulcrum
#

and he refused

cold sonnet
#

that's bad

#

do you know what deindenting in russian is

silk fulcrum
#

uhm, yes?

slate swan
#

ΠΌ-Π΄Π° Π²Ρ‹ всё Ρ‚ΡƒΠΏΡ‹Π΅..

cold sonnet
#

well tell him to deindent everything below the first await ctx.send

slate swan
slate swan
#
silk fulcrum
cold sonnet
#

I assume you told him that

slate swan
#

Ρ…Ρ…Π°Π°

slate swan
#

Learn Russian with the help of a translator

silk fulcrum
slate swan
silk fulcrum
#

learn English with the help of translator

slate swan
#

I understand some Russian not a lot

slate swan
#

I'm too lazy to translate from English into Russian

cold sonnet
#

toxic penguin vibes

silk fulcrum
silk fulcrum
cold sonnet
#

k everyone stop speaking russian

silk fulcrum
#

ok

slate swan
slate swan
cold sonnet
#

my mistake I thought it'd succeed

slate swan
silk fulcrum
tidal hawk
#

Any idea how can I pass the button.ui url from class parameters? can't use self..

silk fulcrum
slate swan
#

any one know why this not work client = SlashClient() error

slate swan
slate swan
slate swan
slate swan
cold sonnet
slate swan
silk fulcrum
slate swan
#

@Master32#2476

silk fulcrum
silk fulcrum
slate swan
silk fulcrum
#

also, why are there so many russians lmao?

tidal hawk
slate swan
#

Can i make arg multiple?

silk fulcrum
slate swan
cold sonnet
#

a view has a buttons attribute for sure

buoyant quail
tidal hawk
#

hm

slate swan
#

Separating Russians from everyday people due to speaking another language

slate swan
silk fulcrum
cold sonnet
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
slate swan
slate swan
#

Separating Russians from other people due to speaking another language

tidal hawk
#

how do I pass url from view to button?

slate swan
#

@silk fulcrum how?

cold sonnet
#

oh it's self.children

slate swan
#

@silk fulcrum help

#

@buoyant quail

slate swan
silk fulcrum
#

well that's not racism anyways, but I mean I didn't expect it. I am russian, why do you think I hate them? @slate swan

slate swan
#

O

silk fulcrum
#

bruh so many pings for help, who do I help and how

unkempt canyonBOT
#

Hey @slate swan!

It looks like you tried to attach file type(s) that we do not allow (.jfif). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

slate swan
#

How can i do it?

cold sonnet
#

maybe you can set self.children[0].url later

slate swan
slate swan
tidal hawk
slate swan
buoyant quail
slate swan
#

waw dah

slate swan
slate swan
cold sonnet
#

!ot

unkempt canyonBOT
slate swan
#

ARABic

silk fulcrum
slate swan
#

Dude this is getting off

#

1 most beautiful lagauges in this world

#

ARABIC 1 most beautiful lagauges in this world

cold sonnet
#

go off topic

slate swan
#

ye

#

Ok but help

#

Dude im gonna call a mod

slate swan
cold sonnet
#

help with what

slate swan
slate swan
silk fulcrum
#

this is getting probably even worse than our half drunk discussions yesterday

silk fulcrum
slate swan
slate swan
cold sonnet
#

I have no idea of 3rd party libs

slate swan
#

o

#

okb bye

slate swan
#

no

paper sluice
cold sonnet
slate swan
slate swan
# paper sluice show code

@bot.command() @commands.has_permissions(administrator=True) client = SlashClient() @client.tree.command(name="ping", description="...") async def fight(ctx, player1, player2, Health: int, Time: int):

silk fulcrum
slate swan
slate swan
slate swan
paper sluice
cold sonnet
silk fulcrum
cold sonnet
#

and why not just use bot

slate swan
slate swan
slate swan
cold sonnet
#

a bot object has a tree already

slate swan
#

When where who

silk fulcrum
cold sonnet
#

decorators are the lines that start with @

silk fulcrum
slate swan
cold sonnet
#

you can't make a variable between the @ lines

slate swan
#

this line @client.tree.command(name="ping", description="...")

paper sluice
#

!decorator

unkempt canyonBOT
#

Decorators

A decorator is a function that modifies another function.

Consider the following example of a timer decorator:

>>> import time
>>> def timer(f):
...     def inner(*args, **kwargs):
...         start = time.time()
...         result = f(*args, **kwargs)
...         print('Time elapsed:', time.time() - start)
...         return result
...     return inner
...
>>> @timer
... def slow(delay=1):
...     time.sleep(delay)
...     return 'Finished!'
...
>>> print(slow())
Time elapsed: 1.0011568069458008
Finished!
>>> print(slow(3))
Time elapsed: 3.000307321548462
Finished!

More information:
β€’ Corey Schafer's video on decorators
β€’ Real python article

cold sonnet
#

and don't even make a client, just use a bot in dpy 2

slate swan
paper sluice
#

you decorate functions and classes, not variables...

silk fulcrum
slate swan
#

loolOMG

#

I FIX IT I LEGEND

#

client = SlashClient() @bot.command() @commands.has_permissions(administrator=True) @client.tree.command(name="ping", description="...") async def fight(ctx, player1, player2, Health: int, Time: int):

cold sonnet
slate swan
silk fulcrum
#

legend :lmao:

cold sonnet
#

and the command is registered on your client

#

not your bot

#

you probably run just bot

silk fulcrum
slate swan
cold sonnet
#

the command doesn't exist

paper sluice
slate swan
#

Joy3D TypeError: parameter 'player1' is missing a type annotation in callback 'fight'

slate swan
cold sonnet
#

player1: discord.Member, player2: discord.Member

slate swan
#

Like: Hello there!

cold sonnet
#

I assume

silk fulcrum
silk fulcrum
cold sonnet
slate swan
#

o

slate swan
slate swan
#

can you put me it pls sir

cold sonnet
#

yeah you have to type : and then the annotation

silk fulcrum
slate swan
cold sonnet
#

async def fight(ctx, player1: discord.Member, player2: discord.Member, Health: int, Time: int):`

slate swan
#

ok

cold sonnet
#

what you put after : is an annotation

slate swan
#

Discord.meber??

#

I want text not member

silk fulcrum
cold sonnet
#

oh then str

#

sorry

slate swan
#

how

cold sonnet
#

replace discord.Member with str

slate swan
#

player1: str

cold sonnet
#

yes

slate swan
#

ok thank you sir

cold sonnet
#

player1 has an str annotation

#

learning programming terms

slate swan
#

help Traceback (most recent call last): File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 105, in <module> async def fight(ctx, player1: str, player2: str, Health: int, Time: int): File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1479, in decorator result = command(name=name, cls=cls, *args, **kwargs)(func) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1752, in decorator return cls(func, name=name, **attrs) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 359, in __init__ raise TypeError('Callback must be a coroutine.') TypeError: Callback must be a coroutine.

#

lol

#

idk alot of errors in my code

cold sonnet
#

async def callback

slate swan
#

wdym

cold sonnet
#

dunno, show code

#

more

slate swan
#

client = SlashClient() @bot.command() @commands.has_permissions(administrator=True) @client.tree.command(name="ping", description="...") async def fight(ctx, player1: str, player2: str, Health: int, Time: int): if Health >= 501: await ctx.send(f'Sorry It **Health** SHould be Between **500** and **20**') sys.exit()

#

class SlashClient(discord.Client): def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self) async def setup_hook(self) -> None: self.tree.copy_global_to(guild=discord.Object(id=12345678900987654)) await self.tree.sync()

shrewd apex
#

guys hybrid commands exist

slate swan
#

wdym

cold sonnet
#

I didn't even realize this wanted to be hybrid

slate swan
#

w h a t

cold sonnet
#

but now I see @bot.command() and the client.tree.command

slate swan
#

w t f

shrewd apex
#

currently it looks like spaghetti and meatballs thrown in a food processor to make sauce

slate swan
#

lol

cold sonnet
#

that's a great examination

slate swan
#

help

#

for nitro

shrewd apex
#

also syntax for both slash commands and prefix commands are different do what u were doing won't work anyway

slate swan
#

lol

shrewd apex
slate swan
#

wdym

cold sonnet
#

@slate swan do you use dpy2.0?

slate swan
#

ye

cold sonnet
#

and defined bot as commands.Bot

#

then you do not need client

shrewd apex
slate swan
shrewd apex
#

hybrid commands example is there down below

#

scroll down and read

cold sonnet
shrewd apex
#

was slash commands even there below 2.0pithink

paper sluice
#

no

cold sonnet
#

don't you think SlashClient is a 3rd party lib for slash commands

#

for 1.7 users

slate swan
#

dpy just implemented slash commands late pepe_exit

shrewd apex
#

Β―\_(ツ)_/Β―

silk fulcrum
#
class SlashClient(discord.Client):
    some weird slash commands stuff```
slate swan
#

that's clearly taken from the gist UniSips what even is their issue

cold sonnet
#

well

#

bot has all that

#

using bot is a solution

vocal snow
#

Their issue is their rebellious attitude and refusal to learn python basics before attempting to make a discord bot, leading to gluing code from the darkest corners of the internet and crying in this channel

slate swan
#

seems ideal

vocal snow
#

Also they were being homophobic a few hours ago.

cold sonnet
#

uh

slate swan
cold sonnet
#

I learned python with dpy

slate swan
#

ew

shrewd apex
vocal snow
#

That's fine. But this guy isn't doing any learning.

silk fulcrum
cold sonnet
#

lmao

shrewd apex
#

group hug πŸ‘€

slate swan
#

why do you guys even wanted to write a bot without knowing the language itself ASakashrug

vocal snow
#

πŸ€—

slate swan
silk fulcrum
shrewd apex
#

all people with determination to do something 😎

vocal snow
shrewd apex
silk fulcrum
slate swan
#

anyways, ot

silk fulcrum
slate swan
slate swan
#

and other down one

#

i feel all here can't help me TES_flushed_eyes

shrewd apex
#

u are correct

slate swan
#

not reallly

shrewd apex
#

only u can help urself out here by learning python πŸ‘€

slate swan
silk fulcrum
slate swan
slate swan
slate swan
shrewd apex
silk fulcrum
slate swan
slate swan
#

UniSips this is getting annoying every message now

slate swan
#

ye

slate swan
silk fulcrum
glad cradle
#

have you tried to read the error?

slate swan
#

what mean Callback must be a coroutine.

slate swan
#

client = SlashClient() @bot.command() @commands.has_permissions(administrator=True) @client.tree.command(name="ping", description="...") async def fight(ctx, player1: str, player2: str, Health: int, Time: int): if Health >= 501: await ctx.send(f'Sorry It **Health** SHould be Between **500** and **20**') sys.exit()

#

class SlashClient(discord.Client): def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self) async def setup_hook(self) -> None: self.tree.copy_global_to(guild=discord.Object(id=12345678900987654)) await self.tree.sync()

shrewd apex
#

sys.exit() πŸ—Ώ

glad cradle
#

he asked the traceback

slate swan
shrewd apex
#
class SlashClient(discord.Client):
    def __init__(self) -> None:
        super().__init__(intents=discord.Intents.default())
        self.tree = discord.app_commands.CommandTree(self)
    async def setup_hook(self) -> None:
        self.tree.copy_global_to(guild=discord.Object(id=12345678900987654))
        await self.tree.sync()
slate swan
shrewd apex
#
client = SlashClient()
@bot.command()
@commands.has_permissions(administrator=True)
@client.tree.command(name="ping", description="...")
async def fight(ctx, player1: str, player2: str, Health: int, Time: int):
    if Health >= 501:
        await ctx.send(f'Sorry It **Health** SHould be Between **500** and **20**')
        sys.exit()
paper sluice
shrewd apex
tidal hawk
slate swan
slate swan
#

you create url buttons using button = Button(url=..., label=...)
and add em to the view

#

reason why button does not have a callback is

#

the callback will never be fired

#

what callback mean

shrewd apex
#

which button are u using disnake.Button or disnake.ui.Button also u need to put discord.ButtonStyle.link iirc

slate swan
paper sluice
shrewd apex
slate swan
shrewd apex
#

!d disnake.ButtonStyle.link

unkempt canyonBOT
silk fulcrum
slate swan
full lily
shrewd apex
glad cradle
slate swan
glad cradle
slate swan
glad cradle
#

!e

a
unkempt canyonBOT
#

@glad cradle :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'a' is not defined
glad cradle
#

send the full error message

#

like this one

slate swan
#

LOl

slate swan
#
  File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 105, in <module>
    async def fight(ctx, player1: str, player2: str, Health: int, Time: int):
  File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1479, in decorator
    result = command(name=name, cls=cls, *args, **kwargs)(func)
  File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1752, in decorator
    return cls(func, name=name, **attrs)
  File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 359, in __init__
    raise TypeError('Callback must be a coroutine.')
TypeError: Callback must be a coroutine.```
paper sluice
#

you expect us to help after you threaten us?

tidal hawk
#

lol

slate swan
#

<@&831776746206265384>

slate swan
silk fulcrum
#

😳

paper sluice
slate swan
#

good :)

silk fulcrum
#

yeah logs dont exist

paper sluice
#

mods can see your msg, deleting wont do anything πŸ˜„

hollow badger
#

@slate swan Clearly not appropriate. Please don't joke about such things.

slate swan
#

ok

#

πŸ’― will never do again :)

#

😊

tidal hawk
slate swan
#

:O

slate swan
tidal hawk
#

MM

#

bruh so it's not possible to keep track if the url button has been pressed... :(

slate swan
# tidal hawk MM

or try doing button = ui.Button(...)
button.callback = your_callback_func

slate swan
#

yeah this should work

#

now help mepepetired

#

or πŸ‡³ πŸ‡΄

slate swan
#

i need goo back to java

vocal snow
#

Yes please

silk fulcrum
slate swan
slate swan
vocal snow
#

Then use it, please stop bothering us πŸ™

slate swan
#

rude = anoying

silk fulcrum
#

then go code:) that's what i was wishing luck for

slate swan
paper sluice
slate swan
#

and i can unnderstand :)

paper sluice
#

many did, no use

silk fulcrum
#

and you are telling us that we are annoying?