#discord-bots
1 messages Β· Page 20 of 1
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
50 50
lol
!e
print(False)```
@lone lichen :white_check_mark: Your 3.11 eval job has completed with return code 0.
False
Lame
!e print(False)
!e print(False is not True)
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
π³
!e print(True + True)
@lone lichen :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
!e print(bool(False) is not False or True is not (False and True))
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
Um acting like ly, lame is not a word that solves everything
!e
print("".join([chr(int(binary, 2)) for binary in "01010111 01101001 01101110 01100100 01101111 01110111 01110011 00100000 00111110".split(" ")]))
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
Windows >
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))
Um actually, okimii > anyone and anything
@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

buttons or emoji reaction
buttons
bttuons

reaction ratelimits are 2/1s iirc
i think its 2/1s or 2/5s i cant remember
amongus
π³
bro?π€¨π€π§
among ducks
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
discord.ext.commands.Bot
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.
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
you are probably not using dpy 2.0
pip show discord
ok
in console
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:
yeah, 1.7.3
pip install git+https://github.com/Rapptz/discord.py
what this do?`
installs dpy 2.0 from github
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?
uhh
dowload git???
you are on windows?
ye windows 10
wha
`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
id click this
now pip install git+https://github.com/Rapptz/discord.py
ok
After you run the installer
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 ... |
???
- ERROR: Operation cancelled by user```
pip show discord
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:
it dint update yayy
Uninstall discord and install discord.py
Read the summary
pip uninstall discord
Then this
done
And then pip show discord.py
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:
finale
There you have 2.0
now run code
ok thank you!
;/
to update u need to have -U iirc
o errors
lots of them
1000 and 1
the cog loading is async now
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'
, intents=discord.Intents.all()
what this mean
enabling intents
and bot = commands.Bot(command_prefix = '!'), intents=discord.Intents.all()
in brackets
yes
ok
oh but you might have intents not enabled on dev portal
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'?
lemao this is not even dpy
slash commands dont work like this
`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`
your github thing is stupid
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'
hoh this is gonna be long
we know
client = discord.Client()
he has discord.Bot()
wahtt
i use bot and clinet
thats old code i guess
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
copy and past this?
there u go master 32 is best among us he will help u
this is your code
lol
NONONONO
bro that's ur own code
im outta here
it in pulic :)
bbye guys glhf
you forgot * 10
now how fix this
LOL
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'```
simple slash commands tutorial
ye glhf
first setup ur bot then make buttons
why do u want to in first place?
you can but that's bbbbbbruh
hybrid_command exists
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'
thats why half knowledge is dangerous kidsπΏ
dangerous kids?
read the tutorials
i 13 years old ;/
smh just meant half knowledge is bad
me2
lol
im jot noking
lol
most of the people here are young
o
excuse is not
HWO Fix this i gonna die
πΏ
show code of this file
isnt this the fifth time you link this gistπ
client = discord.Client()
ash simp
that's the whole code of a file?
aight
down bad asher
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:
Do we consider nitro paid work
then just put intents=discord.Intents.all() inside discord.Client()
no and it's not default
Oh so it's just color of pfp?
yes
Theres really no way to change it?
no
That's wild
just change the pfp
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
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
what i do with this
read it
how to read
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
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
maybe you are not in the channel with that id
I am
Whats the issue someone tell me
channel.id returns an integer but you are comparing it with a string
I think your in a wrong channel
What π
Alr
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
more code
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`
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
not ctx.respond, interaction.response.send_message
a
@silk fulcrum still got the same error even when importing asyncio
show code
where's await asyncio.sleep(3) instead of time.sleep(3)?
why this not working client = SlashClient() error
what is in line 100
client = SlashClient()
send me error
rom_file code = compile(f.read(), fname, 'exec') File "c:\Users\Ibrah\Desktop\discord bot\main.py", line 100 client = SlashClient() ^^^^^^
what is the error? syntaxerror?
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
wait wth, put setup_hook function inside the SlashClient class @slate swan
wdym
you mean the first if statement?
class SlashClient(discord.Client): def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self)
yeah
can you print the channel ID and ensure it's correct
it work, sorry i think the problem is the deleting part
or the attachment
I think
!d discord.Member.add_roles
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.
help
also don't create a new session everytime... that's a bad idea
just use Attachment.save
if you can't understand that, I can't help you
how
class SlashClient(discord.Client): setup_hook def __init__(self) -> None: super().__init__(intents=discord.Intents.default()) self.tree = discord.app_commands.CommandTree(self)
what?
okay sorry im not helping you
@silk fulcrum he is a beginner
clearly
dpy is not a beginner friendly lib
just
especially that it uses OOP
help me in this part for nitro
yeah i already fixed it but it still not working the role is also already fixed
i dont even care about nitro anymore
You said your arabic
Nice
can you send your updated code?
wtf?
@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'))
OH GOD HELP ME WHERE I PUT IT
what
He already told you man
OH GOD IN SLASHCLIENT CLASS
ye where i put it
YOU DONT SEE IT?
OH GOD READ
DOWN
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
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
learn how talk to people frist
Please snd ty
like this ```class SlashClient(discord.Client):
def init(self) -> None:
super().init(intents=discord.Intents.default())
self.tree = discord.app_commands.CommandTree(self)
setup_hook````
Don't ask for help after being told what to do multiple times
he don't tell me
anything just tell me add
method is not a variable, and you put not inside other method
.?
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
2
ye alot of places
hahaha you tell people to learn python when you cant count
now put it FIRCKING WHERE
lets please chill out β€οΈ
I GTg in 10 MINS AND I don't have TIME To make anything
What how where is the 2nd class
no one want tell me where
i was just joking pls dont ban me, i didnt mean to be toxiccc
i know
there are 1 class but
W h e r e
you're expected to know python basics before making a discord bot... you shouldn't expect people to help you if you don't know them
I was looking at this.. #discord-bots message
but he knows how to use github ai that will make code for you
i know but they are so rude that can't telll me where
ohgosh
and i gtg in 2 mins
Your so rude master32
what's the rush. When you're back, we can help you
i told you 1 2 3 4 5 6 thoushand times
insane pythonista 
:sadge:
in the meantime, it would be helpful if you take a small python course so you understand what we're saying
Ashley can help him now
yeah
Free π
yeah, havent you made it obvious
where
π
DUDE YES IN THE CLASS
havent I made it clear?
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
cany continue already
hi ashley
what]
dude what line
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()```
BYE
noo dont spoonfeed π’
can you stop with the uppercase spam
wild crowd in #discord-bots today
how stuffy it is in here
Master32 did nothing
dude the error still here
Do you know python? @slate swan
Im leaving already now
When did you start learning @slate swan
i make whole game with it
yes, im just freakin PIECE OF SHIT landing here in this channel AND JUST STUPIDLY saying some random stuff that doesn't give even a drop of help
3 days ago
not
But it not working :(
sad sky 
and so rude(
You are definitely not ready for oop in just 3 days
not
just shut up
Yeah !! Where. Tho
Rude.
you did your fill, some things are to be left alone to get dealt with
Learn how to talk to people π
ok
NOOO, he has an AI in github that can do all the work for him
Idk i just want help and he got mad for no reason
im so rude i cant even learn
Lol
what a m i meant to do
Github AI π
Im out of your shit, im not commenting
you not rude
I should too
python is number 1 AI maker
in this world
imagine using ghcp eww
well im gonna leave then too
wtf
foo
Python Sky left alone here
I'll help if I can
whats the issue
lol
π
it sitll not work
client = SlashClient()
I'd recommend you block each other instead of continuing your argument
and maybe take a walk π
i did
i will do in 10 mins
No argument here
ArgumentError: argument is required argument
oh that's really good idea
11 am here
sleep bro π
0:30 PM
i some time leep 5 am
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
I should..
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()
He doesn't know what they are
i know
:)
Master's so cute, blocking them is equal to a monsterous action
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
Master's cute π³
gay
??
yes i am
you too?
Homophobia?
yes yes
Homophobes aren't welcome in this server. Or this universe. Thanks
what wrong if i don't love gay?
you're very cute too
are you saying that it doesn't find the attachment in message.attachments?
love me
yes
I even tried just this just to know if it works
if (message.channel.id == 1005026300488056942):
if message.attachments:
print('image')
else:
print('text')
await message.delete()
and it identify text again
hmm how are you testing this?
Are you actually uploading an attachment
by sending an image to the cahnnel
or sending an image URL
yes
@slate swan tbh, look at Ashley, isn't she cute?
attachment
Yes i love ashley β€
ofc
Yeahh
Can you print message.content instead of text and see what it prints
aight
No !
π
it's blank
I blocked him !
idk if there's an update on python that change the code :<
ArgumentError: OT is not defined
Hmmm are you dpy 2.0?
Do you have message content intent enabled
*using
argument error 
who cares
π
I do
And what intents do you have enabled in the bots code
intents = discord.Intents.default()
intents.members = True
discord.Intents.all()
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?
You could do id=
As a kwarg
But you may as well use message.guild.get_role
await client.get_guild(guild.id).leave()```
Can someone help me with it? 
what is the issue?
error*
There's no error, but it does not leave
what does get_guild print? and you dont need to await it
Well nothing xDD
...?
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()
where's print
^
You can just use await guild.leave()
No need for get guild
why would u want to leave all the servers but ok
@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
How to fix this?
you pass command, which is str into client.add_command, you need to get the instance of this command, by client.get_command for example
so what do I do now
Not doing step=0, or random.randrange(int, int, 0) with int being an integer of choice
pass command object
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?
Help how to turn off the cycle
this is on_guild_join
yes
no
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
make sure to exclude token
what
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
show the isJoinhub function
nikakoy pomoshchi..
speak English
a po russki zachem pisat
nado
!rule 4 π
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
i said him to talk english
oh ok
and he refused
uhm, yes?
ΠΌ-Π΄Π° Π²Ρ Π²ΡΡ ΡΡΠΏΡΠ΅..
well tell him to deindent everything below the first await ctx.send
English only sorry
ΡΠΎΠΊΠ° ΡΡΡΡΠΊΠΈΠΉ Π½Π΅ Π±ΠΎΠ»ΡΡΠ΅
ΠΠ΅ΡΠΏΠ»Π°ΡΠ½ΡΠΉ ΡΠ΅ΡΠ²ΠΈΡ Google ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΠΌΠ³Π½ΠΎΠ²Π΅Π½Π½ΠΎ ΠΏΠ΅ΡΠ΅Π²ΠΎΠ΄ΠΈΡΡ ΡΠ»ΠΎΠ²Π°, ΡΡΠ°Π·Ρ ΠΈ Π²Π΅Π±-ΡΡΡΠ°Π½ΠΈΡΡ Ρ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΎΠ³ΠΎ Π±ΠΎΠ»Π΅Π΅ ΡΠ΅ΠΌ Π½Π° 100 ΡΠ·ΡΠΊΠΎΠ² ΠΈ ΠΎΠ±ΡΠ°ΡΠ½ΠΎ.
Π’Π°ΠΊ Π΄Π°Π²Π°ΠΉ ΠΏΠΎ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈ Π³ΠΎΠ²ΠΎΡΠΈ, ΡΠ°ΠΊΠΎΠ΅ ΡΡΡ Π½Π΅ ΠΏΡΠΈΠ²Π΅ΡΡΡΠ²ΡΡΡ, Π²ΠΎΡ ΡΠ°ΠΌ ΡΠ²ΠΎΠΉ ΡΡΠ°Π½ΡΠ»Π΅ΠΉΡ ΠΈ ΡΠ·Π°ΠΉ
I assume you told him that
ΡΠΎΠΊΠ° ΡΡΡΡΠΊΠΈΠΉ Π½Π΅ Π±ΠΎΠ»ΡΡΠ΅
Ρ Ρ Π°Π°
no u
Π§ΡΠΎ ΡΡ ΠΏΡΡΠ°Π΅ΡΡΡΡ ΡΠΊΠ°Π·Π°ΡΡ
learn English with the help of translator
I understand some Russian not a lot
But weβre not allowed to speak it here
I'm too lazy to translate from English into Russian
toxic penguin vibes
Π’ΠΎ Π΅ΡΡΡ Π½Π° ΠΏΡΠ°Π²ΠΈΠ»Π° ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΠΏΠ»Π΅Π²Π°ΡΡ?
Rip
...
k everyone stop speaking russian
ok
Π½Ρ ΡΡΠΎ ΠΆΠ΅ ΠΎΡΠ΅Π²ΠΈΠ΄Π½ΠΎ
Sorry ok
my mistake I thought it'd succeed
Π΄Π°-Π΄Π° Π½Π΅ ΡΠ΄ΠΈΠ²Π»ΡΠΉΡΡ
some people are unsucceedable
Any idea how can I pass the button.ui url from class parameters? can't use self..
did I say im surprised?
Wait does comands.when_mentioned
any one know why this not work client = SlashClient() error
Actually exist
Π΄Π° - YES
RUSSIn
ΠΠΠΠ!!!!
can't you find the button through self? how many buttons do you have?
it's a prefix
waht? no
what
is this in a view?
O so someone is a psychopath
also, why are there so many russians lmao?
mhm,
Can i make arg multiple?
yes
Why is there someone being racist
a view has a buttons attribute for sure
Π° ΡΡ ΠΊΠ°ΠΊ Π±ΡΠ΄ΡΠΎ Π½Π΅Ρ)
hm
How?
Separating Russians from everyday people due to speaking another language
@silk fulcrum help
you mean me??
!d discord.ui.View
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.
Yes
o
Separating Russians from other people due to speaking another language
how do I pass url from view to button?
oh it's self.children
Yes it is
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
O
bruh so many pings for help, who do I help and how
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.
MASTER
if that button is the first one, you can access it through self.children[0] later
maybe you can set self.children[0].url later
arabic
Ohh awesome idea, will check
Arabic?
ye, he can
Iβm smart XD
Ru VS Arabic
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
ARABic
def func(arg, *, multiple_words_arg):
RU
Dude this is getting off
1 most beautiful lagauges in this world
ARABIC 1 most beautiful lagauges in this world
go off topic
no RU
help with what
i want help in python
(arg, *, arg1, arg2):
this is getting probably even worse than our half drunk discussions yesterday
well no, what can be worse than that
Donβt think that exists
I have no idea of 3rd party libs
show code
it's a third party lib
Then how u know it exists
@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):
he has a subclass
Thereβs still docs
this from site
async def change_status(ctx, arg)?
why is it in middle of decorators??
why you setting it inbetween decorators
nope, ctx, *, arg
and why not just use bot
i don't know what are you tallking about :(
What is *, for?
what
a bot object has a tree already
When where who
heeyyy, you didnt ever show this code when we tried to help you
decorators are the lines that start with @
it just works like that, believe me
ah lol bc i dumb :)
o
you can't make a variable between the @ lines
this line @client.tree.command(name="ping", description="...")
!decorator
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
and don't even make a client, just use a bot in dpy 2
Thatβs a decor
you decorate functions and classes, not variables...
he has both: bot and client
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):


legend :lmao:
Bot isnβt defined
just use the tree from bot
and the command is registered on your client
not your bot
you probably run just bot
he has both client and bot
o it's same?
the command doesn't exist
bot is like a super set of client so pretty much
TypeError: parameter 'player1' is missing a type annotation in callback 'fight'
Its not multiple
player1: discord.Member, player2: discord.Member
Like: Hello there!
I assume
then I didn't get what you wanted
eeeee
and?
@slate swan
o
Try to understand the highlighted code
```async def fight(ctx, player1, player2, Health: int, Time: int):````
can you put me it pls sir
yeah you have to type : and then the annotation
do you want multiple words to be in one argument?
wdym
Just multiple words
async def fight(ctx, player1: discord.Member, player2: discord.Member, Health: int, Time: int):`
ok
what you put after : is an annotation
well as I see in ss you want absolutely what I said, so just do ctx, *, args
how
replace discord.Member with str
player1: str
yes
ok thank you sir
Thank you!
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
async def callback
105 line is async def fight(ctx, player1: str, player2: str, Health: int, Time: int):
wdym
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()
guys hybrid commands exist
wdym
I didn't even realize this wanted to be hybrid
w h a t
but now I see @bot.command() and the client.tree.command
w t f
currently it looks like spaghetti and meatballs thrown in a food processor to make sauce
lol
WTF ew
that's a great examination
also syntax for both slash commands and prefix commands are different do what u were doing won't work anyway
lol
exactly my point πΏ
wdym
@slate swan do you use dpy2.0?
ye
i linked u a repo in morning right?
you dont even need it for below 2.0 
ok but you need a slashclient for slash commands below 2.0
was slash commands even there below 2.0
no
yeah
dpy just implemented slash commands late 
Β―\_(γ)_/Β―
nah, he did this class
class SlashClient(discord.Client):
some weird slash commands stuff```
that's clearly taken from the gist
what even is their issue
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
seems ideal
Also they were being homophobic a few hours ago.
uh
I remember now, thanks for the recap zeffo
well that's talent too
I learned python with dpy
ew
π«
That's fine. But this guy isn't doing any learning.
π«
lmao
group hug π
why do you guys even wanted to write a bot without knowing the language itself 
π€

i was 10, I didnt even clearly understand what am i doing
imagine
all people with determination to do something π
You weren't even allowed on discord π€¨
damn that's early i barely started python 6 months ago
yes, but who cares
anyways, ot
yes, but who ca...
help
Help who can fix this error
and other down one
i feel all here can't help me 
u are correct
not reallly
only u can help urself out here by learning python π
help
but this very small thing i will not spent 1 week learn all pytho for 1 error
i made a game btw
π

if it's a smol thing then why ask us
hahahaaa do you think you will get only 1 error?
bc you guys know
idk just help me without get rude ;/
this is getting annoying every message now
Um actually, I can't disagree...
have you tried to read the error?
yes
what mean Callback must be a coroutine.
show the whole traceback jeez
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()
sys.exit() πΏ
he asked the traceback
yeee
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()
traceback
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()
Ok thx ;)
why do you bot.command and an app command?? 
idk bc i so dumb
hik-
scroll up like 100 messages u will know why
url is a Button-only kwarg
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
which button are u using disnake.Button or disnake.ui.Button also u need to put discord.ButtonStyle.link iirc
any help so i leave you guys alone
its something which is called when a user interacts with certain parts of the ui
first send the traceback
disnake.ButtonStile...
what is traceback
o
!d disnake.ButtonStyle.link
Represents a link button.
traceback is the big error message you get sometimes
?
you wrote discord π©
Traceback (most recent call last):
ok!
π

!e
a
@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
LOl
a function that is triggered upon a certain event
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.```
you expect us to help after you threaten us?
lol
<@&831776746206265384>
not really
π³
good
good :)
yeah logs dont exist
mods can see your msg, deleting wont do anything π
any help :(
wdym ;/
@slate swan Clearly not appropriate. Please don't joke about such things.
but I need a callback aswell :0
:O
a callback for a url button will never be triggered
what can I do
me help :(
or try doing button = ui.Button(...)
button.callback = your_callback_func
D:
yeah this should work
now help me
or π³ π΄

Yes please
glhf
no until some one help me google so useless
i aready know java
Then use it, please stop bothering us π
rude = anoying
then go code:) that's what i was wishing luck for
i will not sotp bothering you until some one help :)
the thing is we can't help you, because anything we say you won't understand as you are not familiar with python.
Try :)
and i can unnderstand :)
many did, no use
and you are telling us that we are annoying?



