#discord-bots
1 messages · Page 349 of 1
been up. its 7pm for me 💀
🇬🇧
HIS MESSAGE GOT DELETED 😭

pto internet
nah thats wild
1pm for me 
it's my internet, give me a sec xD
goofy skull? 😭
what the fuck is ctx.respond
This is a GitHub Codespace and I want to use that ffmpeg.exe I uploaded to manipulate the music/url I get from the yt-dlp for the bot but I don't know how to execute the ffmpeg file with the configs I already defined in a var from inside of the codespace
I looked through the source code, they both essentially just wrap sqlite3, by running it in a threadpool across a mpsc:
https://github.com/omnilib/aiosqlite/blob/main/aiosqlite/core.py#L102-L109
aiosqlite/core.py lines 102 to 109
while True:
# Continues running until all queue items are processed,
# even after connection is closed (so we can finalize all
# futures)
tx_item = self._tx.get()
if tx_item is _STOP_RUNNING_SENTINEL:
break```
Who tf knows
thats dope as shit what
But he is using sqlite, a regular version of sqlite3, he should switch to asqlite or aiosqlite either works, but he should switch 
best advice i can give is theres probably a library to run executables
subprocess?
just do a path to it and run the executable
hes using await's in his queries tho?
I did await in regular sqlite
I think
sqlite3 is blocking so you cant use await

might be losing it
you can't await stuff that are not awaitable
Bro I am so confused rn, so tired. Maybe I am tripping 😭
you are defo tripping
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
it is not violeting anyone's tos bc it's private not public, point 9...
Its streaming music from YouTube. It is breaking point 9
okay
What do I do if "interaction" does not have attribute select?
what you want to achieve?
what does it mean to select an interaction?
I'm looking at and making a ticket system and it tells me that the interaction doesn't have a select attribute
can i get the an emoji inside my code as a variable like a string or something ? as im trying it now it gets printed out like this
i need it as an id, string or something wich i can compare it with inside an if statement
!pithink prefix the emoji with a \ to get its id if its a discord emoji if not u can just compare its unicode values
or as simple as emoji == '🙂'
So, I'm trying to make a command only accessible by me to show all the servers that the bot is in. I've been trying to get it to work for a while, but it just doesn't want to work. Help is appreciated :)
My Code for this command:
@bot.command()
async def activeservers(ctx):
if ctx.author.id == 770484893657333761:
servers = bot.guilds(limit=None)
embed = discord.Embed(title="Active Servers", description=f"There are currently **{len(servers)}** active! Here is a list of them:\n\n{servers}", colour=discord.Colour.random(seed=None))
await ctx.reply(embed=embed)
else:
embed = discord.Embed(title="Error", description="You don't have permission to use this command!", colour=discord.Colour.red())
await ctx.reply(embed=embed)
nvm, i got it to work :)
uhm
new problem, so im trying to add buttons to it that would allow me (and only me) to remove it from certain servers, along with it displaying the server ids (and in the buttom promt it would ask for the server id)
im using these, but im getting an error that its not a thing
from discord_components import Button
from discord_components import ActionRow
from discord_components import wait_for_button_click
have you tried discord.ui
you’re the best person to tell for this bc i finally figured out how to make a “daily” command that rewards you with coins every day and even can even measure your streak, all with three columns:
- a user_id column
- a last_run column with the timestamp of when the user last ran that command
- a streak column to see how many times they’ve run the command
here’s how it works:
- get the timestamp of last run
- calculate the time difference from when it was last run to when you can’t run it before
- if its negative, tell them they lost their streak and give a timestamp since they last run the command
- if the date of last run and the date they are running the command is the same, they’ve already run it today
- if the date of last turn and of the time running the command is different, its a new day and they can be rewarded with their coins
no :)
I have this
Thats easy to make, I have one in my bot lol
starts with 0, then continues from there lol
But thats cool, congrats on that!
what did you do in terms of code?
cuz im better
Just projects and discord bots
learning game hacking
☠️☠️
😭
OHHHHH
im slow 
So I kinda do what you do. This is my table.
user_id
is_registered
bank_balance
wallaet_balance
last_daily_claim
daily_streak
So inside of the last daily claim, I use timestamps, which if they have claimed within the last 24 hours, it will make your daily streak go up, but if not, then it will reset back to 0
But I use a lot of functions so I don't have to repeat the crap over n over in each command.
[2024-04-05 02:37:47,242] [ERROR] Ignoring exception in command 'purge'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/discord/app_commands/tree.py", line 1248, in _call
await command._invoke_with_namespace(interaction, namespace)
File "/usr/local/lib/python3.11/site-packages/discord/app_commands/commands.py", line 849, in _invoke_with_namespace
if not await self._check_can_run(interaction):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/discord/app_commands/commands.py", line 987, in _check_can_run
return await async_all(f(interaction) for f in predicates)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/discord/utils.py", line 703, in async_all
for elem in gen:
File "/usr/local/lib/python3.11/site-packages/discord/app_commands/commands.py", line 987, in <genexpr>
return await async_all(f(interaction) for f in predicates)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/discord/app_commands/checks.py", line 339, in predicate
raise MissingPermissions(missing)
discord.app_commands.errors.MissingPermissions: You are missing Manage Messages permission(s) to run this command.
How to add error handling for appcommands/tree commands?
Im used to hybrid commands, so I don't really know tree error handling?
!d discord.app_commands.CommandTree.error
@error(coro)```
A decorator that registers a coroutine as a local error handler.
This must match the signature of the [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree.on_error) callback.
The error passed will be derived from [`AppCommandError`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.AppCommandError).
Me no understand lol
How can I make this error handling support app commands? Or is that not possible?
How do check if a word is in a embed or not
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
x == y Checks if two embeds are equal.
New in version 2.0...
A specific part or all of it?
A word
Yes? But in what part of the embed?
Can I check in every part?
Yes
"embeds": [
{
"id": "embed_774",
"url": "https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed",
"type": "rich",
"rawTitle": "discord.Embed",
"rawDescription": "``py\n\nclass discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)``\nRepresents a Discord embed.\n\nlen(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.\n\nbool(b) Returns whether the embed has any data set.\n\nNew in version 2.0.\n\nx == y Checks if two embeds are equal.\n\nNew in version 2.0...",
"contentScanVersion": 0,
"fields": []
}
],```
You can see embeds easily
its not hard lol
isnt it cog_app_command_error?
???
any who have code for invite tracker in python?
!d on_member_join
No documentation found for the requested symbol.
damn it
because it doesn't have a select attribute. interaction.select is not a real thing
How do I fix?
don't use it?
Oh
whats your code
Ticket System
the lines of code?
What?
this??
yk the code you've written?
the product of pressing letters on the keyboard??
Do I have to send you the entire ticket code?
hi
no, just the part thats raising the error
hello, whats your issue
!ot
Please read our off-topic etiquette before participating in conversations.
use the off-topics or #python-discussion for conversations about code
no problem 👍
are you staff
no
will you be my helper because i am newbie
nothing, i want to be your coding partner
will you
async def select_callback(interaction):
if interaction.select.custom_id == "ticket_select":
value = interaction.values[0]
category_id = None
embed_desc = ""
ping_role = ""
@viscid hornet
will i what?
- you're missing
self(most likely) interaction.selectisn't a thinginteraction.valuesisnt a thing
be partners on what?
coding and helping @viscid hornet
what do i set?
interaction.self
wdym "what do i set"
whatt do i put in che code
you need self in the arguments. self refers to the select menu itself, so anything related to the select will come from self
i dont know where to put it
take a look at how this works ```py
class ExampleView(ui.View):
...
@ui.button(...)
async def hi(self, interaction: Interaction, button: Button):
# button refers to the button while self refers to the view
class ExampleButton(ui.Button):
def init(self):
super().init(...)
async def callback(self, interaction: Interaction):
# self refers to the button now```
i'm guessing the select is a separate class
async def select_callback(self, interaction):
if interaction.self.custom_id == "ticket_select":
value = interaction.self[0]
category_id = None
embed_desc = ""
ping_role = ""
this?
@viscid hornet
i marked the guy's response with an ❌ for a reason
interaction.self does not exist. i told you to just use self
async def select_callback(self, interaction):
if self.custom_id == "ticket_select":
value = self.values[0]
category_id = None
embed_desc = ""
ping_role = ""
this?
better, but it's self.values, not self
self refers to the entire select menu
custom id, options, view, etc
New Error
select_callback() missing 1 required positional argument: 'interaction'
Should I put () interaction?
where are you calling this?
also why are you calling a separate function?
this is taken from an example written by the guy who made dpy ```py
class SelectMenu(ui.Select):
def init(self):
options = [
discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
]
super().init(
placeholder = 'Choose your favourite colour...',
min_values = 1,
max_values = 1,
options = options
)
async def callback(self, interaction: discord.Interaction):
await interaction.response.send_message(f'Your favourite colour is {self.values[0]}')```
Can I send you all the code and then you can fix it for me? to say it like that I don't know how to fix it
That was written by me, actually 🗿
no fucking way you wrote that
im honoured 😭
just send all the select code 
Yeah, but the original file was moved so it doesn't show me as a contributor anymore lol. all good though
Anyway yeah, please send the whole view code
so send it?
ok
your select callback requires arguments so you cant just define the select in the command, you have to use an external class
And how?
i just showed you lmao
this is an example
fix it, I don't understand anything anymore
nah I fixed it, that error handling is for hybrid n prefix commands. Which is what my bot is mainly abt. So I changed it to where it is just a purge.error for my one app command.
it's your code so it's probably a good idea that you fix it
is it possible to delete slash commands for the bot? if it is, how? (discord.py)
anyone familiar with discord buttons, can you check my thread
https://discord.com/channels/267624335836053506/1225873948827451473
yes, syncing the command tree removes any commands that havent been registered with it (for example if you deleted a @bot.tree.command() from your code then the next time you sync, that command would disappear)
https://github.com/RejectModderss/Discord.py-Template/blob/main/commands/Owner/owner.py#L16
Here is a sync command ive made, or you can use Umbras sync command
https://about.abstractumbra.dev/discord.py/2023/01/29/sync-command-example.html
commands/Owner/owner.py line 16
@commands.command()```
If there's an uncaught exception within a task is the entire task destroyed?
anyone familiar with discord buttons, how do i check if a message has a button? ive tried everything and nothing works
how can i make something like this into my bot profile too?
class ExampleView(ui.View):
def __init__(self):
super().__init__(timeout = 30)
@ui.button(label = "hello", style = BS.blurple)
async def hello(self, interaction: Interaction, button: Button):
await interaction.response.defer()
@ui.select(options = [SelectOption(label = 'hi', value = 'hello', description = 'example') for _ in range(3)])
async def select(self, interaction: Interaction, button: Button):
await interaction.response.defer()
...
@bot.command()
async def view(ctx):
view = ExampleView()
await ctx.send([type(child) for child in view.children])
get it from there using isinstance
the instance you're comparing each child to is ui.Button btw
@client.event async def on_member_join(member): SysC = client.get_channel(SystemChannel) # when user joins, bot mentions user await SysC.send("Hi" + member.mention)
idk how to make member mentioned
when joined
what's it doing now?
you just mentioned them?
basiclly when player joins it mentions them, not a big deal
so whats the issue
also pro tip: use f strings because using x + y, say x is a str and y is a list, will raise errors
sounds cool
@client.event
async def on_member_join(member: discord.Member) -> None:
SysC = client.get_channel(SystemChannel)
# when user joins, bot mentions user
await SysC.send(f"Hi {member.mention}")
yea that
I was searching where did I found that
||pro tip: dont spoonfeed, just to lyk||
also how do ya share code in that text format lol, I never did much share, but want to know
raise functions very much like return, so probably
!code
responded to wrong msg
By the way... if that system channel is the same as the one you set up in the server settings, consider:
member.guild.system_channel
useful
@silver wolf Sorry for the ping. Did you created the discordLevelingSystem package?
yes i did
is there a way to look into the guild permissions for a member?
I want to make sure the member has the server manager
(in discord.py)
!d discord.Member.guild_permissions
property guild_permissions```
Returns the member’s guild permissions.
This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for).
This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.
Changed in version 2.0: Member timeouts are taken into consideration.
Is there any way to display the rank as an image like that?
try using Pillow
I thought maybe the package already has something like that
!pypi discordLevelingSystem looking into the code, nope sadly
Is there anyway to keep old interactions active after restarting bot?
for handling discord.py views? yes, you can add persistent views to your bot to handle component interactions
https://gist.github.com/thegamecracks/0f9ab7ad3982e65ff4aa429acb39cc4e
for any interaction in general (slash commands, modals, etc.), its theoretically possible but not supported by dpy, or at least not via a public interface
yes
Like, the task is no longer being ran at all?
yes
ahh that makes sense
Hey, so I am using AIOSQLITE with a discordbot. and primarily it will only be used with a websocket feed to constantly add and check data.
There may be the occasional command used to check data, but overall it's just the websocket.
Will I encounter issues?
Should I change database types?
if anyone knows simple code and wants to earn some money fast dm me
!rule 9
hhmm
Heyo, I want to try doing ui modals, but i specifically want to make some sort of date selector that looks like this. Is it possible?
No
discord.https , how to use for beta app commands 
app commands are not beta anymore
more of an explanation por favor 
they have been out for about 2 years at this point
was talking about this , just didn’t know what to call it besides beta apps
ah, you mean the new global app commands
i don't think discord.py has support for it just yet
what a bummer, it looks fun to mess around with 
thats what i tried
for action_row in message.components:
for component in action_row.children:
if isinstance(component, discord.ui.Button):
print("This message has a button!")
it doesnt work though
Doesnt work mean? You get an error?
no. adding an image like that was in development at one point, but the person that was working on it (the one who created a pull request) stopped working on it so it was nvr added. i had nvr originally planned on adding something like that because all the information u need numbers wise is already in the lib and i didn't wanna depend on any other lib other than discord.py.
plus there are a few image libs like what ur looking for already where u just have to put in the numbers and .read() a file for the background image
cycle through the view's children
no it doesnt print, even tho it has a button
uhh im not sure what u mean
if it doesnt print then it doesnt found a button
for item in view.children:
if isinstance(item, ui.Button):
... # button found```
try putting print before isinstance to see what components it sees
i showed it to you in that screenshot
i tried printing message.components but it shows nothing
it shows nothing or it shows empty list
like it doesnt print anything
and where is this code located
on_message event
thats what u mean?
yea
can you show full code?
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
if message.channel == channel and message.author == user:
for action_row in message.components:
for component in action_row.children:
print(message.components)
print out channel and user they might be None
it passes the if statement
i know that, i tried it
i suppose it detects bot messages
yes
how about you put print(message.components) at top
why not just message.view.children?
i dont think thats a thing hold on
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
print(message.components)
like this?
?
yep
ill try
i thought there was a view attr to a message
yea try
it printed a whole lot of text
!code send it here
[<ActionRow children=[<Button style=<ButtonStyle.success: 3> custom_id='7fae2a8b77c42513ce7fe4f9fe27c997' url=None disabled=True label='FIRST' emoji=None>, <Button style=<ButtonStyle.success: 3> custom_id='b2cb3aeceec04c97f10cd230e348ad60' url=None disabled=True label='PREVIOUS' emoji=None>, <Button style=<ButtonStyle.secondary: 2> custom_id='2af12a0678a6a49986dc3d08912577f2' url=None disabled=True label='1/10' emoji=None>, <Button style=<ButtonStyle.success:
3> custom_id='a2f22abb4b1d37ee165f0ecfe7365968' url=None disabled=False label='NEXT' emoji=None>, <Button style=<ButtonStyle.success: 3> custom_id='773f1eeb3022d703d3052fa3f58dbf4b' url=None disabled=False label='LAST' emoji=None>]>]
so it does have the action rows
most likely the if check does not pass
it does
then put that print under that if
you talking about this one?
if message.channel == channel and message.author == user:
yea
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
if message.channel == channel and message.author == user:
print('test')
then when you have that for loop
put print(1) inside
for action_row in message.components:
print(1)
for component in action_row.children:
print(1)
if isinstance(component, discord.ui.Button):
print(1)
i tried it like this and it doesnt print anything
not one 1
impossible
hahah i mean thats what happened
do you have any error handler in your code?
no
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
if message.channel == channel and message.author == user:
print('test')
for action_row in message.components:
print(1)
for component in action_row.children:
print(1)
if isinstance(component, discord.ui.Button):
print(1)
this is the message, im just using carl-bot for testing
cause its help command has a button
can you try this code? ```py
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
if message.channel == channel and message.author == user:
print('test')
for action_row in message.components:
raise
yes 1 sec
doesnt print anything
not even the test?
oh right it prints 'test'
mb
can you show full code?
whole file?
cause it seems something is blocking errors i think
sure
I don't know what error could it be
import discord
from discord.ext import commands
import json
import asyncio
import re
import rand
with open("config.json", "r") as conf:
config = json.loads(conf.read())
token = config["startup"]["token"]
prefix = config["startup"]["prefix"]
channel_id = config["listener"]["channel_id"]
user_id = config["listener"]["user_id"]
client = commands.Bot(
command_prefix = prefix,
intents = discord.Intents.default()
)
@client.event
async def on_ready():
print(f'online')
@client.event
async def on_message(message):
channel = client.get_channel(channel_id)
user = client.get_user(user_id)
if message.channel == channel and message.author == user:
print('test')
for action_row in message.components:
raise
client.run(token)
You didn't enable the message_content intent
you dont have message content?
So you cannot access the components
The Discord gateway only dispatches events you subscribe to, which you can configure by using "intents."
The message content intent is what determines if an app will receive the actual content of newly created messages. Without this intent, discord.py won't be able to detect prefix commands, so prefix commands won't respond.
Privileged intents, such as message content, have to be explicitly enabled from the Discord Developer Portal in addition to being enabled in the code:
intents = discord.Intents.default() # create a default Intents instance
intents.message_content = True # enable message content intents
bot = commands.Bot(command_prefix="!", intents=intents) # actually pass it into the constructor
For more information on intents, see /tag intents. If prefix commands are still not working, see /tag on-message-event.
so like this?
intents = discord.Intents.default()
intents.message_content = True
client = commands.Bot(
command_prefix = prefix,
intents = intents
)

done should i try it again now
then how did it print out them
.
yeah i was wondering the same thing lol
Probably the bot's own buttons? Idk
no
im still getting only test
But why won't it do anything in the recent code if it can access them?
with this
if message.channel == channel and message.author == user:
print('test')
for action_row in message.components:
raise
i mean come back to old code
with print 1

alr hold on
if message.channel == channel and message.author == user:
print('test')
for action_row in message.components:
print(1)
for component in action_row.children:
print(1)
if isinstance(component, discord.ui.Button):
print(1)
with this still only prints test
im out of ideas
😂
guess its not happening, ty for helping all that time still
!d discord.Message.components
A list of components in the message. If Intents.message_content is not enabled this will always be an empty list unless the bot is mentioned or the message is a direct message.
New in version 2.0.
weird
my only guess could be that maybe something else than a for loop?
i dont see what is wrong with for loop
should be working
Try printing out the components before the loop
There's nothing to lose anyway
it printed []
Did you get a message about the message_content in the console?
no
😕
yeah thanks for the help anyway
How can i make a slash command in a cog?
slash commands are scum created by the discord elite to make using your bot infuriating, do not give in to their demands
😂 ???
its his choice what he uses
^ agent paid by discord, do not listen to their requests
Guys can I know a free hosting service for a bot 24/7
There are like free trails but there aren't free services I'd actually recommend even if a server is very small.
Love me some Discord conspiracy theories
@app_commands.command(name="reload")
async def reload(self, interaction: discord.Interaction):
try:
await self.bot.unload_extension([extension for extension in self.bot.extensions.copy()])
await self.bot.load_extension([extension for extension in self.bot.extensions.copy()])
synced = await self.bot.tree.sync()
except Exception as e:
await interaction.response.send_message(f'An error occured: {e}')
return
await interaction.response.send_message(f'Successfully reloaded cog(s)')
await interaction.response.send_message(f"Successfully synced {synced} command(s)")
An error occured: 'list' object has no attribute 'startswith'
What have i done wrong?
You're using a string function on a list.
...
Do you have the whole traceback?
string function?
No documentation found for the requested symbol.
!d str.startswith
str.startswith(prefix[, start[, end]])```
Return `True` if string starts with the *prefix*, otherwise return `False`. *prefix* can also be a tuple of prefixes to look for. With optional *start*, test string beginning at that position. With optional *end*, stop comparing string at that position.
Wait so whats the fix?
Oh i think i might have an idea
so i guess i cant just put the for loop in the load and unload extension then?
I don't see any startswith function in the code you provided hence I asked for the full traceback.
i dont have a startswith function, i wil try get full trace back
class invitebutton(discord.ui.View):
def __init__(self, page: int, total_pages: int):
super().__init__()
self.page = page
self.total_pages = total_pages
@discord.ui.button(label="<", style=discord.ButtonStyle.primary, custom_id="prev")
async def left_button(self, button: discord.ui.Button, interaction: discord.Interaction):
if self.page > 0:
self.page -= 1
await self.update_page(interaction)
@discord.ui.button(label=">", style=discord.ButtonStyle.primary, custom_id="next")
async def right_button(self, button: discord.ui.Button, interaction: discord.Interaction):
if self.page < len(self.entries) - 1:
self.page += 1
await self.update_page(interaction)```
for some reason this discord.ui stuff is not working up for me.
AttributeError: 'invitebutton' object has no attribute 'entries'
https://pastebin.com/B4C26DGs the traceback
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
!d discord.ui.button
@discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction) you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button) being pressed.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button) manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
Well I don't see entries defined here I'm assuming you want to pass a list of embeds there.
yea im passing a list of embeds there
How?
totalpages = list of embeds?
no its a number
So page is the embeds..?
no. embeds is defined for 1 page only
await interaction.message.edit(embed=embed, file=file, view=invitebutton(page, total_pages))
should i pass all the embeds there?
page, total_pages, embeds
Well entries is referring to a list of embeds like the code in the button emplies.
ooo
What does [extension for extension in self.bot.extensions.copy()] result in?
Since unload expects extension paths.
The list of embeds is needed in the view otherwise the code wouldn't know what embed to show.
a list of the current cogs
['cogs.util_cog', 'cogs.fun_cog', 'cogs.faa_cog']
Is that what it returns?
Yes that is what [extension for extension in self.bot.extensions.copy()] returns
Well unload and load doesn't take lists, lol should've seen it sooner.
!d discord.ext.commands.Bot.reload_extension
await reload_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.unload_extension) followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.load_extension) except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
Ah i see, i assume this doesnt take in lists also?
How come?
Nope, just for loop the list first.
Because you can only sync that many times per day, also takes long to sync and this doesn't take into account if metadata is being updated or not.
Ohh, so what do i do then?
Preferably you'd want to sync to a development guild, when you're done building the features you then push it to production and sync them globally.
Right I see, and how can I do that?
!d discord.app_commands.CommandTree.sync when passing a guild it will sync to that guild instantly and not sync globally yet.
await sync(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Syncs the application commands to Discord.
This also runs the translator to get the translated strings necessary for feeding back into Discord.
This must be called for the application commands to show up.
Thank you for your help
Haven’t developed in a while so getting used to so many new things XD
Np, gl!
@marsh furnace found u
tfr_group = app_commands.Group(name='tfr', description="Request, Accept, Deny or List TFR's")
@tfr_group.command(name='test')
async def test(self, interaction: discord.Interaction) -> None:
await interaction.response.send_message("Hello", ephemeral=True)
What is wrong here? I'm getting no errors or anything but the command is not coming up when I do /
Did you sync them?
Yes I did
Loaded the cog/extension?
Yep

And yes I also reloaded my Discord
i’m guessing this is in a cog
Yes
Previous ones I have made
i’m pretty sure commands need a description too, but i might be wrong on that. add a description and see if it comes up
Alright, lemme try that
are there any commands that have been made with groups?

No, this is the first one
Im also trying to follow this tutorial but it isn't working :/ https://www.youtube.com/watch?v=jTBN19Nm0h0
hmm i’ll take a look. give me a second to get inside, i just got home
Ah okay, thank you
it's also not a good idea to use youtube tutorials because most of them only teach 1 thing which means people who follow the tutorials only learn how to do that 1 thing very well
yeah, ive tried watching a bunch of tutorials and they have so many different methods. I don't know which is the best or even which works ect :/
even following the api reference its confusing to me, like i dont understand what all this is
Well
ok i'll break down the docs for you:
- class: it's telling you what you're looking at is a class, not a variable or coroutine or whatever
- discord.app_commands.Command(): this is telling you what you would have to write if you only started your file with
import discord(ie. how to get that thing from thediscordfolder) (*, ...): this means you need to call everything using kwargs (ie.name = ...and not just...)(*, name, description ...): these are the arguments it takes (what to put into it)
i say unless your group does a function like /balance for example, define it like this: ```py
group = app_commands.Group(name = 'group', description = 'hello')
@group.command(name = 'hi', description = 'Tell someone hello')
...```
Thank you for the break down, actually helps alot. And I will try this method.
oh
you dont need to use ever argument either
The documentation even breaks it down explaining what every argument does
i'll scribble up something for if the command does something like /balance
just to double check because i don't know off of the top of my head
Im hoping to make a group which the base command is /tfr and the different options are
/tfr request <information inputs here>
/tfr accept <id>
/tfr deny <id>
/tfr list <id/all> <id here if id selected>
🤔
Does grouping work like that?
I would've assumed you'd need to make a list using the choices thing
¯_(ツ)_/¯
but idk never used group
Well i was able to accomplish it with normal commands but when i migrated to slash commands its a pain in the butt
Normal commands are different tho lol
lol
just close the app and wait a ew minutes.
a few minutes*
or ew minutes if you think it's icky
ya, groups can contain commands or subgroups, and subgroups can only contain commands
https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
syncing is about 2/30s last i checked, shouldnt take too long
yeah what is subgroups? Whats the difference between them and groups?
oh wait
you just explained pretty much
oh if there's no /tfr command, just use app_commands.Group()
Grouping commands seems useful
isnt that what i have been doing?
🤔 indeed. <headnods> Yep. when I can be bothered all my bots will be updated.
tfr = app_commands.Group(name = 'tfr', description = 'hello')```
UPDATE ALL THE BOTS!!
yeah your code checks out to me
what was the initial issue?
then from here we can do
tfr.command(name = 'Thingy', description='Thingy thingy mcthingy')
is there a way to run a bot by another bot
like I have a discord bot that detect messages in a cretin channel if a discord bot token was sent in this channel the bot will detect it then run the token in a certin code
I saw someone doing this but IDK how
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
thats also not gonna work lmao
if you try and send a discord bot token, discord will automatically revoke it and reset the token
Doesn't discord actively detect most places, like github, gitlab and even discord itself if a token is sent?
what is the illegal thing with I said?
Yep, happened to me
I know it at least checks github
That message is not fun to see as a novice for the first time
the whole of github?
THE WHOLE OF GITHUB
in modal
had a fright when i accidentally pasted code with it in
there is bots called "bot makers" doing this
ya, that message when it first appears. you do be getting heart sinky moment
like "oh god. oh no. pleease. please. WHAT DID I DO?! is this the end? tell my mum i loved her."
could take the tokens and use them for malicious purposes like nuking servers 
pro tip: dont send random bots your discord bot token 
:(
tfr = app_commands.Group(name='tfr', description='testing')
@tfr.command(name='test', description='test testing')
async def test(self, interaction: discord.Interaction):
await interaction.response.send_message("Testing", ephemeral=True)
This is why I nuke my own servers before they can nuke them.
Reload discord. CTRL + R
oh i know what it is
you just pressed /, type in the rest of the command 💀
I have been actively doing that
i got nothing.
it's showing all commands because you only typed in / and nothing else
HHMM. Did you try turning it off and on again?
Funny enough, Yes.
BRB lemme test myself
real one frfr
gotta see if I got a test bot setup..
Is that an IT Crowd reference? heh
hold up. music time.
WOO
works fine
@supple jacinth show the file with that code in
im guessing its a cog w like 5 commands or something
!code
use that bottom hyperlink
It is absolutely terrible, I commented my old code since I want to turn the commands into the slash commands.. https://paste.pythondiscord.com/BC7A
works for me!
from discord.ext.commands import Cog, Bot
import discord
from discord import app_commands
from discord import Interaction
from discord.app_commands import guild_only, command
class TestClass(Cog):
def __init__(self, bot:Bot, config:dict):
print("[Cog] TestClass has been initiated")
self.botBot = bot
self.config = config
tfr = app_commands.Group(name='tfr', description='testing')
@tfr.command(name='test', description='test testing')
async def test(self, interaction: discord.Interaction):
await interaction.response.send_message("Testing", ephemeral=True)
@command(name="ping", description="Pong")
@guild_only()
async def ping(self, interaction:Interaction):
await interaction.response.send_message("Pong!")
:D
How-
uhh
Lets do some basic troubleshooting. Starting at the most obvious. Is your test function used elsewhere?
is the command name test used elsewhere?
assuming the code is the same, is the cog loaded properly?
Try and make another command in said cog like i have to test this
This is the file it is in https://paste.pythondiscord.com/BC7A
is the indentation wrong on the paste? or is that actual indentation you have on your IDE?
No, the indentation is wrong on the paste haha
Try my code
oh actually. dont.
My code is different.
Try and remove all the useless stuff you dont need atm just to test the code. So remove all the imports that arent being used (You can bring them back dw)
and change the tfr command group to something else, something you know you havent used at all.
So instead of tfr = app_commands.Group(name='tfr', description='testing')
it's: test_group = app_commands.Group(name='testgroup', description='Testing')
this way you know for sure you havent re-used the name elsewhere
If it works with new placeholder names, then you know it's just a naming issue and you can figure out where you went wrong, I suspect it's a naming issue.
And lastly, put the test command I have in, the ping command.
This is just to make sure the cog itself has been loaded and is running.
This is just how I debug shit when it doesn't work. Just change all the shit. remove all the shit. force the program to focus my shit.
When all else fails. Cry in a corner.
Alright, just give me uno second
Then realize mid sob you actually made a really basic mistake, come up with a story about how it wasnt your fault and actually you're super awesome and smart for figuring it out.
Great start...
lmao
but no errors lmfao
you're not syncing the command tree up. that's the issue lol
I restarted the bot, then ran the command just to be sure
If you are using a command to reload the cog instead of the entire bot, you're not syncing the command tree up properly.
But that's not in your cog.
nope
Which means those commands arent getting loaded in
Try reloading the entire bot not just the cog.
Do we ree now? or cry now?
Nothing comes up, I think it is time to cry
well anyway. try my debugging steps. See if any of those work. Coz the code I shared definitely works.
I dont get it though, because this command is in a seperate cog and it works..
Wait. so the "cog" itself with the tfr command isnt being loaded in at all?
This is also why I said to just change all the names and things
Um, lemme try changing names then
all the names. Not just 1 at a time.
Change them all. You can figure out which one specifically it was afterwards.
async def load_cogs():
for cog in os.listdir('/home/joshy/Bot/cogs'):
if cog.endswith('_cog.py'):
module = cog[:-3]
await bot.load_extension(f'cogs.{module}')
``` is there anything that looks wrong with my load cog function?
What the dir looks like
all hail the bob cog
BOB COG
if the other cogs are loading then I doubt its your code
Should i try manually add it?
Part of programming is debugging such things. Instead of asking just do it.
See an issue, think of ways to fix it. No matter how dumb, the only one who will know is you.
and your locally assigned FBI agent.
yay
Nothing happens though.. :(
The cog has loaded, so there is no issue with that?
\o/
1 thing debugged. We now know the cogs are loaded, there's no need to be worried. so the issue lies with the codeblock itself \o/
as i said earlier, it probably has something to do with your names for the functions and variables. Try and change those. Give them something completely random.
In the example code you sent earlier, I noticed a lot of the characters tfr being thrown around a lot. There's a good chance you've accidentlaly used tfr elsewhere and its being overwritten.
and the function test could have also been used elsewhere
So to ensure nothing is repeated, use random names as placeholders now. Load the bot, reload discord.
This has been what i have had since you told me to change the names
hehehe goofy goober
you definitely watched spongebob recently
oh
you're using the same function name for both commands sponge and bob
change the function name to be test1 and test2
rleoad the bot. reload discord.
then thank me.
Maybe even worship me a little bit.
Do you want the left corner or the right corner? I prefer the left corner to cry in.
WAIT WAIT
left please
the name is nolonger tfr..
hold on
k well. i give up. this rollercoaster of emotions hurts.
yep
someone else smarter than me can figure it out. im going back to anime.
Thanks. Im rewatching all of tensei shitara slime datta-kun.
New seasons coming out and I wanna make sure I remember everything. plus it's a good anime.
I have no clue what that is, but imma take your word for it haha. Have fun.
Ahh slime 🤣
@slate swan@naive briar I know why it wasnt working, but idk why this happens
if i put print(message.components) above the if message.channel == ......etc line, it prints all the components, but if i but it below that line, where my print('test') was, it would just print []
its like the components disappeared after if message.channel .....etc line
Hiiii, i got a problem, after renaming 2 times a channel in 1 minute my bot get rate limit for 600 seconds
i really don't understand why
huh?
haha no worries, I'm also a discord bot person so I was assuming this was something that happened like a year ago lol
😭 so sorry
When you do the tree.sync() it automatically syncs the commands to all guilds :b
Yes, I am aware. I previously did only for the guild but I did not know when making new slash commands I had to do it to all guilds?
Ooh
I don't know. It may be a bad practice, but I always clean the guild and then sync every time the bot restarts, like this:
@bot.event
async def on_ready():
logging.info(f'{bot.user} Is ready!')
await bot.tree.sync(guild = None)
for file in Path('cogs').glob('**/*.py'):
*tree, _ = file.parts
await bot.load_extension(f"{'.'.join(tree)}.{file.stem}")
await bot.tree.sync()
i can't tell you if that is good or not, i have literally only just learnt about all this slash command stuff today haha
Haha XD
Aww ValueError: could not find open space for item, trying to make a modal, i guess i have too many fields? Are pages a thing or something?
you can only have at max 5 fields on a modal
there is no built in paging, but you can implement it yourself. make one modal for each page, and go to the next page with buttons after a user submits their current page
whats your use case?
Want to create a form where people can submit TFR requests (Temporary Flight Restriction) basically a virtual FAA lol. Modals would be perfect but since the maximum field is 5 and I need an extra input for a reason... im stumped lol
idk if having pages for this makes sense, maybe you could merge the Date and Time fields
Into a single "Date & Time" field and the date n time can be separated with a new line
True, I just don't know what would be the best way to do this and make it easily accessible
you still could make pages nothing wrong with that
you will have to figure out what u think is best in your opinion
Yes, I was thinking of just sending separate messages which only the user can see but i feel like that would be too complicated since there is literally this Modal lol
Robin said five though? You only have four?
Yes, I forgot to add a recent screenshot
Ah okay
Also another question, Is it possible to make a date selector?
Because i found out Unix Timestamp is a thing but im not sure how i would do it lol
not nicely
not that I know of
you can make a slash command/modal that interpretes something like "april 20th 2024" but there's no native client thing for it
which is a shame cause it'd be really useful
agreed they should just copy paste the date selector for the search thing in discord
😀
Surely I could get the current unix date and do some math to add the correct amount of time?
exactly haha
yes
Wait a minute, it is entirely possible, couldnt I used drop downs or buttons to act as the "calendar"
making UI in discord is just not great
i avoid it as much as i can but for really simple stuff. everything else, i'd just throw together a quick little frontend
frontend?
Apologies, I'm not very good with that type of terminology haha
a website
I'm guessing he means a website?
Ohh, thats pretty cool? How do you get it to connect to your bots?
depends. what do you want it to do when a user submits a TFR request form?
First it would get sent to a sqlite3 database stored on my raspberry pi, then and embed wil be sent in a channel ready to be reviewed by moderators who can use commands to accept/deny blah blah blah and when it gets accepted the status in the database changes to active. And then another embed gets sent into another channel which shows all the active TFRs. And i was really hoping to get that date/time thing done so it can be sorted and possibly when the time runs out the status changes to inactive automatically
the way I'd do this is write a flask app that will directly get the form data from the website and put it into the bot. your bot could poll the database (say every minute) to check for new TFRs, if it finds any, post that embed into a channel with some buttons and what not. once a user verifies/denies it, the bot would send a request back to the web server saying so.
essentially you generally want a web server to be the central system and controls database access, and everything else talks through it (since source of truth)
what you can also do is cut out the bot entirely, you can send messages directly from a flask backend using a webhook
right I see, so how would the bot be able to recieve and send to the website? Well like you said I could also just use webhooks lol
Could you also make the website on github or something? Or is that a lack of security?
HTTP requests, using aiohttp (which already comes installed with discord.py for you)
my personal favourite is httpx
Ahh I see
no sadly, since it's a dynamic site that requires a backend
github pages works nicely for static pages (that is, you just serve a bunch of HTML files and call it a day)
Aww man, so I will have to get a web server then? I could run from my raspberry pi but I will definitely not do that
i mean, you don't have to i was just pointing out how i'd do it
Yeah of course, but i think it would be really cool to have a dashboard like thing haha
sure. it'd be a fun project and there's lots to be learned
yeah, just feel like that hard part would be communicating the bot/webhook and website lol
Oh was going to ask what do you use for a web server?
there are many tools, flask is common
FastAPI is my personal favourite
well, my team & I ran into some really obscure fastAPI issues the other day so not my favourite ATM :P
@slate swan @naive briar turns out bots defer their message if its a slash command, all i had to do was sleep for 3 seconds and it all wouldve worked 😂
are you connected to the internet?
something in terms of internet is refusing you from connecting to discord
oh golly oh gosh
i have this:
await interaction.followup.send("Loading...")
time.sleep(10)
await interaction.response.edit_message(content="Loaded!")```
however that doesn't work, so how do i edit a followup message?
message = await interaction.followup.send("Loading...")
await asyncio.sleep(10)
await message.edit(content="Loaded!")
webhook.send returns a WebhookMessage which you can use to edit, also use asyncio.sleep in an async environment, time.sleep is blocking
nvm thanks for trying to help ❤️
dont need it to be asynchronous because it’s not really in an async environment
it is an async environment, discord.py is purely async
using time.sleep blocks the whole event loop
https://discordpy.readthedocs.io/en/latest/faq.html#what-does-blocking-mean
“.followup.edit_message()”
using time.sleep blocks all of the code btw
so say you have a 10s time.sleep
everything on your bot doesnt work for the next 10s
yo can someone vc with me and helkp me with my bot?? ive tried everything aand it isnt working
or i can send picturesp ls
Just share your code.
ok
If it's too big to be sent here, you can use !paste
if i have 2 on_message events why does one stop working and how do i get around it
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
!paste
Because the 2nd one to load overwrites the first one
how can i get around it
Show your code
Uhh lessee
and ive tried eveyrhting but it says my msg intent is missing
Whats the issue exactly?
oh. you need intents? You probably havent enabled intents in discord developers
D:
No.
# Intents
intents = discord.Intents.all()
#intents.members = True
#intents.messages = True
#intents.guilds = True
``` try this
I will need to let you know, this does enable all intents and is not ideal if you do want to properly manage it
It is recommended you only enable what you need to better manage your security
and how do i do that/
wait @drifting arrow why cant i like use my commands
¯_(ツ)_/¯
whenever i put / it doesnt show my commands
coz those arent slash commands
what command is it then?
Looks like text commands that are suppose to be executed using /
It depends on what library you're using
im using discord.py or somehint
lookup in the docs "app commands"
ok
can someone help how do i get rid of this error message on python ?
*import discord
from discord import Intents , Client
from random import randint , choice
intents = discord.Intents.default()
intents.messages = True
intents.message_content = True
client = discord.Client(intents=intents)
token = "---"
@client.event
async def on_ready() :
print('we logged in as {0.user}'
.format(client) )
@client.event
async def on_message(message) :
if message.author == client.user :
return
if message.author == "servettoprak" :
await message.channel.send("as")
return
@client.event
async def on_message(message) -> None:
if message.author == client.user:
return
username: str = str(message.author)
user_message: str = message.content.lower()
channel: str = str(message.channel)
print(f'[{channel}] kanalında {username} : {user_message}" yazdı')
client.run(token)
if name == 'main':
main()*
my code
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
!intents
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.
There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.
Afterwards in your code, you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.
Oh, I don't know. If only the solution is printed right in front of us 😔😔😔😔😔
i just started...
Sorry, I probably went too far 🥴
did you manage to figure it out?
is it possible to send a message in on_ready() event?
yea
ok
i found this python code on yt for the audio play on channels can someone help me how to fix it i downloanded ffmpeg already.
i can make it join discord voice chats but i cant make it play sound
im getting this error when i run the code and try command
!ytdk
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
do i violate some sort of terms..
cuz im just gonna use the bot on my server
and i cant fix the problem
then how does the other music bots are legal
who said they are
you think why most of music bots got closed
i added the feature that bot can join calls but what can i do with it
im not using discord that often
didnt notice many
🤷♀️
atleast can u help me with this code ?
its await member.kick()
ty
i have a help command here how can i make it to send every command line by line
@slate swan :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | hi
002 | there
@slate swan :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | hey
002 | a
003 | b
004 | c
005 | 123
ty
which i want btw
That includes your bot's heartbeat to Discord
So it'll end up making your bot disconnects
can someone explain to me how can i fix that problem ?
Its discord.User
i need to make it big right..
the u
my brain is not workin today
i learned much things and im tryna store all
made it work ty alot
whatever you put into that argument was not a discord.user
the line you drew isnt where the error message is, it’s below it
on the second image
await.self.dispatch_event?
no
i just said you drew the line incorrectly
thats not where the error is
oh where's the error im just trying to fix it
just told you. its the line below that line
and its saying self.db.deposit is None so it doesn’t have an attribute called .world
thats weird
somewhere in your code, most likely the __init__ section, you’ve set .deposit to be None
hit Ctrl + F then type in “.deposit”
👍
it’ll bring up everywhere in your code where that term is found
im spitting ngl 🗣🗣
this
you probably want discord.Member instead
no. reread my message again
hm
its self.client.deposit
my deposit commands works fine but when i initiate the withdraw command its not working
you want self.db.deposit
why
not self.client.deposit
why tho
oh wait nvm i read the error msg wrong
;-;
i just woke up leave me alone 
the error message said “self.client.deposit” doesnt have an attr named .world
but i do have it
wait it’ll give you lines as well, hold on
line 51 is where the error is
show me like lines 45 to 55
of client events
await self.client.withdraw.report(embed=embed, add_fields=False)
self.client.stop()
@growtopia.Listener
async def on_request_world_select_menu(self, _: growtopia.Context) -> None:
await self.client.join_world(self.client.deposit.world)
self.client.sent_enter_world_packet = True
@growtopia.Listener
async def on_send_map_data(self, ctx: growtopia.Context) -> None:
ok look for self.client.deposit in your code now
alr
somewhere in your code you’ve set it to None and thats whats causing the issue
but where..
thats what im telling you to find out
i dont know where
“.deposit = None” is somewhere in the code
its not there
use ctrl + f like last time
you’ll have to click on each file individually
what type is .deposit?
variable? string? im guessing a class by how you’re using it
put in “print(type(self.client.deposit))” somewhere there
is .deposit.world a real thing?
hmm thats strange
im fr
i FR DONT KNO HOW
Look for where you initialize it
?work
?leaderboard
Sorry wrong server
😉 Hope y'all have a nice day with developing bots
guys can someone explain me how do i kick or ban or do whatever i want to do with user id instead of using their @ ?
What is the best way to organise all my code? I am a very un organised person and its starting to effect my programming, I want to organise it so it is all nice an easily accessible and understandable to read.
If anyone can even give me a few ideas, that would be appreciated very much!
im using discord.py by the way, not like pycord or something
group similar commands like currency commands into one cog and then in one file. im more used to one cog per file so i’ll suggest that. order everything in your file like this:
- imports
- funcs, vars, etc
- views + other classes
- main cog code
- setup func
also, another questions, does ctx not working with app commands?
nope. app commands use interaction
so ctx.send and stuff wouldnt work?
Right, I see. Thank you
and then if you need to, like my bot had stuff for using items, minigames, gambling and currency commands, so i grouped them with a folder called economy
nope. you’ll have to use .response.
and then if you want to do anything after, its .followup.
as long as you typehint to discord.Interaction or Interaction if you’ve imported it from discord, your IDE will handle all the suggestions
its .get_user(user_id) on whatever your bot is assigned as
Depending what you want to do, you'll have to get the member rather than the user
I see, im using Visual Studio Code. But I'm doing an SSH connection to my Raspberry PI, would i just need to intall the correct extension in VSC?
oh right, i forgot about .get_member()
And you probably want to combine get_ and fetch_ to get an accurate result
just typehint in vsc. it’ll give you all the suggestions relating to .response. and .followup.
does get_member() return something if it cant find the person in the server
It checks in cache, so even if the member is in the guild it may return None
ohh
Hence combining as get_member(...) or await fetch_member(...) will use API calls as well, and make sure you get something in return
i forgot you can just use “or” if something returns None
Yeah it's pretty useful, a library also has getch_ iirc
Which does exactly that in the background, which is pretty nice
the problem is that it does not
disnake or nextcord or idk
discord.py does not other might have
Yeah, that's why I said "a library" and not discord.py or "it also has"
is it meant to come up with more things?
disnake does yes
no I wasn't replying to you
mkay
ohhh sorry
all good
it should have “bot = commands.Bot(…)” somewhere so idk why its saying Any
why is djs there 😭
can someone help me to figure out what am i making wrong im beginner just tryna learn how to make bots
well im seeing syntx errors for starters
at least i think they are
have you defined commands?
uhm
im watching a tutorial there is 20 and i just begun 2 days ago so i dont know that many things
@commands.Cog.listener() have you defined commands
did you do
import discord
from discord.ext import commands
Maybe this is the issue? Thing is my other things are imported fine, and my bot is currently only so it is actually imported lmao
missing a commands import
have you pip installed dpy
try it and see
also if you have git installed, use that link
git+https://github.com/Rapptz/discord.py
yay i got the link right
dont think i have git installed, lemme do that
alr nps
wait i think its something to do with the ssh connection
oh? 
whats wrong w it
already did
didnt get it
whats the full file look like?
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
whats youtube_dl?
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
you need to import commands from discord.ext
has the syntax error gone away?

