#discord-bots
1 messages Β· Page 678 of 1
Nah haha
Do I know you ?
the heck is dat
Ok well i wanna create a warn command
robin
yep, my vps was giving me the,
Task was destroyed but is pending error and just crashes when I use run_until_complete
Don't use json
i have ran into something
Yes?
Β―_(γ)_/Β―
when using .param, and the command has more then one arg it only sends the first one
I'll do some testing as I'm on linux atm
how could i fix?!?!
So?
well, u never help me but from my observation u kinda smort
alright
I mean that sort of makes sense
Never had that issue with run_until_complete() although i will give it a test
Mostly I use it with asyncpg
It is MissingRequiredArgument and not MissingRequiredArguments after all
yeah, it's odd it decided to work on my PC
so I create a pool and connect to my postgres database and never really faced any problems
and I use linux distro(pop!_os) too
So dunno
is there anyway to actually send all of them
what the heck is thiss ;-;
I use arch, maybe your VPS runs ubuntu server or something of the sort?
yeah ubuntu
Can only guess it's with that
I'm looking but nothing so far
Though it does seem like an oversight
Perhaps the error is raised multiple times for each missing parameter?
yep, I found a, what feels like a good, stackoverflow result but I understand none of it
oh right @sick birch how to edit the database value E
Also I would recommend you to use listeners, like Bot.listen() that bot.event, they are generally better and they external, so you can use multiple listeners of the same event type
You need to use the UPDATE statement in SQL
UPDATE table_name SET column_name = new_value WHERE some_condition
if i think that means what it does, it only sent one embed with the first argument not the second one
@bot.listen?
Yeah not sure, I'm not seeing anything in the docs for it
eh what to put in "some_condition"
@bot.listen()
oh ok
I can explain you why it is better
Hold up
okk
if you don't put anything there it'll change everything in that column, so you need to have
... WHERE some_column = some_value
``` to restrict it to only one area
@slate swan I didn't understand your question, are you trying to show all the args a command takes, in let's say, a help command?
I suggest you find a quick sql beginner's article to understand it better

UPDATE table_name WHERE column_name = new_value can be this?
From what I gather, if a command has more than missing required argument, then only the first missing required argument raises the commands.MissingRequiredArgument error
hi
You need the new value
SET column_name = new_value
Ah
UPDATE table_name SET column_name = new_value ...?
Yeah it does
and optional arguments aren't raised
I don't care about optional I just want required π’
You want the argument names of the missing arguments?
yeah
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, MissingRequiredArgument):
await ctx.send(embed=discord.Embed(description=f" Error occurred while performing command **{ctx.command.name}**. Please try again with the required argument(s), **{error.param}**", color=color))```
I have that but it doesn't raise more then one missing argument
So I run a command that has 2 required arguments, it will only show the first one that is missing?
async def func(a, b):
...
if you didn't pass any values to a, the error will raised that you didn't pass any values to a and b
Oh this reminds of something
you can actually do
complete_missing_args = inspect.signature(ctx.command.__callback__)[inspect.signature(ctx.command.__callback__).index(error.param):]
maybe?
is this in a Cog ?
No
and this error handler is bad
You use, commands.Cog.listener() in a cog and pass in another argument self
This will eat up all your errors that you are not handling
Simple Error Handling for ext.commands - discord.py - error_handler.py
how do i make my bot execute on_message commands while ignoring its own messages
should i just use an if statement
or is there a specific thing i can do
Why would use on_message to execute commands?
You can use the commands framework
Yes you can check if the message author is the bot user itself
perhaps commands was the wrong word to use
just on_message to listen to specific words users type
if message.author == bot.user:
return
Ah I see
i see thanks, sorry for the confusion
you can perhaps send all the required arguments but that will include the one they already gave, if any
what is the ban permission name in python?
!d discord.Permissions.ban_members
Returns True if a user can ban users from the guild.
@obsidian ledge
oh
discord.py is cool
I got a ghost ping from here
imagine getting random pings

Totally me
overwrite it and make the same class like 3,530,502 times idk
oh hey a discord bot is typing but they added a u at the end of their name
@client.command()
async def Kosenanat(ctx):
await ctx.send("kir be ghabret bebare ! ")
what is problrm
help_command=YourHelpCommandClass() in your bot constructor
Nothing
kose nanat
wait
class MyNewHelp(commands.MinimalHelpCommand):
"""Bots help command class"""
async def send_pages(self):
destination = self.get_destination()
for page in self.paginator.pages:
emby = disnake.Embed(description=page)
await destination.send(embed=emby)
bot.help_command = MyNewHelp()
``` so.. I can overwrite it by creating any sort of embed I want?
>Kosenanat will work
it's case sensitive, you have to type Kosenanat not kosenanat because case sensitive
hunter i will legitimately kill you for stealing my point
do you kosenanat what is mean in persian ?
how can you possibly fetch the id of a channel but use the name to find the channel
Nope
no
Sorry ;-;
If u already have the channel, then just use channel.id why fetch it again.
crap that makes sense
from persian to english @maiden fable
so.. when I do !help it should send Help, right? but it sends a help embed instead... ```py
class MyNewHelp(commands.MinimalHelpCommand):
"""Bots help command class"""
async def send_pages(self):
desti = await bot.get_channel(self.context)
await desti.send("Help")
Show your bot constructor
why are you sending messages like that....
bot = commands.Bot(
command_prefix=commands.when_mentioned_or('.'),
activity=disnake.Game(name="Command !help"),
case_insensitive=True,
intents=intents,
sync_commands_debug=True)
...#the help command code
bot.help_command = MyNewHelp()
I alrd did
hi

Bruh
<@&831776746206265384>
<@&831776746206265384> maybe
<@&831776746206265384>
dynou wtf
Tf
lol wtf
uhh 3 pings
Sorry mods ;-;
RIP lmao, sorry
my guy let's talk about this
I was first, right..?
nice pings...
no
infernum was
ok let's talk about something else
Discord lagged ffs
sorry!
hehe
guys whenever i do from discord.ext.buttons import blahblahbalbhalbha it always says discord.ext.buttons is undefine
this is correct way to overwrite the help command, isn't it?
!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/master/api.html#discord.ui.View "discord.ui.View"), the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") being pressed and the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/api.html#discord.Interaction "discord.Interaction") you receive.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "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.
!pypi buttons || did you do pip install buttons?
A simple to use, interactive session and paginator with custom buttons for discord.py.
U should do help_command kwarg in the constructor itself
ye 2.0
!mute 806427658862854174 1h Inappropriate messages. Obscenities in other languages doesn't fly here. Please re-read our #rules and #code-of-conduct .
:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1639471595:f> (59 minutes and 59 seconds).
but it should work without as well?
*don't ?
steak bot awesome
if I do bot.help_command
Yea
I did that
doesn't is correct
Seems like u have another help class with the same name
he also said an insult in persian
class MyNewHelp(commands.MinimalHelpCommand):
"""Bots help command class"""
async def send_pages(self):
desti = await bot.get_channel(self.context)
await desti.send("Help")
bot.help_command = MyNewHelp()
``` this is the way I did it, which should be correct
just to inform.
how tf does he get 1h mute and i get a 2d mute for calling some don an idiot
i think its his first warn
they have logs
anyways we are getting off-topic
how can you import discord.ext.buttons without getting an undefined error
this should be overwriting the !help command to send message with content Help, right?
We often give a short initial mute while we investigate and then extend the infraction as appropriate in mod channels.
hey something seems rong here
hm?
yep, I got that
Obscenities in other languages
thanks
np
we take previous infractions into account
that too
oh my god I'm dumb
if you have any moderation related question, DM @novel apex
bot-h of you are cool
dude i don't think that's how you should be finding the destination??
what?
self.get_destination()
oh
i fixed 1 problem but that's not the main problem
uuh
so.. I have 2 bots, with the same code except the second bot is the development bot...
are they somewhat connected
and I might have used the wrong prefix..
bru
they have same pfp and name
I have been stuck with this for 2 days because of that
π
Been more than one month and still no answer ;-;
It took me 2 days to realize that breeeh
My bot has already reached 93 servers... Rip
is that bad?
?
oh wait, now I remember what it is about
yeah cus hunters bot needs message intents lol
dang
Intents != Bot Verification
They both are different things
no, but when you get verified (which will need to happen) you will lose message intents...
Nope
I won't lose it till April
well yes i know that but you get the fucking point
Yea
make it leave a new guilds from now on if it's the case.
No it's fine
okhay
for now...
Imma wait till the bot reaches 100 servers
I hate my self so much now
Me too
async def on_member_join(m):
await m.ban()β
Rate my anti-raid code
good
50/100
9/10
problem is it bans bots too
that's good
i have this piece of code, but its not working at all and it doesn't give an error either..? The first part of it works, but when i type verify me it doesn't do anything, but after the timelimit is gone it shows a timeout error
@client.event
async def on_message(message):
if message.channel.id == 919221774858723398:
if message.content.lower() == 'latte':
await message.delete()
role = message.guild.get_role(920027402749501480)
await message.author.add_roles(role)
role = message.guild.get_role(919970184545058897)
await message.author.remove_roles(role)
await message.author.send(embed=discord.Embed(description="Type `verify me` to complete verification."))
def check(m):
return all([m.author == message.author, m.channel.type == 'private', m.content.lower() == 'verify me'])
try:
msg = await client.wait_for('message', check = check, timeout=40)
except asyncio.TimeoutError:
return await message.author.send(embed=discord.Embed(description = "Sorry, you took too long to respond!"))
if msg.content.lower() == 'verify me':
await msg.author.send(embed=discord.Embed(description = "You're now a verified member."))
else:
await msg.author.send(embed=discord.Embed(description = "...That's not it! Try typing `latte` in the verify channel again."))
await client.process_commands(message)
great... now the pagination works
if msg.content.lower() == 'verify me':
await msg.author.send(embed=discord.Embed(description = "You're now a verified member."))
else:
await msg.author.send(embed=discord.Embed(description = "...That's not it! Try typing `latte` in the verify channel again."))
this is the part that doesnt work
And what is it sending
Bro I meant what is it sending
Yea
Type verify me to complete verification. or this part py await message.author.send(embed=discord.Embed(description="Type `verify me` to complete verification."))
Hmm
how do you get the bot to detect messages without prefix like for example
bot: wuts your fav animal
someone: tiger
``` like without prefixes and stuff
idk looks like you want commands.Bot.wait_for
or maybe a listener for on_message event idk
!d discord.ext.commands.Bot.listen
@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.9)").
Example...
!d discord.ext.commands.Cog.listener
classmethod listener(name=...)```
A decorator that marks a function as a listener.
This is the cog equivalent of [`Bot.listen()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
for some reason it keeps saying it failed, but it still changes the page
in the image section of an embed is there a way i can add a video?
15min long gif
dpy 2.0?
and code?
disnake
line?
i yeeted it from the repo in pinned messages
uh nvm
Also, there are no tracebacks and I'm debugging it first if I find the error
yeahhh, oke
I don't yet think it's worth to see it here because I stole the code
async def play(self, ctx, *, url):
player = await YTDLSource.from_url(url, loop=self.client.loop, stream=True)
ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
play1 = discord.Embed(title=">>> MUSIC :musical_note:", description="βΊ Now playing: {}")
play1.timestamp = datetime.datetime.utcnow()
play1.set_footer(text="β Creator LL#0884 β")
await ctx.reply(embed=play1)
await ctx.reply('Now playing: {}'.format(player.title))
@play.before_invoke
async def ensure_voice(self, ctx):
if ctx.voice_client is None:
if ctx.author.voice:
await ctx.author.voice.channel.connect()
else:
play2 = discord.Embed(title=">>> MUSIC :musical_note:", description="βΊ You are not connected \nto a voice channel.")
play2.timestamp = datetime.datetime.utcnow()
play2.set_footer(text="β Creator LL#0884 β")
await ctx.reply(embed=play2)
raise commands.CommandError("Author not connected to a voice channel.")
elif ctx.voice_client.is_playing():
ctx.voice_client.stop()```
why this dont play music
but bot join
ok
xd
how to configure an error for an unknown command?
why not use a library and save the time
!d discord.ext.commands.CommandNotFound
exception discord.ext.commands.CommandNotFound(message=None, *args)```
Exception raised when a command is attempted to be invoked but no command under that name is found.
This is not raised for invalid subcommands, rather just the initial main command that is attempted to be invoked.
This inherits from [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError").
@<client/bot>.event # if you are not in a cog "@commands.Cog.listener()" if you are in a cog (without strings)
async def on_command_error(ctx, exc): #add a self argument as the first argument if you are in a cog
if isinstance(exc, discord.ext.commands.CommandNotFound):
pass
@valid barn
ty
anyone know a way to like edit an embed description only
!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)
!d discord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., 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)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
is there someone like
await MYembed.description.edit(description="message2")
like this?
no
just the description
embed.description = "my string"
that's what I suggested but well fine
same thing
get the message obj, get the embed, edit it ```py
msg = ...
await msg.embeds[0].edit(**kwargs)
That'll easily error lol
why would it
why not
Doesn't exist
msg = ...
em = msg.embeds[0]
em.description = ...
await msg.edit(embed=em)
you need the edit the message object instead
why not? im asking for a reason
lol
Because embed doesn't have .edit
I said that on purpose but you guys humor ded so uhhh
Because Embed.edit is not a thing
Nor does embed have any async method
o
Forbidden.MissingPermissions why error
bot doesnt have enough permissions
show ur commands object
Show your imports
they just have a command named commands already
^
^ command function
So what is the way to pass options in a slash commands as a dict key and getting the value as dict value?
Disnake help
Hey guys, I tried to make a simple discord bot and I am not sure what the problem is over here. Could someone help me?
`import os
import discord
from discord.ext import commandsmy_secret = os.environ['TOKEN']
bot = commands.Bot(command_prefix="/")
@bot.event
async def on_ready():
print("BOT IS READY")#purge messages
@bot.command()
@commands.has_permissions(manage_messages = True)
async def purge(ctx, amount = 2):
await ctx.channel.purge(limit = amount)@bot.command()
async def on_message(message):
if message.author == bot.user:
returnif message.content.startswith("hey guys"):
await message.channel.send("hello there")if message.content.startswith("bruh"):
await message.channel.send("bruh")
elif message.content.startswith("breh"):
await message.channel.send("breh")
elif message.content.startswith("lol"):
await message.channel.send("lol")bot.run(my_secret)`
nothing seems wrong
I cant seem to run this command
@bot.command()
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith("hey guys"):
await message.channel.send("hello there")
if message.content.startswith("bruh"):
await message.channel.send("bruh")
elif message.content.startswith("breh"):
await message.channel.send("breh")
elif message.content.startswith("lol"):
await message.channel.send("lol")
oh
@crisp haven stop sending your code i already see it
sorry, just showing which part doesnt work
change .command() to .event
once I do that the purge part doesnt work
use .listen() then
ok
why bold just use this
i don't hate on peoples markdown preferences but just saying i recommend using this instead of that
Why does this
f"'''ini\n[{current_prefix}help]'''"```
print this
```txt
'''ini
[!help]''' ```
' = `
Are there any profilers which i can use too monitor the usage of my bot?
thanks π
yw
ok, i struggle sith this one, how to set "name" as the name of the table
change stuffToPlot
you can read the docs and save time ngl
wait, isn't it will create a tabe named "name" instead of name from the def?
c.execute(" CREATE TABLE IF NOT EXISTS ? ( unix REAL , ............ ) " , (name))```
its for an afk command to make sure the command and event dont override each other
@client.event
async def on_message(message):
if message.author.id == client.user.id:
return
if message.content.startswith(your_prefix_here)
alright i'll try that
!d discord.ext.commands.Bot.get_prefix , use this inside message.content.startswith
await get_prefix(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the prefix the bot is listening to with the message as a context.
you aren't in a cog right?
lemme try
i am, but ik you just have to use @commands.Cog.listener()
completely wrong ,
on_messafe is not an event
message.startswith will raise an error
your_prefix_here cannot be used if the bot has custom prefix thingy
alright
typos happen
explen the 2nd one
done
i have a custom get_prefix, since it uses a database to store prefixes for all the servers
uhh, ignore my solution then
great , so you can just call that function
ok i'll use message.content.startswith()
^ yea
is this will also work to edit the row's value?
yea sure
https://github.com/sarthak-py/disnake-template/blob/343956746d6c5d87b33dd8de13d46f9fa943a869/saving_data/sqlite3_usage.py#L77-L85 you can have a quick look to this for sqlite stuff
saving_data/sqlite3_usage.py lines 77 to 85
'''
INSERT INTO query is used to add a row in database , FORMAT :
INSERT INTO <table-name>
( attribut1 , attribute2 .......)
VALUES ( ? , ? ........) ;
? gets relaced by the tuple with values following the query ( the values variable here)
'''```
ok, thanks C:
why does it do this ?
code and error, what's wrong
do f"links that may related to your question {ctx.author}"
ow ok
why need an author variable
Use an f-string instead of adding it to the string.
yes, alr
lol
Rookie mistake. 
i am a rookie cookie coder
help-
oof
Can I see your json file?
encoding="utf-8" in the open function
Fixes most of the issues ngl
I remember this has something to do with not having {} in your JSON file. Didn't use JSON in a while; so I'm not completely sure.
Also tell the error, not only traceback
!empty-json u mean this?
When using JSON, you might run into the following error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This error could have appeared because you just created the JSON file and there is nothing in it at the moment.
Whilst having empty data is no problem, the file itself may never be completely empty.
You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.
Different data types are also supported. If you wish to read more on these, please refer to this article.
oop
Yes.
@maiden fable is the best programmer alive, wdym
i-
lol
how did you read that it's lined
!ot
i have good eyesight ;)
there's literally a tag for mostly everything
also how do i get the person's icon url ctx.author.icon_url doesnt work
ctx.author.avatar_url for dpy above 1.5 and lower than dpy 2.0
ctx.author.avatar.url for dpy 2.0
(sorry for asking useless questions i get confused easily) ty!
that's what this channel is for, but fine
I thought I was who answered it.
Yea, you did it
I just spam tags
You spent time learning Python bot's commands rather than learning Python itself.
Actually I first learnt Python and then knowing about the tags @unkempt canyon has to offer, thanks (:
You know that I'm joking.
How does the dpy library get all users the bot can see?
does it hit the http endpoint or will the users be dispatched through the ws?
hmmm
so basically i have a variable named "name", it's to store the uh like the ppl who be pinged (i wanna make a code to see each other's profile use !p @someone) this is the code
async def profile(ctx, user=None):`
if user == None:
name = ctx.author.name
else:
name = user```
however how to change this "ctx.author" from this code to that "name" variable
`profile.set_thumbnail(url=ctx.author.avatar_url)`
Just clearing things out
Cache.
It gets the users in the Ready event iirc
oop wrong channel
And then adds to the cache whenever a new person joins or a new guild is added in bot.guilds
well, im asking how does it get the data from the api to add it to the cache
I believe it loads the bot's guilds and gets all the members in them.
That would make sense for why large bots take long time to boot up.
guild chunk
thanks
see chunk_guild_at_startup
help ;-;
Typehint user to discord.Member or discord.User.
does anyone by any chance know a Voice Receive function or a way to filter user audio's stream in a voice chat?
as in make the bot listen to only 1 person between multiple people.
hmm, lemme try
ive searched quite a few libraries, and I believe someone recommended me nextcord here. nextcord's voice receive isnt ready yet but I was wondering if someone knows one that is
But then, user will become a discord.Member/discord.User object, and not an str.
thanks ill take a look at it, what file is it in?
isn't from disnake.ext import menus from https://github.com/Rapptz/discord-ext-menus, right?
Nvm not the Ready event. See https://discord.com/developers/docs/topics/gateway#ready-ready-event-fields for the JSON received in the Ready event (I thought this was it cz the revolt API sends the users in the Ready event payload itself)
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
it works C: thanks
How to get all message in selected channel wich will start with "$m" and from choose user
I meant something else
!d discord.TextChannel.history you can pass in a check.
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destinationβs message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.
Examples
Usage...
this should be the correct repo, right?
discord/state.py lines 513 to 515
if self._guild_needs_chunking(guild):
future = await self.chunk_guild(guild, wait=False)
states.append((guild, future))```
no?
thanks
the main part
it's not?
anyone knows a solution to my problem over here?
(please no JS)
disnake is different from danny's repo
oh
yes
...... why
hmm where is the disnake version, do you happen to remember
!pypi disnake
init file?
ty π
and i need to check if message starts witch "$m" yes
make a command?
lol
wtf
xD
its just a font?? π
you need to receive RTP packet from discord voice ws. Then decode it (seems simple but it isn't)
Fun fact: There are no docs till now for voice receive

well how about this, is't possible to have a bot local mute someone?
....?
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the memberβs data.
Depending on the parameter passed, this requires different permissions listed below...
It had a mute kwarg
how do i set cooldown for a command?
yeah cause it should be not accessible. But the packet is still there unpatched
thats server mute i believe.
Yups. discord.js already has it
"voice_channel"
seems like you cannot use that for creating a table
so local mute is possible by a bot?
the what ;-;
why not just use a single table tho?
as in the bot can disable it self hearing from x person, but other people can hear x person?
bhre i wanna make an economy bot
because ive been looking for this for quite a good week now
icy just answered you tho
i need clarification, theres 2 types of mute, server mute which disables the user from speaking, and local mute, which just mutes the person locally, whilst other people could still hear that person
yeah, but idc about voice thing tho. Rd Probably hunai can talk with users and reply with stuff with voice receive?
everyone does , you insert rows in tables for that , not make new table for every user
@visual island π pls
server mute doesn't exists in discord API, it's just a role that got added to the user (which disable every permissions)
https://github.com/Rapptz/discord.py/pull/7160
@visual island u should see this
oh thats a cool fact. wb local mute?
i want to make it so the bot could hear people with @role, so i'd just make it local mute anyone that doesnt have @role
help..
Yups, I am waiting for voice receive. I am gonna make HunAI respond in VCs too
!d discord.ext.commands.cooldown
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
o ok
that's a fake (troll) commit
thank u for this.
but wb the local mute question? ist possible? π
oh shit its fake?
yes
Was merged tho πΆ
you dont need csv in voice receive
Hmmm true tho
closed?
Yea
ok, now i have this code
def add_user(name):
conn = sqlite3.connect('database.db')
c = conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS data (name TEXT, coin INT, level INT, exp INT, max_exp INT, energy INT, rice INT, carrot INT, fish INT, log INT, meal INT)')
c.execute("INSERT INTO data VALUES(null,0,1,0,125,100,0,0,0,0,0)")
conn.commit()
c.close()
conn.close()
the "null" is for "name" how to do it
tweepy is a twitter scraper lol
Lmfaoo
ikr
Ikr. Just saw. They also got pygame, tf
......
π
um , try reading sqlite3 docs
wooooow niceee
thats not at all how u use a sql table
https://github.com/Rapptz/discord.py/pull/1088/
Seems like voice receive was gonna come, if Danny didn't care about etiquette much lmao
Ikr lmao
nah where link
A ok thanks
π
im sorry but pls i still need clarification.
is't possible to have the bot local mute?
i want to make it so that the bot local mutes anyone that doesnt have @role.
discord.py is funny
What u even mean by Local Mute @humble siren
I think that's... Real..
Cz it is (:
hey guys
That, along with 1603
# Moderazione verifica
verifica_channel_id = 817447845149409300
for message in verifica_channel_id:
if message.content == 'blender verify':
pass
else:
await message.send("Error eeeheh")```
i have made this
if a message in a channel is different from "blender verify"
the bot has to send you error
but it doesnt work
like this @maiden fable
i muted that person in my client, but others can still hear him.
U mean volume?
volume, or the Mute button below it.
it is not declared in an on_message event
is't possible for a bot to do it? or can it only do "Server Mute"?
it is
Send code in PM, i'm ita too
The mute button will mute the person for literally everyone dude
awesome
@maiden fable will disnake impl voice receive?
give me a minute to show you what I mean, because there are 2 diff types of mutes and sadly it doesnt seem one of them is implemented in code
Fuck knows what they are doing tbh Not to mention my messages are ignored in the contributor chat most of the times
I thought you were friends with eq
He ain't busy
@commands.cooldown(1, 120, commands.cooldowns.BucketType.user)```
I would like to know him more though, such as what doctor and stuff
Well, sadru and shiftinv are the two main contributors for disnake
U have a command named commands
π
you typed so fast lol
They got the contributor role in the repo, sooooo
i-
discord.py issues are so funny dude
Hehe
Same, but seems like he likes to keep his life private
first of all we got this voice funny troll pull request blajhblabhalbahblah on github and they imported every type of asyncio
yeah, even idk his age
Yea, ikr
no one knows really
I mean, I am sure they got a valid reason bro
its commands.cooldowns
Mhm
He got a command named commands lol
oh
!d discord.ext.commands.cooldown u sure?
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
And that's the error haha
oh f dumb me
they had cooldowns
It's fine
Ignore what I said really
Still, see the error. It should show module discord.ext.commands has no attribute cooldowns, not Command has no attribute cooldowns
nah
???
cooldowns.py exists
sorry i didnt saw the error , was focused on this part
ow
Aaaah I just saw that part, that's why I deleted my message tbh haha
Damn HunAI got famous all of a sudden. 5 servers in a single day πΆ
gg
will suggest to keep a check on what server it gets added , last time my bot was added to servers with more than 300 bot members in 3-4 servers and it got flagged as inorganic growth
with an average member count of?
Lmao yes. That's what I am doing with servers bigger than 50-60 members
Of the servers? About 30-40 ig?
I won't complain, since hardly anyone trusts unverified bots π€·ββοΈ
verified bots arent safe enough though
But trusted more than unverified ones tho
ive seen servers with 2-3k members using botghost.net bots so yea
yea fact
Hunter, how many people are in avg on the servers your bot is in?
had to find someone to help me.
@maiden fable
https://cdn.discordapp.com/attachments/705539653641437265/920284655884840970/unknown.png
https://cdn.discordapp.com/attachments/705539653641437265/920284702319972422/unknown.png
local mute and server mute
I met this person who said I won't add HunAI to my server cz he thinks it's gonna nuke the server just cz it was unverified, even when it didn't need any admin perms, just send message and embed perms π€£
lol
if you local mute someone, other people will still hear him.
if you server mute somoene, no one will hear him.
ist possible for the bot to local mute?
They vary too much. In some of them, only 10, in some a 100
return statistics.mean([len(g.members) for g in bot.guilds]) @maiden fable
are there any 1k + member servers?
dpy os maybe
3 of them
cool
discord.py
My friend's
My friend's
what about disnake server?
1000
I don't count it, but it has 800 members
oh I see
discord.py and disnake server are just dummy sorta servers
None uses HunAI in there
facts
Good morning
thats a good way to advertise your bot ngl
gm
I suspect if anyone even knows about my bot in there except a few people, like u, who got other mutual servers
lads, do you know a solution?
my eyes are bleeding and ive been looking for over a week π
Bro
.
Have u tried member.edit?
say what now
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the memberβs data.
Depending on the parameter passed, this requires different permissions listed below...
Have u tried it?
let me double check because im pretty sure it server mutes.
||@cobalt shoal||
Yea it server mutes
And if u wanna mute the user only in your client with yr bot, u can't
yeah ive checked it before.
it only server mutes
Czzzz, the bot can't "hear" the person
π
Is there any reason why you must local mute them?
Imagine bot recording voice chat, no thx
voice receive function isnt really implemented well.
we need to listen to specific person, he insists on muteing all who is not user.
Depending on the implementation you may filter packets to only a specific user
jus listen to their stream π
but it isnt implemented yet ποΈπποΈ
we goto javascript then
no.

Why would you listen to users in VC?
Voice activated commands
lmao thats cool
but we intend it to use for something very helpful
Β―_(γ)_/Β―
who is your mole
Do keep in mind you'd need to ask for consent to record for all users you are listening onto
meh, put it in rules
its nowhere near malicious or "recording" like everyone keeps saying.
it wont even record π
use the bot often. People would probably see the bot (like BotBot if you know it)
Gotta spam hunAI in there
That's because discord strictly documents the bot aspect, they say voice recv isn't designed for bots etc
we use it to train AI to replace human relationships make funny voices with
You gotta wait for people who are good to figure it out
Currently my collaborator on my dapi wrapper is working on voice recv as well
i.content.startswith(r"($m|$ban|b|$mute|$tb|$tempban|w|warn)"):``` why this is not working
sup
What did you send to chat?
is this ok....?
Normal, you can't view raw sql probably
oh k
Use a program like db browser for sqlite to view your sqlite database
how does raw SQL looks like
i use replit, how to do it
eh I explained it a bit wrong
ah, then you need to view the db using the python sqlite module
π what?
there is a module to view .db files?
i think so
you need to a program to view it
Interesting I always used my editor ext
when u online
!d sqlite3
Source code: Lib/sqlite3/
SQLite is a C library that provides a lightweight disk-based database that doesnβt require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. Itβs also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.
The sqlite3 module was written by Gerhard HΓ€ring. It provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249, and requires SQLite 3.7.15 or newer.
C?
do you know SQL?
its like 9000 messages there
nice
what did you try to see it did not work*
there is a lot of the $m .... commands
Your checking if the message content starts with a regex pattern itself,
oh
Your not actually using the regex module to compare a string to the pattern
!d re.findall
re.findall(pattern, string, flags=0)```
Return all non-overlapping matches of *pattern* in *string*, as a list of strings or tuples. The *string* is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result.
The result depends on the number of capturing groups in the pattern. If there are no groups, return a list of strings matching the whole pattern. If there is exactly one group, return a list of strings matching that group. If multiple groups are present, return a list of tuples of strings matching the groups. Non-capturing groups do not affect the form of the result.
A
https://inloop.github.io/sqlite-viewer/ just use this to view your database file
sqlite file viewer
... bruh
can you send the db file here?
Hey @small igloo!
It looks like you tried to attach file type(s) that we do not allow (.db). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
breh
ow , you can dm it
how can i fix this
this is my erro message: in on_member_join await member.add_roles(role)
the code py @client.event async def on_member_join(member): role = discord.utils.get(member.guild.roles, id="the id") await member.add_roles(role)
ok ty
Hmmm, thanks for the suggestion
Hahaha thanks. There's a huncb command BTW
What's that?
Try it out yourself :D
If I remember
wait how do I get my bot added to the dpy server
there's a command in R.Danny which allows you to submit your bot
ah
It makes a new AI Chat Session without setting a channel
how do i make something like this?
https://media.discordapp.net/attachments/829947392651427860/920298026331951174/unknown.png
Yeah, I was just talking abt the response kekw
i have 2 questions, but here's my code first
@client.command(name='bal', aliases = ('inv','balance'))
async def balance(ctx, user : discord.Member):
if user == None:
user = ctx.author
await register(user)
with open("bank.json", "r") as f:
users=json.load(f)
embed = discord.Embed(color = 0xF5F5DC)
embed.set_author(name= user.name, icon_url= ctx.author.avatar_url)
bal = users[str(user.id)]["balance"]
embed.add_field(name=f"Balance", value = f"{bal} :cherries_:")
embed.add_field(name="Inventory", value = "> you have no items, purchase them at `m.shop`!")
await ctx.channel.send(embed=embed)
- if i type
.balwithout any user, it shows a missing argument error, how can i make it that it doesn't do that? - in the embed part,
py embed.add_field(name=f"Balance", value = f"{bal} :cherries_:") embed.add_field(name="Inventory", value = "> you have no items, purchase them at `m.shop`!")
the 2 fields are on the same horizontal line, i want them to be one after the other, how do i do that?
- Add a new kwarg,
inline=False
ty
typehint user to None
Donβt type hint it to None. Make itβs value None
for the user, just pass = None when you declare the command (async def command(ctx, param1, param2=None) doing this the param2 will be equals to None as default)
For the embed, just add inline=False at the end of the field
k
@valid barn member: discord.Member = None
Is there a event for when a channel is moved? I am trying to make something which allows a sort of lock for moderators so if a channel is accidentally moved, the bot fixes it
thats how it should be
ok i have another set of questions, here's the code:
@client.command(name="give", aliases = ('send','dash'))
@commands.cooldown(1, 30, commands.cooldowns.BucketType.user)
async def give(ctx, user : discord.Member, amount = 0):
await register(ctx.author)
users = await get_bank_data()
bal = [users[str(ctx.author.id)]["balance"]]
if amount > bal[0]:
await ctx.send(embed=discord.Embed(":( poor child. You don't have enough money to give out", color = 0xf5f5dc))
elif amount <= 0:
await ctx.send(embed=discord.Embed("Don't be selfish! No negative numbers >:(", color = 0xf5f5dc))
else:
await update_bank(user, amount, "balance")
await update_bank(ctx.author, -1*amount, "balance")
await ctx.send(embed=discord.Embed(f"Done! {ctx.author.mention} just gave {user.mention} {amount} :cherries_:", color = 0xf5f5dc))
this part doesnt work but it doesn't give any errors, from here:
if amount > bal[0]:
await ctx.send(embed=discord.Embed(":( poor child. You don't have enough money to give out", color = 0xf5f5dc))
elif amount <= 0:
await ctx.send(embed=discord.Embed("Don't be selfish! No negative numbers >:(", color = 0xf5f5dc))
else:
await update_bank(user, amount, "balance")
await update_bank(ctx.author, -1*amount, "balance")
await ctx.send(embed=discord.Embed(f"Done! {ctx.author.mention} just gave {user.mention} {amount} :cherries_:", color = 0xf5f5dc))
in my code, update_bank is defined as:
async def update_bank(user, change = 0, mode = "balance"):
users = await get_bank_data()
users[str(user.id)][mode]+= change
await edit()
bal = users[str(user.id)]["balance"]
return bal
edit is:
async def edit():
users = await get_bank_data()
with open("bank.json","w") as f:
json.dump(users,f)
your indents arent right
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
on_guild_channel_update compare categories https://discordpy.readthedocs.io/en/stable/api.html#discord.on_guild_channel_update
def setup(self):
for cog in COGS:
try:
print(f" loadin {cog}")
self.load_extension(f"lib.cogs.{cog}")
except NoEntryPointError:
print(f" failed to load {cog}\nNo setup found")
except ExtensionFailed:
print(f" failed to load {cog}\nThe extension or its setup had an execution error")
else:
print(f" {cog} loaded")
So guys I have this function here where i load the cog from the cog list the only problem is, when one of those exception raise, it don't show me the traceback of the exception in the console. I tried different ways to print it but without success, how can i do it?
sry, when i pasted it it messed up the indents
its alr
except NoEntryPointError as a:
print(a)
you do it for each exception
Already tried, it print the exception object but not the error
Honestly just catch ExtensionError itβs raised when any exception related to extensions or cogs are raised.
except ExtensionError as e:
print(e)
if i.content.startswith(""):``` how to use regex here
anyone?
search the string for regex
should be something like ```py
regex = ...
data = re.findall(regex, message.content)
re.compile(r"^thestring") should be enough
how can you fetch/get the amount of members there is in a server
i mean how can you fetch or get the amt of members in the server the bot is in
this is my proplem: line 45, in on_member_join channel = client.get_channel() TypeError: Client.get_channel() missing 1 required positional argument: 'id' what id do i need to get ?
my code: ```py
@client.event
async def on_member_join(member):
channel = client.get_channel()
role = discord.utils.get(member.guild.roles, int(id=i have id haer))
await member.add_roles(role)
u need to put in the channel id you want to get so it'd be
channel = client.get_channel(your id here)
yw :)
int(id=i have id haer) is wrong , you can just use py id = 1123445555666 ( random numbers but replace it with the id)
and yea , what latte told , the parameter must be an int tho
oh ok ty
why when i try add Intents it gives an error?
Traceback (most recent call last):
File "c:\Users\`srtpc\OneDrive\Desktop\jamaicaisthebestlol\zoro.py", line 5, in <module>
intents = discord.Intents.default()
AttributeError: module 'discord' has no attribute 'Intents'
seems like you have some other file name discord.py
the code works fine now but i get a role i dont put in the role id, do how i can fix that
huh
are you sure it's the correct role id you entered?
im mad confused
can someone help me how to fix this?
Provide more information please.
Show code
Example:
Show code line 1 to 5
How discord is defined an if it is installed
β₯οΈ Pandabweer
π₯ 
ok so, I need my bot to send a random joke from the dadjokes library every minute but whatever I try, it either doesn't send a joke, or sends the same joke every time.
@client.event
async def on_message(message):
if message.content.startswith('Dadjoke!'):
await message.channel.send(dadjoke)

pandabweer
random.choice()
is there a good way to implement a check for any command being run?
import discord
import os
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
intents.guilds = True
#prefix center
client = commands.Bot(command_prefix=commands.when_mentioned_or('z'), case_insensitive=True, help_command=None,owner_id= {737448363418452019}, intents= intents)
client.remove_command('help')
you were the one who cursed me with asyncio
thats the code
like the check in bot.wait_for
No documentation found for the requested symbol.
nono, it's like this
dadjoke = Dadjoke()
so i dont think i can do random.choice
@cloud dawn
try removing the discord so its just intents = Intents.default() (that works for me)
Please show how dadjoke is defined
import dadjokes
from dadjokes import Dadjoke
dadjoke = Dadjokes()
i did check now end i put in the new id and now i get now rank when i join
can we change the outcome of the command through that?
@cloud dawn this
On what basis? What would you like to change?
it's intents not Intents
like check if the user id for the person running the command is say in a specific database and on that basis return a different output
from discord import Intents
pandabweer help
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.
To construct an object you can pass keyword arguments denoting the flags to enable or disable.
This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
New in version 1.5...
Thanks
Inherit is discord.ext.commands.Bot.intents
@cloud dawn this is how dadjoke is defined
Lemme look at the api docs 1 sec
Traceback (most recent call last):
File "c:\Users\srtpc\OneDrive\Desktop\jamaicaisthebestlol\zoro.py", line 5, in <module>
from discord import intents
ImportError: cannot import name 'intents' from 'discord' (unknown location)```
capital i
caps perhaps
Again inherit is discord.ext.commands.Bot.intents
@cloud dawn ?
BRO it still shows error ong
could you show me an example of how i could set this up? like say if user id belongs in a pre defined tuple
What is stopping you from doing this inside the command? Or is it for multiple commands?
Traceback (most recent call last):
File "c:\Users\srtpc\OneDrive\Desktop\jamaicaisthebestlol\zoro.py", line 5, in <module>
from discord import Intents
ImportError: cannot import name 'Intents' from 'discord' (unknown location)```
Could you please dir discord?
where that goes
Kwarg but let's define intents first.
@timber crescentCould you answer this?
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith('Click'))
await interaction.respond(content="Button Clicked!")
Looked at the docs you are doing it fine hmm, no errors?
Just same joke over and over?
ironically error comes when I use random.choice
yep
ill try it ty havent got the hang of it yet i think
wdym rank?
Yeah since it prob only returns a string so you can't random.choice it
someone plss
so what can i do
Traceback (most recent call last):
File "c:\Users\srtpc\OneDrive\Desktop\jamaicaisthebestlol\zoro.py", line 5, in <module>
from discord import Intents
ImportError: cannot import name 'Intents' from 'discord' (unknown location)```
it still showing this
You could also make a check -> https://discordpy.readthedocs.io/en/master/ext/commands/api.html?highlight=check#discord.ext.commands.check
Please dir discord..
print(dir(discord))
from discord_components import DiscordComponents
#Under yout bot contructor
DiscordComponents(bot)
huh
I honestly donβt know why people still use DiscordComponents
planning to implement it for almost all of em so ya multiple commands
It was cool around 1.7 dpy but itβs just useless now.
Disnake is invented for a reason hehe
how to solve opus not loaded py Task exception was never retrieved future: <Task finished name='Task-55' coro=<MusicPlayer.player_loop() done, defined at Music.py:158> exception=OpusNotLoaded()> Traceback (most recent call last): File "Music.py", line 185, in player_loop self._guild.voice_client.play(source, after=lambda _: self.bot.loop.call_soon_threadsafe(self.next.set)) File "discord\voice_client.py", line 609, in play self.encoder = opus.Encoder() File "discord\opus.py", line 360, in __init__ _OpusStruct.get_opus_version() File "discord\opus.py", line 353, in get_opus_version raise OpusNotLoaded() discord.opus.OpusNotLoaded traceback
What would you need opus for? It's pretty dated.
music
I cant tell then to switch over to dpy 2.0 like that ,-,
We're not allowed to help with that here.
where i put that...
well i am playing local files
no ytdl
After you imported Discord.
{"name":"blue","price":500,"description":"color role blue"},{"name":"red","price":500,"description":"color role red"},{"name":"yellow","price":500,"description":"color role yellow"},
]```
```py
@client.command(name='shop')
async def shop(ctx):
embed = discord.Embed(description = "Here are the items available in the shop.", color = 0xF5F5DC)
for item in shop:
name= item["name"]
price= item["price"]
desc= item["description"]
embed.add_field(name = f"{name} γ» {price} :cherries_:", value=f"{desc}", inline = False)
embed.add_field(value = "Not sure how to earn :cherries_:? run `m.help`", inline = False)
await ctx.send(embed=embed)```
@cloud dawn sooo, is there a way I can fix my bot?
same
i imported discord already
This is still inappropriate since we don't know the means, sorry. If you think i'm mistaken please advise @novel apex
Your function name is shop and variable name is shop, change the variable name
ok np
I know but put that code after it.
so say pip install discord?
Your code please
Thanks for understanding, if a moderator approves we will of course help you.
where's the items π
What
from discord_components import DiscordComponents, Button, ButtonStyle, component
bot = commands.Bot(command_prefix="!")
DiscordComponents(bot)
@bot.command()
async def button(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith('Click'))
await interaction.respond(content="Button Clicked!")
I recommend following this tutorial first, https://vcokltfre.dev/
π
Try, interaction.send
The member
Are you still having trouble?
I see, try printing something after every line, and see where the text stops printing
you never gave me a solution
It worked perfectly fine for me
i didnt send the rest of the code
I men i dint Get the member role when i chance the id
@client.event
async def on_message(message):
if message.content.startswith('Dadjoke!'):
await message.channel.send(dadjoke)
@sinful pasture wait, you imported Dadjoke, and use the class Dadjokes
I know, i know because i simply don't know. The pypi you are using is pretty messy.
nah that was just a typo when I was sending it in discord
Hmm, what error tho?
i tried using dadjokes.io but i am smol brain and failed
sends the same dad joke every time
Hmm why not make it yourself? I mean the site is pretty straight forward -> https://icanhazdadjoke.com
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith('Click'))
print('part two')
await interaction.send(content="Button Clicked!")
print("part three")
Because, when you run the code it simply loads one dajoke onto the variable, and the variable never resets again to fetch another dadjoke
Hmm it does cache the joke -> https://github.com/CrossNox/dadjokes/blob/master/dadjokes/dadjokes.py#L25
Maby that causes it
dadjokes/dadjokes.py line 25
r = cached_request(self.url).json()```
did it show any error?
i know that but how to fix
Pypi also isn't async...
No
Then dont use check, use if and elifs
Call the dadjoke = Dadjokes(), inside the if message.content.startswith
Eevee is right you defined the var once say it just fetched it once and stored the result in the RAM.
No one writes my name without a typo
wdym
Yes sir sorry sir 
:0 galaxy brain ima try that
if interaction.user.id == ctx.author.id:
await interaction.send
everyone is not necessarily a "sir" Alright
well try using this instead (it usually works for me), as in:
role = member.guild.get_role(your_id)
await member.add_roles(role)
(the id should be an integer)
Oh ok i will try that
announcement: i finnaly quit replit π it sucks
π₯³
I'll cheer to that any day π»
Umm.......congrats
how can i add Intents to my bot cause i had one and its confusing
It would seem that there is hope for this world.
i use to use it on replit and it works now im on vsc and it does not work
I've been asking you for 10 min to dir discord.
I even gave you an example.
i do not know what is that
Plesure to see you as always
hi, how could i know that if a member has a role by id in a different server?
(the bot in the server which has role uwu)
hey guys does anyone know how i can make a channel counter for my discord bot?
what is "dir discord"
like this
@bot.command()
async def buttton(ctx):
await ctx.send(
'This is a button',
components = [
Button(label= 'Click Me!')
]
)
print('part one')
interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith('Click'))
if interaction.user.id == ctx.author.id:
await interaction.send(content="Button Clicked")
?
Feeling is mutual 
Love the locals π»
i did not go sm stuffs when i use it on replit
Ofc ofc
print(dir(discord))
should i put it in the code?
Yes after the discord import.
Well now it doesn't feel genuine 
hi help me plz
Idk the it's the cat i swear
You could do something like
if id in [r.id for r in Member.roles] or grab object and do that instead
Hes nice
But in a diff server though 
Grab the server then ig
i get a block on the role when i use it
And grab his member object in server
tysm @cloud dawn, @upbeat otter and @sage otter sorry late, lag
Bro the syntax in list comprehensions makes me wanna learn js
wdym?
Woah calm down that is a pretty vulgar language
should it be like this?
import discord
print(dir(discord))
import os
from discord.ext import commands```
Yes please send me that dir :)
ban
The Erro role = member.guild.get_role(317730229760163855) ^ IndentationError: expected an indented block after function definition on line 44
Im sorry i just hate itπ€¬
Then uncomprhension it.
πΆ
never mind
..
does it work now?
i am trying now


