#discord-bots
1 messages ยท Page 1024 of 1
ikr
this is the baddest spoonfeeding i've ever seen
#help-peanut please
this is the goodest grammar i have ever seen
jkjk dont be angry
huahauaha yeah i'm still sleepin so
logarithm are simple
tbf it's doing better than most people's when they're fully awake; the sentence contains an apostrophe
?
whats tbf
haha true
i nvr use '
unless im on phone cuz it auto corrects it
:D
I had studied Laplace transform
(Don't search this if you care about your mental health)
can u help me with that?
gg
people be coming !ot HEHEHEHE
help? @placid skiff
...
:D
if len(self.children) > 25:
AttributeError: 'DropdownView' object has no attribute 'children'
..
help?
idk
show code
class DropdownView(disnake.ui.View):
def __init__(self,bot:commands.Bot,s : commands.Context,lips):
self.add_item(Dropdown(bot,s,lips))
lips is list
i don't see self.childen here
..
Ignoring exception in view <Ststop timeout=30 children=3> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Stop' emoji=None row=None>:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ui\view.py", line 370, in _scheduled_task
await item.callback(interaction)
File "c:\Users\hp\Desktop\bot\giveaway.py", line 399, in but2
await interaction.response.send_message("Select one giveaway",view=DropdownView(self.bot,self.contex,list4),ephemeral=True)
File "c:\Users\hp\Desktop\bot\giveaway.py", line 416, in __init__
self.add_item(Dropdown(bot,s,lips))
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ui\view.py", line 275, in add_item
if len(self.children) > 25:
AttributeError: 'DropdownView' object has no attribute 'children'
and you didn't super().init()
oh ye
i removed it and forgot to add
it worked thanks
how to edit message at command?
get the message and use discord.Message.edit
You already got answered @slate swan
not work
It does work
How you made it might not be working, and we can't see your screen so we can't see your errors and your code
what would the buttons do?
thats basically what pagination means
changing the embed/content on reaction/interaction
yes, sure
you would like subclassing discord.ui.View
ill get you an example wait, what library are you using?
bump
2.0?
So how does the code is suppose to look?
i mean your discord.py version since buttons are available only in 2.0
check this example, its disnake but same as discord.py
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\ticket.py", line 17, in createticket
channel_id = int(format_args[0].strip('<').strip('>').replace('*', ''))
IndexError: list index out of range``` Someone help me
?
looks like format_args is empty
thats for reference, the implementation of buttons in discord.py and disnake is similar
^
ash, how you doing with hikari? ๐ข
loving it
idk why but I'm finding hikari easier to use than disnake
anime char
cuz you don't need to do different shit for different type of commands
!pip hikari
a non-fork api wrapper
Is it suppose to be a string?
according to the error its a list and ur trying to get the first element of the list
right, but I'm only up for slash commands, and the fact that you can actually enter information in the command deco rather than specifying them every time while using the send method is ideal and not having to use different methods if deferring the response is just better ๐
exactly, the lb command handler does a lot of stuff for you already
and you don't really need to play with useless classes
right, the plugins are, thankfully, a nice implementation
- rest is awesome
agreed
and now my slash commands arent showing up for some reason....welp
i got it working
I have written a comment inside this
Hello
i have an api that returns a color code, how would i use it as an embed color. there's an error because i can't add 0x to it
You can just convert the color code to an integer and use that
But since we don't know how the color code you get looks like, we can't help
ff0000
like a normal one
if its a hex code you can convert it with base 16
Just convert to a hex
int("ff0000", 16)
Yeah ^
bet thanks guys

components = [
Button(style=ButtonStyle.URL,
label="Invite",
url="https://discord.com")]
u = "https://discord.com"
await ctx.send(embed=embed,
components=[
Button(style=ButtonStyle.URL, label="Invite",
url=u),
Button(style=ButtonStyle.URL,
label="Support server",
url="https://discord.com")
])
how do i make them in same row ?
you're using discord components...?
yes
why....
?
yes but tht was not wrking
....
i hv installed dpy 2.0
uhh my bot is not responding and there is no error in console wht can i do ?
Your going to have to debug it
how ?
You just need to follow the code execution
I should be telling you to set break points etc and walk though you code but honestly I would (if you don't have a logging system which I suggest you add) is scatter a bunch of print statements through your code and see what is printing and what you expect to be printed match up and where they differ
or an on_message event
it is enabled
how do i make an error handler for rate limite
its flooding my console a lot
how do i handle this error
kill 1 in shell
does jishaku work in dyp 2.0 ? im getting a error
main.py:195: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(f'cogs.{i}')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
main.py:197: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension('hangman')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
main.py:198: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension('jishaku')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
?
type tht in shell
you cant have an error handler for that thats not a discord.py thing
discord is blocking you already
how do you think you will handle that error
hmm ok
um read the error message maybe? its there for a reason ๐
anyone mind checking #help-mango
how do i fix it ?
@bot.event
async def on_message(message, ctx) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
print(user)
userid = bot.get_user(str(user)) or await bot.fetch_user(str(user))
db[userid + 'cooked_pogchop'] += 50
db[userid + 'voteCount'] += 1
await bot.process_commands(message)
voteCount = db[userid + 'voteCount']
if voteCount < 10:
role = ctx.guild.get_role('<@&971310924478705695>')
await ctx.author.add_roles(role)
elif voteCount < 18:
role = ctx.guild.get_role('<@&971310601668288512>')
await ctx.author.add_roles(role)
elif voteCount < 69:
role = ctx.guild.get_role('<@&971311031555072020>')
await ctx.author.add_roles(role)
elif voteCount < 100:
role = ctx.guild.get_role('<@&971311323658977281>')
await ctx.author.add_roles(role)
elif voteCount < 420:
role = ctx.guild.get_role('<@&971311024051486742>')
await ctx.author.add_roles(role)
else:
role = ctx.guild.get_role('<@&971311028694577162>')
await ctx.author.add_roles(role)
There's no ctx argument in on_message function
remove it
And is that command inside of a class? if so then add self as first pos argument
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
print(f'Loaded {filename}')
This code does load all cogs, but it loads the first and second one twice. Any reason why that might happen?
prints
Loaded chatbot.py
Loaded fun.py
Loaded chatbot.py
Loaded fun.py
Loaded information.py
Loaded moderation.py
Loaded selfroles.py
@bot.event
async def on_message(message) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
print(user)
userid = bot.get_user(str(user)) or await bot.fetch_user(str(user))
db[userid + 'cooked_pogchop'] += 50
db[userid + 'voteCount'] += 1
await bot.process_commands(message)
voteCount = db[userid + 'voteCount']
if voteCount < 10:
role = message.guild.get_role('<@&971310924478705695>')
await message.author.add_roles(role)
elif voteCount < 18:
role = message.guild.get_role('<@&971310601668288512>')
await message.author.add_roles(role)
elif voteCount < 69:
role = message.guild.get_role('<@&971311031555072020>')
await message.author.add_roles(role)
elif voteCount < 100:
role = message.guild.get_role('<@&971311323658977281>')
await message.author.add_roles(role)
elif voteCount < 420:
role = message.guild.get_role('<@&971311024051486742>')
await message.author.add_roles(role)
else:
role = message.guild.get_role('<@&971311028694577162>')
await message.author.add_roles(role)
```bruh why is it not defined
maybe u have 2 of that files?
What in the
That code is stored only in main.py?
What is not defined
Where
Nope
Where is it erroring?
idk it works for me.. so I assumed that you have that cog loading function in one of the cog files
which makes it restart
Easy fix
?
hmm
bruv
I dont see code in any other file doing it
Its pretty much fine its just that i have a quick training model that runs in chatbot.py and in the future I dont want it to run multiple times because it slows down startup alot
I added a file, and now it loads in order 1, 2, 3, 1, 2, 3, 4, 5, 6- im thinking it might have something to do with file 3 or 4
because it keeps restarting at that point
Do you import one cog from another cog
One cog imports from the main bot.py file
from bot import get_servercount
is that why
I just realize how weird your name is
What's weird with feet ๐
Got rid of the training so i can see this clearly
Depends on how you load extensions
I would recommend bringing the functions several cogs use outside to some "utils" module
okay so i deleted the import and it worked normally
How does that work
so does it like repeat the code in main when you import something? weird I wouldn't think that would have happened
yeah i can move the function to another file and import to both main and info
ill try it after class its about to start lol
When you import something it gets executed
Try to make a file with some print statement and import it from another file - the print will execute
So to prevent execution of certain code on import you can do this
if __name__ == "__main__":
# your code```
this why people have that if __name__=="__main__" line?
Yes
yeah you were faster
Code
@bot.command(name="lnk")
async def lnk(ctx, link):
print(ctx.message.content)
# assuming url as an url
response = requests.get(f'{link}')
content = response.content()
open('image.png', 'wb').write(content)
await ctx.send(file=f'image.png')
Error:
Developed by: David Powell
Starting Bot
Connecting to Discord API.
Please Wait
Loading Developer Features cog
[โ][Developer Features Cog] Loading Complete
Connected!
Bot is ready!
Waiting For Commands
$lnk https://cdn.discordapp.com/attachments/798726720181633047/968876223637893210/unknown.png
Ignoring exception in command lnk:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 105, in lnk
TypeError: 'bytes' object is not callable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'bytes' object is not callable
a
Bytes
okay so i put all code under that
file=discord.File(filename)```
K ill try that
What's interpolation
Also why the hell f'{link}' when you can just link
Thanks sm bro
Basically f-string without {}
Glad to help ๐
K
Still getting the bytes error
The fun thing about people who start python from discord bots is they cast strings like this f"{stuff}"
Probably issue with request
Could you paste your full traceback to here
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@lyric sail btw do you use tensorflow or something else for your chatbot AI?
@flint isle you don't need to call response.content
And yeah some improvements for your code
gg error
-
Don't use requests for async apps, aiohttp exists
-
Afaik you can just put bytes to
discord.Fileso you don't have to save it to actual file although I am unsure about this
@bot.event
async def on_ready():
activity = discord.Game(name="RPM", type=3)
await bot.change_presence(status=discord.Status.online, activity=activity)
print('We have logged in as {0.user}'.format(bot))
bot.remove_command('help')
@bot.event
async def on_message(message) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
userid = bot.get_user(str(user)) or await bot.fetch_user(str(user))
print(user)
db[userid + 'cooked_pogchop'] += 50
db[userid + 'voteCount'] += 1
await bot.process_commands(message)
voteCount = db[userid + 'voteCount']
if voteCount < 10:
role = message.guild.get_role('<@&971310924478705695>')
await message.author.add_roles(role)
elif voteCount < 18:
role = message.guild.get_role('<@&971310601668288512>')
await message.author.add_roles(role)
elif voteCount < 69:
role = message.guild.get_role('<@&971311031555072020>')
await message.author.add_roles(role)
elif voteCount < 100:
role = message.guild.get_role('<@&971311323658977281>')
await message.author.add_roles(role)
elif voteCount < 420:
role = message.guild.get_role('<@&971311024051486742>')
await message.author.add_roles(role)
else:
role = message.guild.get_role('<@&971311028694577162>')
await message.author.add_roles(role)
I used this, its really bad right now i might look for something later but its not really on the top of my list so its ok for now
https://www.youtube.com/watch?v=urlkrueSXpI&t=947s
can someone rephrase this for me?
neuralintents
Oh anyway was expecting to see something like this
if voteCount < 10:
role = message.guild.get_role('<@&971310924478705695>')
await message.author.add_roles(role)
elif voteCount < 18:
role = message.guild.get_role('<@&971310601668288512>')
await message.author.add_roles(role)
elif voteCount < 69:
role = message.guild.get_role('<@&971311031555072020>')
await message.author.add_roles(role)
elif voteCount < 100:
role = message.guild.get_role('<@&971311323658977281>')
await message.author.add_roles(role)
elif voteCount < 420:
role = message.guild.get_role('<@&971311024051486742>')
await message.author.add_roles(role)
else:
role = message.guild.get_role('<@&971311028694577162>')
await message.author.add_roles(role)
```is correct already
Neural networks with text processing are hard ๐ฅต
stop changing presence in on_ready
Yeah it sounds like a problem for future me
What the hell
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
Changed in version 2.0: `role_id` parameter is now positional-only.
It should be int bro
Umm this is my code what should I change
@bot.command(name="lnk")
async def lnk(ctx, link):
print(ctx.message.content)
# assuming url as an url
response = requests.get(f'{link}')
content = response.content()
open('image.png', 'wb').write(content)
await ctx.send(file=discord.File(image.png))
what content
Not you
:/
As for you @loud junco what error do you get except all roles are none
Call? Which line is calling it
u mean this one?
you called content even though it isn't a function
Ok so remove the ()?
def method():
...
method() # calling method
method = 69
print(method) # variable (in your case attribute)```
yes
K
Now tell me why are you trying to get roles by their mention
You get them by ID as I said above
And as docs say
guild.get_role(123456789012345678)```
and you did make sure it's 18 digits
Yes ๐ฅถ

Regex made its impact
okok
The next error I'm getting is name image is not defined
@bot.command(name="lnk")
async def lnk(ctx, link):
print(ctx.message.content)
# assuming url as an url
response = requests.get(f'{link}')
content = response.content
open('image.png', 'wb').write(content)
await ctx.send(file=discord.File(image.png))
There they are regexes https://github.com/Exenifix/AIAS/blob/master/ai/analyser.py#L4-L7
ai/analyser.py lines 4 to 7
CHANNEL_REGEX = re.compile(r"<#\d{18}>")
ROLE_REGEX = re.compile(r"<@&\d{18}>")
MENTION_REGEX = re.compile(r"<@!?\d{18}>")
EMOJI_REGEX = re.compile(r"<a?:[A-Za-z0-9_]*:\d{18}>")```
Wtf
You didn't even pay attention to my recommendations
await ctx.send(file=discord.File(content))```
This should work although I am unsure, you should try it anyway
@bot.event
async def on_message(message) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
userid = bot.get_user(str(user)) or await bot.fetch_user(str(user))
print(user)
db[userid + 'cooked_pogchop'] += 50
db[userid + 'voteCount'] += 1
await bot.process_commands(message)
voteCount = db[userid + 'voteCount']
if voteCount < 10:
role = message.guild.get_role(971310924478705695)
```idk how to define userid here
it should be inside the blank
???
man cmon
what are u talking about??
757508305256972338voteCount
its something like this =.=
u cant add int to str
I mean get_user
Don't use JSON, use a proper database
Also yeah ^
:/
but how do i define userid here
below await bot.process_commands(message)
You know object oriented programming concepts right?
Your userid is either None or User (in your case always None because you are trying to get User with str)
Why are you concatenating it
Like it's not a string
so i remove the str()?
userid = str(bot.get_user(user) or await bot.fetch_user(user))
like this?
Tbh I would rewrite that code by myself rn and maybe it would be better for you cause it's too difficult to explain without concrete example
:/
learn a programming language first, then find library you wanna use to make the bot
Well it would involve much complicated stuff like verbal neural networks
what u talking about
@dim tapir this thing
You can't make a bot using raw HTML
YEAH THE GUY THAT MADE THE BOT WITH HTML
Why do you need it done today?
Nice idea
ah yes chat bot 1 million dabloons
Well I am a pure self-learner in python programming
same
same but worse
same
i took js tutorial ๐
you cant employee people @slate swan
What
through this server
El pupper
now he's gonna do it
hi
That's worse
that he heard this
Hello
u said my name
@supple thorn btw aias is open sourced now
Where
Check its bio
you can
Most good bots have a patreon/premium system
well you could if you owned it
Sure
๐
Most bots are open sourced right? I don't know many anyways
Yeah unless that's what he means by "hacking"
Yeah...ours are
Just yoinking the source code from it's github and using it
.....to click on a github link?
You just said you don't have money
Seems like an overall weird conversation, and probably belongs in off-topic
Sounds like you're hiring cops
What about this is about discord bots?
but i got water that makes your brain change
Also, no, our bots do not send data to the FBI, that is a ridiculous statement.
They probably meant the "hackers"?
Thats news to me, I'd love to see the source. And again, this is off-topic for this channel.
Lmao nevermind
https://paste.pythondiscord.com/aluvijajas Can someone help me
codern't donut
I have imported the right module
ffmpeg was not found.
Have you installed it?
I have installed and imported this
Yes
music bots are against ToS
Untrue
Against YouTube's ToS, not Discord
And there is nothing music related
Not 'just' youtube.
and they are grabbing music through URL arg
Windows builds by BtbN``` Which one i download
No
yes I can see he is in the traceback
Any project that knowingly breaks ToS is not going to get help here, as per rule 5
Anyways, you won't get lots of help as we don't help for music bots - didn't read the traceback before
Although it can be used on URLs that do allow music playing
e.g. their own
mmm not like his bot would check if the music played is copyrighted
Technically you could self host and leave your PC on 24/7, but I'm guessing you want a more robust solution
Did the message got removed?
raspberry pi ๐
Oh nevermind, take a look at this
oh
nothing's free
Those who are "free" are largely criticized
That's what I do
Nice nice
that PC's from 1980
Samovar server
Doesn't need to be from 2022 to run a bot
On intel celeron
I have a raspberry pi w that gets the job done, but its not on at the moment since I was just testing a personal bot
Raspberry pi costs too much here so I just made that thing
I also used one until it used way too much network bandwidth
Also, its a x32 chipset, and there are dependencies in @lament depot / @unkempt canyon that require x64 ๐
From old computer parts
buy raspberry pi
only for discord bots
main.py:196: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(f'cogs.{i}')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
how to fix this ?
await
Dpy 2.0 requires asynchronous cogs/extensions management
i dont see any place where i left await
Price increased and they don't have lots of stock nowadays I believe
Yeah
you have to put it there
*await* bot.load_extension(f'cogs.{i}')
You probably want to take a look at the migration guide for more information
ok ty
!d discord.Member.timeout
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the
given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").
You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to
use this...
can someone explain to me how i use the until
File "main.py", line 195
await bot.load_extension(f'cogs.{i}')
^
SyntaxError: 'await' outside function
When the until time comes it takes off the timeout
i know that but how do i set the until
need to put in async function
Now im gonna get one like that to run my bot
https://docs.python.org/3/library/datetime.html#timedelta-objects
create a timedelta variable and pass it into the timeout() as the until param.
delta = datetime.timedelta(hours = 3)
await member.timeout(delta, "spamming messages");
Don't await that
then ?
Just remove the await and it should work
its not working
for i in (
'connect4',
'dev',
'Dev',
'economy',
'help',
'profile',
'utility',
'info',
'image',
'fun',
'SubredditFetcher',
'hangman',
):
bot.load_extension(f'cogs.{i}')
Ok
@stiff gorge
Ignore what I said
make it an async for?
Isn't that error because they are awaiting a coroutine outside an async function?
In the page I've sent you there is a guide which explains how to migrate https://discordpy.readthedocs.io/en/master/migrating.html#command-extension-changes
See at # after using async_with
oh duh. makes sense ๐คฃ been a bit since i've worked with python lmao
so, off the topic of helping that person. Something appears to be missing here? bot isn't defined
# before
bot.load_extension('my_extension')
# after using setup_hook
class MyBot(commands.Bot):
async def setup_hook(self):
await self.load_extension('my_extension')
# after using async_with
async def main():
async with bot:
await bot.load_extension('my_extension')
await bot.start(TOKEN)
asyncio.run(main())
would you just do:
async with MyBot as bot:
Like with aiohttp
oh im reading it like a working file. its just psuedo. brb lemme wake up first before i confuse people
It's a migration guide not supposed to be an entirely working bot code.
It simply showcases the major differences between both versions, as defining a bot variable has never changed since a long time, it's not needed to add it.
So yeah, kind of "pseudo" but it's actual working code when you migrate.
You would need to define __aenter__ and __aexit__ functions of your bot class
To use the async with
You can use it without those methods but there wouldn't be a point then
Please don't copy code
File "main.py", line 201, in <module>
asyncio.run(main())
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "main.py", line 182, in main
async for i in (
TypeError: 'async for' requires an object with __aiter__ method, got tuple
how do i use those ?
The code is not being executed
Idk what to tell ya. You shouldn't use JSON as a database its easily corruptible.
Cogs:
-----------------------------
cogs.ticket was loaded.โ
cogs.music was loaded.โ
cogs.helpcmd was loaded.โ
Unable able to load cogs.helpcmd1โ
Extension 'cogs.helpcmd1' raised an error: AttributeError: module 'discord' has no attribute 'ui'
``` i have installed the module
Do i have to import it?
you appear to be using it in the code, so yes you need to import it...
is it discord.ui?
you need discord.py 2.0
@jade tartan
type pip install git+https://github.com/Rapptz/discord.py in shell
@jade tartan
gotta figure out how to reinstall python on my PC. everytime i install it it never shows in VSC
File "main.py", line 201, in <module>
asyncio.run(main())
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "main.py", line 182, in main
async for i in (
TypeError: 'async for' requires an object with __aiter__ method, got tuple
how to fix this ? the code is not being executed
Show code
Why do i need this?
async def main():
async with bot:
async for i in (
'connect4',
'dev',
'Dev',
'economy',
'help',
'profile',
'utility',
'info',
'image',
'fun',
'SubredditFetcher',
'hangman',
):
await bot.load_extension(f'cogs.{i}')
await bot.load_extension('jishaku')
Token = os.environ['token']
keep_alive.keep_alive()
await bot.start(Token)
asyncio.run(main())
dpy 2.0
I dont know everytime i make the first letter the capital ends up being 2 letters instead of one
discord.ui is in 2.0
like what the hell
U can't use an async for loop on a tuple
How do I handle this error
discord.errors.NotFound: 404 Not Found: Unknown interaction
wht can i do to fix it ?
isinstance(error, commands. Wtf should i put here)?
Use a normal for loop lol
if isinstance(error, commands.MissingRequiredArgument): or if isinstance(error, commands.CommandOnCooldown):
are you sure its for button interaction?
this is for missing argument and command cooldown
no?
not found and bad request is completely different
!d discord.NotFound
exception discord.NotFound(response, message)```
Exception thatโs raised for when status code 404 occurs.
Subclass of [`HTTPException`](https://discordpy.readthedocs.io/en/master/api.html#discord.HTTPException "discord.HTTPException")
!d discord.utils.get
discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets
all the traits passed in `attrs`. This is an alternative for
[`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using
logical AND, not logical OR. Meaning they have to meet every
attribute passed in and not one of them...
nvm i just had to add .mention lol
@slate swan ๐ help, my new slash commands aren't appearing for some reason now
did you change the default_enabled_guilds by any chance?
nope
I might just die-
class Stats():
def __init__(self, ctx):
self.userid = str(ctx.author.id)
self.helmet = db[self.userid +'helmet']
self.chestplate = db[self.userid + 'chestplate' ]
self.leggings = db[self.userid + 'leggings']
self.boots = db[self.userid + 'boots']
self.sword = db[self.userid + 'sword']
self.hp = db[self.userid + 'hp']
self.level = db[self.userid + 'level']
self.highestArea = db[self.userid + 'highestArea']
self.atk = db[self.userid + 'atk']
self.defend = db[self.userid + 'defend']
self.xp = db[self.userid + 'xp']
self.maxxp = self.level * 200
self.area = db[self.userid + 'area']
db is None
thats what the error says ยฏ_(ใ)_/ยฏ
db = None?
what on earth is this error????
!e ```py
a = None
print(a[0])
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: 'NoneType' object is not subscriptable
this is your error.
u know how to fix it?
@bot.event
async def on_message(message) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
hehehe = str(bot.get_user(user) or await bot.fetch_user(user))
db[hehehe + 'cooked_pogchop'] += 50
db[hehehe + 'voteCount'] += 1
voteCount = db[hehehe + 'voteCount']
if voteCount < 10:
role = message.guild.get_role(971310924478705695)
elif voteCount < 18:
role = message.guild.get_role(971310601668288512)
elif voteCount < 69:
role = message.guild.get_role(971311031555072020)
elif voteCount < 100:
role = message.guild.get_role(971311323658977281)
elif voteCount < 420:
role = message.guild.get_role(971311024051486742)
elif voteCount >= 420:
role = message.guild.get_role(971311028694577162)
else:
role = message.guild.get_role(905626727005454457)
await message.author.add_roles(role)
await bot.process_commands(message)
```i added this
and everything is not working now
from replit import db
Extension 'cogs.economy' raised an error: TypeError: Command signature requires at least 1 parameter(s)
wht does this mean ?
need one parameter
the command signature need parameter
u are missing something
it was fine till i installed 2.0
read about what they added?
ohk
you miss self
is this the one?
then why is it None
!Paste paste all related code here
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
ok
you already sent a response to that interaction
u cant do cooldown like this
i show u my example
@bot.command(name='hunt')
@commands.cooldown(1, 30, commands.BucketType.user)
async def hunt(ctx):
```this is how i do it
thats all?
should it be? i havent used it
=.=
it seems to suck
its working fine until i added
@bot.event
async def on_message(message) :
if message.channel.id == 970895283250675813 :
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
hehehe = str(bot.get_user(user) or await bot.fetch_user(user))
db[hehehe + 'cooked_pogchop'] += 50
db[hehehe + 'voteCount'] += 1
voteCount = db[hehehe + 'voteCount']
if voteCount < 10:
role = message.guild.get_role(971310924478705695)
elif voteCount < 18:
role = message.guild.get_role(971310601668288512)
elif voteCount < 69:
role = message.guild.get_role(971311031555072020)
elif voteCount < 100:
role = message.guild.get_role(971311323658977281)
elif voteCount < 420:
role = message.guild.get_role(971311024051486742)
elif voteCount >= 420:
role = message.guild.get_role(971311028694577162)
else:
role = message.guild.get_role(905626727005454457)
await message.author.add_roles(role)
await bot.process_commands(message)
or it's just scoping
something wrong with this?
did you do db=None anywhere in the code
u wan the full code?
easier for u lol
yea
the error's not here
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
have you tried global db in __init__
but its working before i added the vote reward thing
i think its nothing to do with that
the traceback still shows where the error is
right
where do i global it
start of __init__
above self.userid = ...
okok
that should still raise undefined error, not NoneType
but worth a try
not working
@bot.event
async def on_ready():
activity = discord.Game(name="RPM", type=3)
await bot.change_presence(status=discord.Status.online, activity=activity)
print('We have logged in as {0.user}'.format(bot))
```told u not to do this -_-
bot = commands.Bot(command_prefix = prefixxx, case_insensitive=True, activity=discord.Game(name="RPM", type=3))
bot = commands.Bot(...., status=discord.Status.online, activity=activity)``` \:)
!d 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/master/api.html#discord.Client "discord.Client") and as a result
anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with
this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality
to manage commands...
ok
replace
bot = commands.Bot(command_prefix = prefixxx, case_insensitive=True)
with
bot = commands.Bot(command_prefix = prefixxx, case_insensitive=True, activity=discord.Game(name="RPM", type=3))
docs don't show but it's online on default
like this?
!d discord.Client
class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord.
This class is used to interact with the Discord WebSocket and API.
A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
yes and don't change presence on_ready
its inherited from here
okok
the **options
anyways back to the main problem
so it's not scoping
replit's bad
okok
gn
So is async to call a function from chat?
Help on AutoShardedBot in module discord.ext.commands.bot object:
class AutoShardedBot(BotBase, discord.shard.AutoShardedClient)
| AutoShardedBot(*args, **kwds)
|
| This is similar to :class:`.Bot` except that it is inherited from
| :class:`discord.AutoShardedClient` instead.
|
| Method resolution order:
| AutoShardedBot
| BotBase
| discord.ext.commands.core.GroupMixin
| typing.Generic
| discord.shard.AutoShardedClient
| discord.client.Client
| builtins.object
|
--More--
wht is this ?
i got this as the error
Looks more like you did help()
I am getting attribute error: button object has no attribute โuserโ. When I do if interaction.user.id in my button interaction. This worked in 1.7.3 but now it doesnโt
how do i fix it ? i just restarted the bot i got this error
1.7.3 didn't have interaction.
And a button indeed has no user.
Idk where you have put that.
What is owner only prefix?
See. Thats where im confused. I have a bot on 1.7.3, and It works perfectly fine with buttons, people were even confused on how I got it to work but somehow I did with the discord.ui package. But I am making a new bot now, using my old bots code as a starter and when I tried to import discord.ui it said I couldnโt and everyone told me to update to 2.0. So I did and now everything is fucked up
And I swear to god I have a bot using 1.7.3 and it has buttons, I have been working on it for months
Thatโs why Im so pissed I had to update for my new bot
same
its not there anywhere i checked completely
Also, on my old bot it worked perfectly fine
You literally could not have used buttons on discord.py 1.7.3, unless you were using those extra packages on top of discord.py
because your old bot used discord.py 1.7.3
Discord.py 2.0 offers you built-in support for views which do have variations in property names and methods
You prob added an extension
Well, even if I did which I donโt remember, I copied the code exactly to my new bot before updating and didnโt work
It didn't work before or after you updated?
When I made my new bot I copied all the code exactly. And all of the sudden it said I canโt use discord.ui, even though my old bot did just fine. So everyone here told me to update to 2.0 to use buttons but now the user attribute, when I do if interaction.user.id says it doesnโt exist, even though AGAIN my old bot worked perfectly
Can someone just answer my original question on an alternative to interaction.user.id because that dont work anymore
Import discord
how do i fetch list of all invite codes for a guild
if extension in ['cogs', 'extensions', 'all']:
await ctx.send('Reloading all cogs...')
for file in os.listdir('./cogs'):
if file.endswith('.py'):
client.unload_extension(f'cogs.{file[:-3]}')
client.load_extension(f'cogs.{file[:-3]}')
reloads = ', '.join((file))
await ctx.send(f'Reloaded {reloads}')
Why does this send Reloaded s, e, l, f, r, o, l, e, s, ., p, y (the last cog) How can I make it send Reloaded cog1.py, cog2.py, cog3.py
because of the 7th line
how do I make it add the file name and not whatever it did
wait im dumb i can just add it like '...' + file
is their a better and updated library other than discord.py?
How can you add that small number in my bot message?
It's rather dependent on opinion as to whether they're better; Disnake and Nextcord are both contenders in my personal opinion, and Disnake has actual releases which are up to date with the API currently for the most part
Could you give me a link of the documentation?
https://docs.disnake.dev for disnake
i was using discord.py its quite decent untill it doesn't show me the errors that i'm ment to be getting
Hi alec how are you doing :3
Not toooo bad 
Been awhile since i last saw you here.
They are just characters.
Does anyone know how to make a whitelist channel command
E.g /whitelist #bot-commands
using json
A database.
So the access_token expires in 7 days right?
access token of..?
Using json
User
Why would you need an access token of a user.
for my dashboard?
Can you tell me how I can add that?

Ah, uhmm, not too sure but I don't think it has a set limit.
Oh alr 
You could try this https://discord.com/developers/docs/game-sdk/applications#getoauth2token
Doesn't state a limit but it does have an example of how to see it.
Well they are called the power of
Maby there is a superscript in python
ok thx
how can I let my bot auto react faster?
With..?
Oh idk๐๐พโโ๏ธit returns a field which is expires_in : 604800 which is 7days idk if that for the access_token or the refresh_token
emojis
Anyone?
During, when someone clicks on it?
Like enable command and disable it?
idk what u mean by "whitelisting command"
@cloud dawn
No ok letโs say I enabled anti links it will delete links but what if I donโt want it to Moderate a certain channel I do: โ/whitelist [channel_mention]
But I want to do this using a json file
Use View.
How do I do it
Pass the view in the send, with the embed.
if message.channel.id == :
await message.add_reaction(" ")
its like this but its a bit slow
Add the channel id to the json and check if it is in the json, if not don't respond.
ohhhh just put the "channel ids in the json" then check if the current channel id (the whitelisted channels) then make the bot to ingore that for example py white_listed_channels =[7, 8] if message.channel.id in white_listed_channels: return
Yeah how tho?
Oh you mean adding multiple reactions to a message?
Wym๐ค
Like I want a command that does that
class list([iterable])```
Lists may be constructed in several ways:
โข Using a pair of square brackets to denote the empty list: `[]`
โข Using square brackets, separating items with commas: `[a]`, `[a, b, c]`
โข Using a list comprehension: `[x for x in iterable]`
โข Using the type constructor: `list()` or `list(iterable)`...
There is no faster way, a faster way would be to use buttons.
make a command that stores the channel id in the json
๐
Thatโs puts it into a json file
Yes but how do i make it store more than one channel id
By using a list.
Give a link to the event docks
??
Can I know how I can make a list in json?
event
Yes.
How?
!d discord.Client.event
@event```
A decorator that registers an event to listen to.
You can find more info about the events on the [documentation below](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events).
The events must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)"), if not, [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") is raised.
Example...
{
"key": [1, 2, 3]
}
ik this is not coding related ques but I am trying to introduce a premium system but not sure if I should make it patreon based or based on something else in my discord bot
like anyone if having experience on this
then def would like to know
I can only store 1 thing using that
exapmle on_guild_channel_create(
No I want I command to create the list
thank you
Patreon does handle a lot for you but it does deduct a fee.
Hello ๐
right
but I wanna know what do discord bots dev prefer
cuz there def would be a reason behind it
How can I make it create the list
DON'T USE JSON IT'S ADDICTIVE
I agree with that
json is so easy to access
Ye
It really depends an what you are going to do.
hmm .. if I go for monthly subscriptions giving perks then I am guessing patreon is the go to thing..?
I can explain the perks
Yeah but if you already got a dashboard for example it would make more sense to integrate it there.
hmm I dont have a dashboard yet.. I mean its not required for the bot so yea..
my bot is online but its not responding to any cmnd and there is no error in console how can i fix this ??
#bot-commands
Plus patreon has their own api
How to fetch a role?
and get role object
!d discord.Guild.fetch_roles
await fetch_roles()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves all [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the guild has...
thanks
oo thats cool .. do u think the fee is worth it in ur opinion?
huh?
what is so addictive about it ๐ณ
I think Imma just set it up lol
cuz if it has api etc then it should be worth it I guess :)
Well the fee is for 3 euro or less 5% and 0.15 cent
!e print(3*0.95-0.15)
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
2.6999999999999997
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
9.31
For 10 euro you'd keep 9.31 not including local taxes.
ok. just noticed what my problem is. so when I create multiple client.events with auto react, it only catches up the last client.event.
Yes because you name each function the same, use listeners instead to avoid this issue.
btw the lite has only 1 tier right?
I mean I am fine cuz at starting I wanna try with one basic only
idk never setted this up
ah
Yo, does anyone know any api to get welcome cards?
Like images when someone joins.
No everyone makes them themselves since it's specific processes heavy.
@slate swan :white_check_mark: Your eval job has completed with return code 0.
lol
basically im making a marketplace andi wanna make a gig bot so when u do /post (name of the post) (what is it about) (price) and once u click enter it would send that infomation to a channel where people
can see it
how do i maake tht
what do you have so far?
nothing
Do you know how to make a command?
nope
Do you have a bot set up?
i tried hiring people but there all busy
yeah.
can you maybe give an example? Im pretty new to coding and the way I tried it, it doesnt work.
i just dont know where to start
yes python
yh
I'm not sure if they have slash commands yet
They do
!d discord.ext.commands.Bot.listen if you click on the url you will get an example.
@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
Yep, it's a beta feature tough.
can yall help me make this bot
ppl aren't going to write a bot for you unless you pay decently enough. Learning python is your best option otherwise
because i have no clue what im doing ๐
yeah but not everybody has time to learn a whole language
I've not done slash commands before
when i use lightbulb for / commands for my discord bot, how would i make the lightbulb.option in order?
@slate swan hikari help
You learn how to code? :)
Timestamps are broken
You started with hikari?
LOL
no
bruh
im not gonna learn a whole language this why i dont like coming into this server
That timestamp is fine since that is UTC
import datetime
timenow = datetime.datetime.utcnow()
print(timenow)
use now() not utcnow()
Because we don't give away entire project or code something specific for you..? That is true we help people with coding problems.
ah
yeah but who said code a whole thing for me?
Thanks
nobody said that all i said is can somebody help me code it not write the whole thing for me and specially when people tell u to say "learn python" is not useful
What problem are you currently having now?
trying to make a bot
basically im making a marketplace and i wanna make a gig bot so when u do /post (name of the post) (what is it about) (price) and once u click enter it would send that infomation to a channel where people
can see it
that type of that ^^
Okay but you are stating broad issues like "can yall help me make this bot" that's not something we can provide help on.
Okay and what have you made/ researched so far?
the basic
anyone know why my LightBulb/Hikari argument option is not in order?
import os
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
client = discord.Client()
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
client.run(TOKEN)
@slate swan
that what i got so far
I really need to get into hikari.
That's a great start.
so yeah what should i do next? make a /command?
What dpy version do you got installed? To see pip show discord.py
who me?
Yes
you should :D
Hmm he's using client. Is that still supported?
im using replit
Idk what the upsides are tough.
Client is the best option if you are making / commands
well thats a python thing, decorators work from bottom to top, so it would go like
@option4
@option3
@option2
@option1
Ooh us there a repo you reccomend for slash commands?
can you change it to @mossy charmbulb.option1 ?
nono, thats was just for illustration,you need to change the order of the decorators
i did
its still the same for some reason
Is it in the current verision?
oh, just make a change in the option description and it will get updated, maybe just a full stop or something
Thanks, it works now.
thanks. and how do I prevent this when using / commands? only first and second command works
yeah, natively and with command handlers too
Wait how do I print what version my discord.py is to the console
print(discord._version_)
you mean why is it more preferable than other libraries?
Wait do you use this for if you have a text command and a slash command?
ok what do i do now
Yea that is what he means
read the error before posting my g
replit has a configuration file called .replit
i think the default one is hidden
you can press the 3 dots on the file tree to show hidden files
and edit the .replit file to run bot.py
or just rename your source file
this to hard ima just hire somebody to make the bot for me
ยฏ_(ใ)_/ยฏ
what
Umm I'm on 1.7.3 how do I get to the v2.0
Did you edit the config
clone the discord.py master github branch and run the setup file
it fine idc
although i'd urge you to just use something else
disnake has slash commands on stable
UI stuff too
A complete guide on How To Make Handlers for Slash Commands, Events, and Functions, for a Discord Bot in Discord.JS v13. This tutorial goes over how to make handlers, with explanation so new Discord.JS coders are able to learn!
Run this command to install the packages needed:
npm install @discordjs/rest discord-api-types @discordjs/builders
๐...
this guy gonna teach me i have no idea what he syaing but ima just copy his code and wish for the best
then i have to figure out how to make a output oml ๐ญ
Hmm?
cool, just be aware we wont help you with it here
That's discord js
ik
we only deal with python code here, but the folks over at discord.gg/djs can help
as i said, disnake has slash commands and other features rolling on stable
!pypi disnake
@cloud dawn - the first thing that comes in my mind is the codebase, hikari is better typed
- raw hikari is about 3-4 times faster than discord.py ( for the same operations ofcourse )
- better cache and you have full control over it
RESTClient( class dealing with requests made to discord ) is completely exposed and is usable freely without breaking changes in updates. its not documented in discord.py/forks and is updated often with breaking changes- choice between command handlers, you can use raw hikari or choose between command handlers ( lightbulb & tanjaun being the most famous ones )
How to edit an embed?
just edit the message with your new embed
you mean an embed object or a message with an embed?
Yeah my signal is slow so it took 20 seconds to send that. Lmao
what's the function
!d discord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`...
^
suppose i send an embed and if user clicks a button it edits it to another embed
and i suppose you're familiar with ui.View already?
yes
shit can ephemeral messages be edited? i dont remember
um shit?
what r u talking bout
well i guess you're not using ephemeral interactions if you don't know what that is
whatever, just create a new embed object and pass that to message.edit
okay let me try
how can i use multiple / commands in one code so that every / command is available to use?
wdym? just use another decorator
i don't understand your question
will this conflict if i have discord.py installed aswelll or do i need to remove the discord js from my bot EDIT: not js,
py
for a while discord.py got discontinued and archived
so multiple forks of the codebase were created and disnake is one of those
it's a full replacement for discord.py, you'll have to refactor some code
but it's basically the same thing with improvements
@slash.slash(name=...)
async def demandware(ctx:SlashCommand):
embed = discord.Embed()
@slash.slash(name=...)
async def ftl(ctx:SlashCommand):
embed = discord.Embed
so I just copy and paste it among themselves but I cant use the third or fourth ... / command
ok so I just need to rework a little code?
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
everything should work fine
k
you gotta try though
replace all of your imports and calls to "disnake" instead of discord
i.e py from disnake.ext import commands
i will let you know if it has issues lol. May my code be bg free
@slate swan
@client.command()
async def test(ctx):
em = discord.Embed()
em.add_field(name='embed', value='this is an embed')
newem = discord.Embed()
newem.add_field(name='new embed', value='this is an new embed')
but = Button(label='click me', style=discord.ButtonStyle.blurple)
async def but_interaction(interaction):
await discord.Message.edit(newem)
view = View()
view.add_item(but)
but.callback = but_interaction
await ctx.send(embed=em, view=view)
I used this but it isn't working
wait can i just use
discord = disnake
instead of changing them?
disnake has "shims" for "discord"
you know shortcuts on your desktop? it's like that
disnake will understand "discord" imports and forward that to the disnake class
oh so then i dont need to change them
however, i just recommend you to make the change so it's easy to identify
@slate swan
but if you choose to just leave it as "discord"
ok that makes sense
@slash.slash(name=...)
async def demandware(ctx:SlashCommand):
embed = discord.Embed()
@slash.slash(name=...)
async def ftl(ctx:SlashCommand):
embed = discord.Embed
@slash.slash(name=...)
async def csac(ctx:SlashCommand):
embed = discord.Embed
so I just copy and paste it among themselves but I cant use the third or fourth ... / command
make sure you uninstall discord.py, otherwise it will conflict
k
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
you're trying to edit an object, not an instance of an object
please format the code
you need to store the message you sent in a variable
ok ill be back in a whiile if i have issues or questions. thanks
message = await ctx.send('thing')
await message.edit('thing 2')```
firstly make sure all commands have different names/function names
secondly, unless you have the test_guilds kwarg set
slash commands take a while to register in discord
usually 30-60 minutes
@slate swan Thank you! It worked.
you're welcome
What is owner only prefix?
async def demandware(ctx:SlashCommand):
embed = discord.Embed()
@slash.slash(name=...)
async def ftl(ctx:SlashCommand):
embed = discord.Embed(
title='Guide',
color=6411722,
description=''
)
embed.add_field(
name="Snipes/Solebox/Onygo:",
value="",
inline=False)
@slash.slash(name=...)
async def csac(ctx:SlashCommand):
embed = discord.Embed
Hello
you mean decorator? it makes it so only the owner of the bot application can run the command
or, if you have set "owner_ids" on the bot's setup, only the users with id matching those can run the command
Like eval and Jishaku
Jishaku already uses the is_owner decorator
How do i get USER ID using hikari?
if you have your own eval function you need to add it in
@commands.command(name = 'eval')
@commands.is_owner()```
def is_owner(ctx):
return ctx.message.author.id == ctx.guild.owner.id or ctx.message.author.id == "878892818863644693"
``` like this?
is_owner refers to the user that owns the application in the developer panel
if you want to make a special check so that server owners can run specific commands
that's something else
Ohh
few people here use hikari, you'll probably have better luck asking that @ https://discord.com/invite/Jx4cNGG
?
what
Something else?
nothing, just use commands.check() with your own function that returns true or false
or just ping me whenever its hikari^
yeah, may i see your code + your issue
Okay for user ID it was ctx.user.id, how would i get channel id?
ctx.get_channel().id
or ctx.channel_id
Alright thanks.
I have this for an embed with 2 buttons, but until I press the first button, the second one doesn't work, what can I do?
interaction1 = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button1")
await interaction1.send(embed=embed1, ephemeral=True)
interaction2 = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button2")
await interaction2.send(embed=embed2, ephemeral=True)
just because you have two seperate wait_for
and how can I make only 1 with the 2 buttons?
just create 1 wait_for
I know, but how do I put it? because depending on the wait_for it sends one embed or another
for the webhook how i can edit an embed message?
Comprehensive Guide about using Discord Webhooks
when i use guild.fetch.ban it says Guild has no attribute 'fetch'
its fetch_ban
!d discord.Guild.fetch_ban
await fetch_ban(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry") for a user.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission
to get this information.
oooh ty
How do i make buttons gray out after clicked
use that button's callback and disable the button
wdym by animated counting?
like a backwards counting ?
Wdym
!d discord.ui.Button.callback

