#discord-bots
1 messages ยท Page 657 of 1
how else do i reply bruv
trolleybus means troll
I looked on the stats on discord, and disnake has the most changes made since it's been forked, dwarfing the other libraries by thousands of changes.
pycord has done some sketchy stuff, and nextcord forcibly installs the discord namespace in addition to nextcord.
hm
tldr nextcord and pycord's success is mostly due to YouTube
apparently discord-interactions uses discord_slash and ik how to use discord_slash so this should be ez
hm a point
Yeah disnake is very underrated
Disnake best
discord-interactions is confusing with the library of the same name, discord-interactions
And most pycord/nextcord vids are outdated
!pypi discord-interactions <- this is my discord Inc themselves
discord-py-interactions is actually the lib you would use-- but they intentionally moved the repo and naming, and became more confusing, idek why
๐คทโโ๏ธ
disnake has the best api and implementation so far
That is correct
and I'd argue that this is partly why disnake is so good
yes very true
who can help wwith an aiosqlite question here?
Disnakes only competitor is djs
tldr: issue tracker spam and help questions.
pycord and nextcord both have a lot of these, but I haven't seen any of disnake ๐
also their support server doesn't provide that much support
it moves slower than my grandma in a 10 mile race
Which disnakes?
@bot.command(aliases=["regs"])
async def registrations(ctx):
cur = await bot.db.cursor()
await bot.db.execute("SELECT * FROM users")
membs = await cur.fetchall()
for memb in membs:
await ctx.send(memb[0] + "" + memb[1] + "" + memb[2])``` no output displayed//
Server isnt quite big but the people there are very knowledgeable
I should add a disclaimer now: I'm a contributor to disnake after finding how good it was
Not their fault as it all is based on popularity
idk but soon
no, I mean that users are mostly pretty good about reading docs ๐
||unlike here|| ๐คทโโ๏ธ 
hm..?
anyone?
tbf I was like that
Lol
ironically, I feel like disnake is easier to use, but if I get a chance I'll be seeing if I can make a few features with pycord
even though I strongly dislike pycord for reasons
alr this discussion is over
ok we got ur opinion
u said one thing 5 times
which lib
does fetch_message return Member class?
..
It fetches a msg
Buttons are mostly easy
make a check that will return false in the provided guild
how can I get member class?
Sounds like a xy question
xy?
!docs discord.Guild.fetch_member
await fetch_member(member_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.
Note
This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.
error in line 41
Doesnt that get a member object
what's the error?
permission error
Hes probably saying class but refering to a object idk
yeah, I think most of the libs still maintain discord.ui.View and stuff
Just use disnake as it has slash commands built in
don't have permission to be in voice then, probably
+this need member ID
i would like to get it from message ID
is that possible?
Ah i see
!d discord.Message.author
Get the author id by the msg?
i have a message ID. Using fetch_message returns the message. Is this a string?
the bot has admin
I remember when there were third party supplements, they tended to fail and error with discord.ui.*
send ur code
it joined vc too
No it will return a msg object irrc
ohhh thats what i wanted ty ily
error in line 41
you're gonna have to provide more than that.
okay
path is wrong is my guess
please teach me how to code a bot please i beg you
and.. no tutorials on yt and the https://tutorial.vcokltfre.dev plz
Huh? what did u say? did i read it right?
why not follow that guide, lol?
or i am the mad one
no tutorials on yt and the https://tutorial.vcokltfre.dev/ plz to code a bot?
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
dude whaat? u srs rn?
https://pastebin.com/A0xP4cGg @prisma spoke @vast gale
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yep is not online
nope, it's permission error
No begging here just helping
pls help me the bot is not online
I dont spoonfeed if you didnt do something right you didnt pay attention in the tutorial given
he said "no tutorials on yt" i am in shock rn
same ๐คฃ
Most of them arent up to date but the one given isnt from yt
he means that all the videos i watched on yt were my assumptions
bro....... wth the code is entered correctly but the run bot code is not working
cuz ur using repl.it mate
@prisma spoke could u help pls?
my bot also wudnt come onine there
Replit doesnt matter
Send the code without your token
i wud have removed the try and except and see the error
it doesnt bring the bot online ffs happened to me
bot.run("your_token_here")
?
then what is best editor>?
Did you actually add the token?
ye
Visual studio code
Vsc or pycharm
link?
Yes pycharm
Pychrm makes ur Pc go brrrrrrrrr
Not pycharms problem
No
please stop giving bad solutions
How am i given bad advice?
should we download it?
Pycharm is not recommended
Your making stupid assumptions saying replit is bad without a balid reason
Get Visual Studio Code.
go to the website u will see
a download button
He said best editor nothing else
ping any dev and ask him..(not a stupid one)
It's not online however it is one of the most useful and best code editors out there currently.
Pycharm isnt recommented
Yes its bad but his bot is so tiny it really isnt a problem
can u help with sql stuff
I've written a code to send an mp3 file in channel, but bot responds as <discord.file.File object at 0x7fe44d5676f0>
"tiny"it is
I don't know SQL.
Then whats the problem?
u removed the try and except?
ok downloaded now?
its a bad practice
nop
.. do it
If you clicked download and ran the .exe installer, then yes it's installed. @earnest ferry
You dont know the definition of bad practice
then?
Did you run the thing that downloaded?
u dont know the logic
try and except is only to join vc,and the bot is joining vc without errors @prisma spoke
If no, run it. Afterwards, it'll be on your desktop or in your start menu.
๐
ok
What's happening here
fights
Replit isnt bad for that tiny bot
help me! please!
lol
FOR FUCKING SAKE IT IS
the bot basically has almost nothing to cache
It's still gonna get API Ratelimited as soon as it's turned on
Since the number of bots on replit have increased considerably
That is sometimes but really isnt bad practice
try it and see one?
What link was that anyway?
You can't say it's "bad practice" but u really can't do anything since it will be ratelimited as soon as u start it
Replit sucks ass if you're planning to host the bot permanently. If it's just for testing purposes, and not as a host, then I'd say replit is ok-ish. Still don't recommend it but as a last resort, it's usable
Yeah
oo
Which one?
my my
@ashen notch can u help with a db question please?
I can. What's up
About on par with "lmgtfy"
Yeah but its not really considered bad practice but ues replit is bad and has its downsides
Ah
Hem your hat has two bobbles I like it
uh craoop
@vocal ploverYou can thank Kat for that
What's up @earnest ferry?
Lmfao
ye downloadin
I asked her to make it silly, she delivered
Lol
@bot.event
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
if reaction.emoji == "๐":
print("Noted")
await reaction.message.channel.send(f"Verified by {reaction.author.id}")``` Anyone know why the second if statement doesn't print or do anything? no error
its loadin
async def brackets(ctx, p:int):
while 0!=p:
data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT 2;")
dataa = await data.fetchall()
await ctx.send(dataa)
p-=1
``` ok so i want it like the 1st msg sent by the bot...any of the content of that msg shudnt be equal to the second one
Cz u didn't react with that emoji?
I did
clicked on run
basically its a tourney brackets thing
Okay
how to do that?
Ah it should be while p != 0
Well same thing but the other one is considered better ngl
same thing..
print what reaction.emoji and you will see... its not the thumbsup
@vocal plover also if u can help ^^
Am on mobile :(
hlo? i downloaded vsc
u r very pro so ..
now start coding
create a file that ends with .py
wait
oy if you're on mobile you best view that link I sent you-- that website looks like ass on mobile
You can do it in vsc
and you committed it
no excuses, even discord has a better mobile app
help me..
@maiden fable
Hi
Mentioning and spamming won't give you more attention nor better help
Holy fuck you're right arl that is bad
yeah
..
Ok?
Well lemme get on my PC, ig
I can fix it in 2 ways:
Be a better Dev
Yeet it

or make an issue and someone else might fix it
You can probably do that easier than me rn lol
issues-- the best way to solve a problem, letting someone else solve the problem
Can you stop... @prisma spoke
People will help if they want/can
Spamming and pinging definitely won't make them want to help you
waiting since so long
alr so vco said he wud help
Patience is part of being a developer
No I said I was on mobile, implying I couldn't help currently
@bot.event
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
print(reaction.emoji)
if reaction.emoji == "๐":
print("Noted")
await reaction.message.channel.send(f"Verified by {reaction.author.id}")``` how does that second statement not run
indentation..
reaction.emoji below return
What....?
Sooo?
๐คฆ
Uhhhh?
simple? btw u saw my error?
@prisma spokedo not spam your requests for help please
Yea gimme just one opening discord on my PC
maybe you forgot to save the file?, and try re-running the bot
he said he wud help
nope its saved
@kindred drum the bot is reacting so it's triggering the first if statement and then returning
regardless, no one is ever obligated to help you on this server. every one is free to walk away :) that's what makes this server the way it is. no strings attached. feel free to open a help channel #โ๏ฝhow-to-get-help and you may get more people willing to help you there.
no one helps in a channel
the bot reacts once
https://gyazo.com/a289001c9258bad27292184ff354e2e8 look at this
if message.author.bot statement
It's printing check 1
it prints it once
Meaning the first if statement is being printed
because the bot reacts once
its only printing that when the bot reacts, when they react the emoji is printed
nope
hmm
server traffic varies depending on the day and time. people do answer help channels. if you've tried several times without a response, consider re-forming your question. see this guide for how to write good questions. https://www.pythondiscord.com/pages/guides/pydis-guides/asking-good-questions/. that being said you're free to ask your question in this channel too. just don't spam it, and especially do not feel that anyone is obligated to help you please.
I don't understand it at all
because I have this event
@bot.event
async def on_reaction_add(reaction, user):
if reaction.emoji == "๐ธ":
if user == bot.user:
return
for i in range(0,len(Json_Items)): #It doesn't exist
for x in Json_Items[i]:
if int(x) == int(user.id):
Json_Items[i][x]['paypal_bool'] = True
Json_Items[i][x]['aids_variable'] = int((Json_Items[i][x]['aids_variable']) + 1)
json.dump(Json_Items, open("./all_user_rep.json", "w"), indent=1)
roleID = 915961885738819604
roleObj = user.guild.get_role(roleID)
await user.add_roles(roleObj)``` which works perfectly
maybe try type casting it to string
and I tried on reaction_add but it was cached or something
hey , in lavalink bot i should run lavalinkjar in the beginning and then the script , so how can i do this in replit?
does anyone here use discord-py-interactions (aka discord_slash and discord-interactions)
yall mods can also help tho...after explaining the fact
omg you just solved this THANK YOU!
Had to assign it to a string for some strange reason
i would if i could. i know nothing about discord bots :P
nobody?
is there an event that is called whenever an interaction button is pressed?
@bot.event
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
print(reaction.emoji)
if str(reaction.emoji) == "๐":
print("Noted")
await reaction.send(f"Verified by {reaction.author.id}")
``` How do I send the message
you need to get the channel you want to send the message in
and then what would it be
channel = bot.get_channel(reaction.channel_id)
await channel.send(...)```
the docs doesn't show that reaction has a channel_id attribute are you sure that's right?
I think it's reaction.message.channel
for on_raw_reaction_add discord.RawReactionActionEvent gets passed in
!d discord.RawReactionActionEvent.channel_id
The channel ID where the reaction got added or removed.
.
works
How do I remove the reactions from the message? I tried reaction.clear() and reaction.remove() and they both don't work
slash = SlashCommand(client=client,sync_commands=True)
@slash.slash(name="ping",guild_ids=[867750507774869545])
async def _ping(ctx):
await ctx.send(content=f"Pong! ({round(client.latency*1000)}ms)")``` when i use the command it tells me "interaction failed" how do i fix this? i use discord_slash
What library is that
discord_slash
No idea about that library , sorry
!d discord.Message.clear_reaction , or clear_reactions if you want to remove all reactions
await clear_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Clears a specific reaction from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
New in version 1.3.
can anyonehelp
client.run("")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.```
guys how to settle it
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
Does someone know some good and working slash command handler packages?
Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions
permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
await role.edit(reason="shutdown", permissions=permissions)
await ctx.send(f"Server shut down.")
but users with the role self.default (member role) can still chat
mention a user by id in message? this is a question
well you can do <@userid>
or if you have member object you can do member.mention
@bot.command() #SUBMIT BOT COMMAND
async def submitbot(ctx):
mentionedbot = '{0.member.mention}'
await ctx.reply("Your request has been submitted! Bot submitted: " + mentionedbot)
you want to mention command author?
then do this?
like v!mention 608575327811272704 and response will be like:
@kind wind
but behind the code the id given will go into the <@id> system to be able to tag people even out of the server
AttributeError: 'str' object has no attribute '_state'
await discord.Message.clear_reactions("๐")```
mention = f"<@{message.content.replace("command ","")}>"``` this should work
what is that ("command ","")?
you just have to edit the code to fit your code
basicly just insert the content to erase from the string
you dont need to copy paste it , use your own discord.Message object
like?
mention = f"<@{yourmessagestringvariable.replace("v!mesntion ","")}>"``` like this. You have to change the message string variable to your message.content
so await discord.Message.clear_reactions(reaction)?
Hey guys how do i check if a member is a bot in the async def on_message(message):
message.author.bot would be True if its a bot
okay
for k, v in ordered.items():
if k in users:
if users[k] == 0:
"""Idk what goes here"""
member = ctx.guild.get_member(int(k))
e.add_field(name = f"{index}. {member}", value = users[str(member.id)]["level"], inline = False)
if index == 20:
return
else:
index += 1```
How do i make it so for the `if users[k] == 0:` it will ignore that user if it is 0
@vocal plover can I quote this message on the issue? #discord-bots message
yes 
DisnakeDev/website#3
Like this?
Try it
okay
Wdym by not working?
Is the first if statement True?
idk
Start by adding a print after it
So it's more working?
sorry
it didn't worked forgot to shutdowm my real bot
@tawdry perch still not working any solution?
Is the first if statement returning True?
o
how im new to coding
Add a print statement after the first if statement and see if it print anything when event is triggered
ok
discord.Message.clear_reactions() what do I put in the parameters
Indent
ok so its not trigering
so what should i type
!indent
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
no console print
python tutorials in google
Then it won't run any further
oo but any idea on whats wrong
Is it possible to give a command its own help command that is different from the other commands' help?
The ID don't match so the code stops there, nothing wrong on that
discord.Message.clear_reactions() what I put in the brackets
!d discord.Message.clear_reactions
await clear_reactions()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes all the reactions from the message.
You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
Nothing
no acually this code works perfectly fine but i im changing it to cogs but in cogs it is not working
Well if nothing got printed it means the ID does not match so code won't run any further
ye but no idea why its not running even the id is correct
Is the second if statement True as well?
Is it correct?
what is a coroutine.
uh i'm confused on something , so i've got a blacklist command that blacklists words that cannot be snipped nor sent , like they get deleted but i've got it running like this
@tasks.loop(seconds=5)
async def my_loop(self):
x = await self.bot.db.fetch("SELECT blacklisted FROM blacklist")
lst = ' '.join(words["blacklisted"] for words in x)
lst = list(lst.split(' '))
self.blacklisted_stuff = lst
@commands.command(aliases=['s'])
async def snipe(self,ctx):
if self.message is None: return await ctx.send('there are no deleted messages')
embed = discord.Embed()
embed = discord.Embed(title=" ",description=f"{self.message}")
embed.set_author(name=self.author.name,icon_url=self.author.avatar_url)
embed.set_thumbnail(url=self.author.avatar_url)
embed.set_footer(text=f'requested by {ctx.author.name}',icon_url=ctx.author.avatar_url)
await ctx.send(embed=embed)
```and this
```py
@commands.Cog.listener()
async def on_message(self,message) -> None :
if message.author.bot: return
msg = message.content.lower()
new_string = "".join(c for c in msg if c.isalpha() or c == " ")
lastest_string = new_string.split()
x,y = set(lastest_string) ,set(self.blacklisted_stuff)
if x & y:
await message.delete()
await message.author.send(embed=discord.Embed(title=f"you've sent a blacklisted word in {message.guild.name}",description=f"Blacklisted word : {x & y}"))```
but i'm making my bot public but theres one thing i'm confused about , how would i make my task update for each guild . and i thought someone here must know another way thats better , so i was asking if there is a way to do so ?
Afaik it's a async function
yes
async def function():
#this is a coroutine
...
can you send a basic cogs event so i can check if it works
This is not a Modmail thread.
oh its python server
do I need pass anything through it?
So the first if statement is running?
This is not a Modmail thread.
it ain't working
yea
That means the IDs don't match
uh what do I pass through it?
To what function
Can you tell which function you are telling about
even this is not working NB - tried this on main.py instead of cogs
your question doesnt make sense , you should learn how basic stuff work first.
Is the channel correct?
well , you said ur using it on a cog why are you using client.listen() ?
everything correct
well this is main.py not in cogs file
But still doesn't work even if it's correct?

@bot.event
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
channel = bot.get_channel(reaction.channel_id)
print(reaction.emoji)
if str(reaction.emoji) == "๐":
if reaction.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {reaction.member}")
await discord.Message.clear_reactions()``` its not that I don't know the basics is that this library makes literally no sense
ye idk whats wrong
I give up, sorry can't continue
np
Try printing 1,2,3,4 etc etc in different parts of your function and see where the numbers stop printing, thats where errors arises
well its not even printing in first function and idk why
learn asyncio
it really helps , well you should first of all i suggest doing reaction.channel.send() and whats the error ?
Its command.Cog.listen
()
debugging to another level
Haha
still not working
lmao what is even before and after 
member objects.
memberupdate
k trying
oh fair
**await discord.Message.clear_reactions("๐")
show
breh cog.listen doesnt work
@wild imp you are not in a cog
its cog.listener right?
right now i am in
yes
uh , reaction.message.content ? or ether reaction.message , give me a sec to check the docs
show more traceback
commands work but events doesn't (listener)
Oh
wait what line is that ?
that's probably in the source code
!d discord.on_raw_reaction_remove
discord.on_raw_reaction_remove(payload)```
Called when a message has a reaction removed. Unlike [`on_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_remove "discord.on_reaction_remove"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
y'all need to learn how to send in errors
!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").
File "C:\Users\Tony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\message.py", line 1309, in clear_reactions
await self._state.http.clear_reactions(self.channel.id, self.id)
AttributeError: 'str' object has no attribute '_state'```
well
Don't put anything inside ()
Doesn't work
Just call the function
yeah
oh you had discord.Message in the code
use an instance of it
not the base class
This looks like half of the traceback..
@wild imp try, client.listen()
already did but its in cog so wont work
call the function?
commands.Cog.listener()
Same thing tho, but are you sure the cog is loaded correctly?
bruh
@kindred drum
This requires Intents.members to be enabled.
to you have it on ?
so wait discord.Message.clear_reactions(reaction)?
no
Not the whole object path.
you don't have discord.Message in your actual code
dont pass anything inside the arguemnets
you have an instance of discord.Message
ofc
yeah its reaction.message
in ur case
TypeError: clear_reactions() missing 1 required positional argument: 'self
Show ss
!d discord.Message.clear_reactions
await clear_reactions()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Removes all the reactions from the message.
You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
Can you show us your code..?
breh k
hm, takes no parameter
is this what u meant @upbeat otter ?
code I've enough trust you can do this much xD
Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions
permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
await role.edit(reason="shutdown", permissions=permissions)
await ctx.send(f"Server shut down.")
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
channel = bot.get_channel(reaction.channel_id)
print(reaction.emoji)
if str(reaction.emoji) == "๐":
if reaction.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {reaction.member}")
await discord.Message.clear_reactions()
```
breh
how do i enable that
What?
nothing lol
smh code
so any solution to my problem?
?
I meant show the code again
This whole function is just weird, this function takes payload and not reaction.
:/
solutions/
ye i did nothing triggers it
i can invite you to my repl if u want @upbeat otter
I swear converting from docstrings to md files are a pain
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("check 1")
``` let's start with this.
Interesting, lemme see
Wet wet
?
oh god
wdym
I dont wanna break all of your bot xd, i'm a little insane lmao
little or too
well there is no command in my bot has i am trying to figure this event issue so i can transfer my commands to cog based repl
Imma switch to my laptop wait
ye sure
@wild imp what is the issue
i will dm the invite link
this event is not triggering
my dms off wait
k
do u have members intent
open
ye ofc
lol
R u loading the cog
have you tried putting a print statement as the first thing in the function to see if the function is getting triggered, it's just not passing the if check?
I was gonna say the same damn thing whyyyyyyyyyyyyyyy
yes i did thats how i figured its not trigering
i see
r u loading the cog
its auto
O
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
message = channel.fetch_message(message_id)
``` next part getting the channel and message object
this looks to me like an extension, do you have a setup function and are you adding the extension?
bot.add_extension() iirc
yes ofc commands work but events/listeners wont work
message undefined
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(reaction.emoji) == "๐":
if reaction.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
message = await payload.member.fetch_message(payload.message_id)
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
await message.clear_reactions()
Have you the right intents in both the dashboard & your code?
ye but is there any separate code to do anything with intents
message still undefined in message = channel.fetch_message(message_id)
and I can't pre define it
all you have to do is define the right intents, and check the presence intents on the dashboard
edit.
make sure these are checked
!
How do I add validation to an event?
already done
I edited the message
do you have presences=true when you defined intents?
or at least Intents.all()?
you'll also need members=true
message = member.fetch_message(message_id) member undefined same with message_id
why are you fetching a message with a member object
also fetch_* are coroutines as they make an API clal
Edited again forgot the payload
how can i solve this error_
& : The term 'C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
- & C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe "c ...
-
+ CategoryInfo : ObjectNotFound: (C:/Users/ADMIN/...on39/python.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
message_id still undefined lol
Add your python to PATH
dang payload
Not sure how you'd do it on windows though, i've only ever done it on linux
Should be ok now.
vRuntimeWarning: coroutine 'Messageable.fetch_message' was never awaited pass
uh
sir i installed it now to path, yet its the same error showing up, pls help
Hmm it is awaited though.
Are you sure you put it on PATH? can you send what your PATH looks like?
well let's see it
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(payload.emoji) == "๐":
if payload.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
message = await payload.member.fetch_message(payload.message_id)
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
await message.clear_reactions()
this code doesnt have any errors but it doesnt work, why?
else clause
You copied it all?
he really doesn't know much
though fetch_message can only be done on a Messageable, not a member
!d discord.Member.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
well i guess that makes sense as members are messageables
my add to PATH is checked
Yeah i had the docs next to me, but idk mictony isn't responding aswell, oh well.
What is the issue?
how can i solve this error_
& : The term 'C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
- & C:/Users/ADMIN/AppData/Local/Programs/Python/Python39/python.exe "c ...
-
+ CategoryInfo : ObjectNotFound: (C:/Users/ADMIN/...on39/python.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
this error
Wrong command, I mean you maybe had typo on command
please go to a channel where this belongs
I've already said it here
Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions
permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
await role.edit(reason="shutdown", permissions=permissions)
await ctx.send(f"Server shut down.")
property permissions: discord.permissions.Permissions```
Returns the roleโs permissions.
doesn't exist
What..?
why is this command not working?
doesn't exist
!src defcon shutdown
Shut down the server by setting send permissions of everyone to False.
yes
oh I see you copying class something
other than
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(reaction.emoji) == "๐":
if reaction.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
message = await payload.member.fetch_message(payload.message_id)
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
await message.clear_reactions()```
I have done that permission update before as well
bot/utils/message_cache.py line 101
def update(self, message: Message) -> bool:```
Ah fk
the update is defined in the bot's file
remove the none value and see if it works if works ping me
This is wrong update tho
it's what they use where you use it
these 2?
You sure?
I just clicked on the method on github...
It's not always valid
@commands.command()
async def rank(self, ctx):
if ctx.channel.id == bot_channel:
stats = levelling.find_one({"id": ctx.author.id})
if stats is None:
embed = discord.Embed(description = "You haven't send any message yet. No rank for you!!")
await ctx.channel.send(embed = embed)
else:
xp = stats["xp"]
lvl = 0
rank = 0
while True:
if xp < ((50 * (lvl ** 2)) + (50 * (lvl - 1))):
break
lvl += 1
xp -= ((50 * ((lvl - 1) ** 2)) + (50 * (lvl - 1)))
boxes = int((xp / (200 * ((1 / 2) * lvl))) * 20)
ranking = levelling.find().sort("xp", -1)
for x in ranking:
rank += 1
if stats["id"] == x["id"]:
break
rank_embed = discord.Embed(
title = "{}'s level stats".format(ctx.author.name),
colour = ctx.author.color()
)
rank_embed.add_field(name = "Name", value = ctx.author.mention, inline = True)
rank_embed.add_field(name = "XP", value = f"{xp}/{int(200 * ((1 / 2) * lvl))}", inline = True)
rank_embed.add_field(name = "Rank", value = f"{rank}/{ctx.guild.member_count}", inline = True)
rank_embed.add_field(name = "Progress Bar [lvl]", value = boxes * ":blue_square:" + (200 - boxes) * ":white_large_square:", inline = True)
rank_embed.set_thumbnail(url = ctx.author.avatar_url)
await ctx.send(embed = rank_embed)
it dosen't send the rank_embed
if str(paypal.emoji) == ":thumbsup:": @cloud dawn
AttributeError: 'Command' object has no attribute 'emoji'
any help?
then I don't know
how do i define bot in other way than this???
import discord
from discord.ext import commands
class Other(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def test(ctx):
await ctx.send(f'cmd')
def setup(client):
bot.add_cog(Other(bot))
Can you send me a link where the line permissions.update is shown, I can't make it on mobile
docs say update doesn't exist otherwise
i mean the entire 3rd line and the none in second line
question == None
you're telling me
not is
so like that?
payload.emoji
@woven cradle
???
.
.
๐ฎ
nope
im stupid thanks!
still doesnt work
Reference@kindred drum
I feel this on a spiritual level
eeeeeeeeee
someone please help
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message
remove that 3rd line to
debug the variable
!indention
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
sed
sed?
!d discord.Permissions.update
update(**kwargs)```
Bulk updates this permission object.
Allows you to set multiple attributes by using keyword arguments. The names must be equivalent to the properties listed. Extraneous key/value pairs will be silently ignored.
It seems to exist
PLEASE IT HAS BEEN 10 MINUTES
it is night here
Breh 10 minutes is a low time
Caps doesn't really help
Please be patient
go sleep
Well still be patient and maybe sleep?
Amount of information provided also also like solve for x in ||nothing||
@slate swan I got the docs not sure if I pong you before
ranking variable gets data from mongo
yes
and I saw it
and I have no idea
Oh sorry then 
mongodb has data
does anyone know why it doesnt work?
Sometime when i wake up i know the solution to my problem.
i dont :(
I just wake up and remember that js exists :(
I also have that issue... 
ctx.author.reply???
it's ctx.message.reply
or await ctx.send
dont start with discord.py
even tho this has nothing to do with py knowledge
start with something simple
@cloud dawn bruh it can't get the message
thank you
it works, after hours
how would i make it embed?
How do I add validation to an event?
Across:
def check():
return inter.channel.id != member_ticket_channel1.id
help me with this error pls-
@client.command(aliases = ['8ball', 'test'])
AttributeError: 'Client' object has no attribute 'command'
Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions
permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
await role.edit(reason="shutdown", permissions=permissions)
await ctx.send(f"Server shut down.")
discord.Client doesnโt allow use of the commands framework.
Consider using
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **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.
could be cz of channel perms override?
i started discord bot development and i didnt understand a word he said, sorry ๐ฆ
sir pls
There's none
what does self.default contain ?
pls anyone help me too
Role id
Use commands from discord.ext
And declare a bot using commands.Bot
Then you can just do whatever you were trying to do
user = interaction.get_member(interaction.author.id)
await user.send_message(embed=embed)```
Any ideas why this isnt DM'ing the user who interacts with the button?
why not do await interaction.author.send
@maiden fable ๐
this is captcha 1, if someone executes my verify command, it sends them this in dms (ill obviously format it in an embed and make it pretty), but if this image is selected, the bot knows that if the user reply's with "KZEXEH", they've successfully passed the verification. otherwise, they've failed and must re-execute the command. lets say I have 3 captchas, how can I tie the proper verification key (such as "KZEXEH") to its proper corresponding captcha image
not really a fan of their layout, but how would i do this with a dict?
dict {
"/captchas/captcha1.png" : "KZEXEH",
"/captchas/captcha2.png" : "ABCDEF"
}```
wdym
Like it's manual so it's inefficient, the way
elaborate pls ive never used dicts 
I am not saying dicts themselves are inefficient
I am saying that this manual way of mapping is inefficient since u manually gotta hardcode the codes
!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.
Anyone know how i can get a role object?
because i have a role called muted
and i want to pass that role onto people that are muted
so how would i get that role object?
discord.util.get(guild.roles, name=<role_name>)
I wanted to make the bot delete a message with a specific text, but if someone had a specific permission, it would not delete the message. How would I do this?
Loop through all messages, delete if it has content and they donโt have the specific perm
How can i check if a button in disnake was clicked by the ctx author?
How do I add validation to an event?
Across:
def check():
return inter.channel.id != member_ticket_channel1.id
There's interaction check
Were exactly?
!d discord.View.interaction_check
No documentation found for the requested symbol.
!d discord.ui.View.interaction_check
await interaction_check(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.
This is useful to override if, for example, you want to ensure that the interaction author is a given user.
The default implementation of this returns `True`.
Note
If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
My bot has a delete command, and it is taking a while to delete messages even though it quickly shows the message of how many messages it has deleted. Is this normal?
Code: ```py
from discord.ext import commands
from discord.ext.commands.errors import MissingPermissions, CommandError, MissingRequiredArgument
class Clear(commands.Cog):
"""Apaga mensagens"""
def __init__(self, bot):
self.bot = bot
@commands.command(name = "clear")
@commands.has_permissions(manage_messages = True)
async def clear(self, ctx , amount=2):
await ctx.channel.purge(limit=amount+1)
if amount == 1:
await ctx.send(f'Foi apagada `{amount}` mensagem com sucesso!')
else:
await ctx.send(f'Foram apagadas `{amount}` mensagens com sucesso!')
@clear.error
async def clear_error(self, ctx, error: CommandError):
if isinstance(error, MissingPermissions):
await ctx.send("Vocรช nรฃo tem permissรฃo para usar este comando")
return
def setup(bot):
bot.add_cog(Clear(bot))```
It is hosted on my PC for the time being, but when I turned it on (which was also on my PC) this did not happen.
Hmm
code in image
error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [Errno 13] Permission denied: './cogs/ffmpeg.exe'
what does permission denied mean? can someone help?
?
Guys my clear functions is lagging
before it used to clear 20 messages instantly
now it doesn't show it until i refresh discord
what do i do?
I have the same problem. I believe the problem is not ours.
maybe discord servers?
And it shows that it deletes after a while, no need to refresh (at least, with me it does.) And yes, maybe it is the Discord own lag
Sorry for the bad English, I'm Portuguese
its fine
Sounds like a discord issue
Is discord.py still good to use or not? i saw recently the developer was stopping and asked other contributers if they wanted to take over but no one stepped forward.
If it's better to go to something else what should i choose?
Dpy will be getting more outdated as time passes, I recommend disnake
It's by far the best fork yet of dpy, so the syntax isn't much different ๐
ok thanks will look at it
yo anyone got help? AttributeError: module 'discord.message' has no attribute 'clear_reactions' - ```py
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
if payload.member.bot:
return print("User cannot be a bot in raw reaction event")
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
if str(payload.emoji) == "๐":
if payload.member.id != 861214093822394368:
await channel.send("no no BOZO LOL")
else:
print("Noted")
await channel.send(f"This reputation has been **VERIFIED** by {payload.member.mention}")
await message.clear_reactions()
```
Why did you imported something like discord.message
I imported this from discord import message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
says this is undefined....
Because you need to use on your channel object...
Maybe you need to take a look at what OOP is
msg = await channel.fetch_message(the_id)
Then you can use msg.something() since it will be a discord.Message object
How to add validation for this event
you are a saint but I can;t have the message predefined, it will change every time
def get_captcha():
dict = {
"captcha1.png" : "KZEXEH",
"captcha2.png" : "123456",
"captcha3.png" : "ABCDEF"
}
return random.choice(tuple(dict.keys())) # ('image.png', 'CODE') # return from a function
@bot.command()
@commands.check(checkk)
async def verify(ctx):
variable = get_captcha # ('image.png', 'CODE')
# now index them for the url and code
# send [0] as output
# wait for [1] as input
# if input == [1], they succeeded verification
# if not, whatever you want to do (i.e, display some message or return or anything of that sort)```
the # lines explain whats needed, its for a verification command, im tying images to keys, if captcha1 is sent, im trying to make the bot send the user a dm of that image, and they have to message the bot the proper corresponding key for the image. never used dictionaries before and this is all i have at the moment
guys why does my ping keep going up?
before it was sub 40
then post 60
then 80
NOW 120
I believe that your bot's ping relies on the connection's latency between it and Discord API's servers.
Therefore, it has nothing to do with your code, nor Python. Anyhow, if you're running many tasks at once, that might be a reason too.
anyone?
view = OtherTicket()
await ctx.channel.send(embed=embed, view=view)``` How would I ad multiple buttons to the view?
Bruh it says a token grabber
Let's just not...
xXh4ckerXx
๐งข
hm.
Cap
Ight imma head out
boop
@slate swan
Wtf man
Y did u block
And what did u do to my testing server
@slate swan
Y
This guy really tried to scam my work lmfao
what?
hello, if i want to send a wikipedia page url how can i make it so it doesn't use an embed, can i set that somewhere
He wanted to steal my work so i blocked him
okay
Yeah
'ight imma head out
Yeah
I don't care, leave it... This isn't what this chat is supposed to be about.
Yeah keep asking for spoonfeeds but not here
@slate swan just leave him, please. Be more mature than him:)
!ot
Off-topic channels
There are three off-topic channels:
โข #ot2-never-nesterโs-nightmare
โข #ot1-perplexing-regexing
โข #ot0-psvmโs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
Yeah ik lol
xd, children sometimes
I mean calling me a child when he destroyed my testin server
@fringe harness This is not a place to have a personal fight with someone. This is a channel for helping with Discord bots.
boopity boop
Add more buttons in the class
In the documents I saw a view.add thing, but that doesn't seem to work, nor does a command like OtherTicket(), Stuff(). Could you assist me in the right direction, please?
Didnt try to scam
you can use add_item() method @hollow agate
I just told you that this is not the place for that. If someone doesn't want to talk to you, stop pinging them.
Your viewing the whole class so make more buttons
Alr whatever
So I just put more buttons in this area: ```py
class OtherTicket(discord.ui.View):
def init(self):
super().init(timeout=None)
@discord.ui.button(label='Other', style=discord.ButtonStyle.green, custom_id='pp1')
async def otherticket(self, button: discord.ui.Button, interaction: discord.Interaction):```?
Yes thats correct
I see, thank you very much!
Yw
Is anyone here down to work on a collaborative discord bot
Dm me if interested
I will send you details in dms
@slate swan I worked on the basic part of the adalc if u still want to work on it
I made a ver basic calc
just to show I aint tryna steal
super.__init__(timeout=None)
TypeError: descriptor '__init__' of 'super' object needs an argument
```how do i fix this error
you mean fork?
none
its
super().__init__()
oh yeah
if your bot is unverified then continue to use dpy
if you want slash commands there's one made by someone in the dpy server
im making a help command with pagination but whenver i try it, it doesnt show the reactions can someone help? https://mystb.in/ProbabilitySolveApi.python
no
best not to since some ext libs dont work with dpy
https://gist.github.com/XuaTheGrate/5690a3d9dadb280d3d15f28f940e02d1, ping Maya#9000 in the dpy server if you need help
You can implement slash commands into discord.py quite easily yourself
I prefer this as I really don't like any of the wrappers, but whatever you feel comfortable works
Disnake is good
Can I remove my bot from a server using a command ?
await leave()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Leaves the guild.
Note
You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.delete "discord.Guild.delete").
anyone here uses discord-interactions (aka discord_slash and discord-py-interactions)
because idk how to import discord_slash.utils.manage_components without an error
how can i change a buttons color
Changing the button type will change its color
not that lol
after
like if a button gets disabled it turns grey
oh yeahh like that
that made me think if inside a button function (async def my bot function0
hmmm try putting a style = ButtonStyle.grey
inside your button function
thats setting the color of the button
bru
Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
if message.content.startswith(".8ball"):
responses = Question
res = (random.choice(responses))
await message.channel.send(res)
why isnt this working?
no errors are showing
๐
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 232, in brackets
data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT ?*2;",(p))
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 184, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 129, in _execute
return await future
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 102, in run
result = function()
ValueError: parameters are of unsupported type
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 125, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type```
```py
@bot.command()
async def brackets(ctx,p:int):
data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT ?*2;",(p))
dataa = await data.fetchall()
dt = list(dataa)
for i in range(1,len(dt),2):
await ctx.send(dt[i],dt[i+1])```
help
i want it to change on a interaction
!d disnake.ui.Button , it takes a disabled kwarg , which you can use when you edit it to disabled button
dudde you started off with no tutorials, responses are lists and why did you need like to rename the variable
bots not down
..
idk databases
bre and ppl say dont use json as a db
i would consider json as a db ยฏ_(ใ)_/ยฏ
but nows not the time to discuss about that
now?
Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
if message.content.startswith("$8ball"):
await message.channel.send(random.choice(Question))
because json isnt a dbs
why is it not working with 0 errors
thx
Yea , read the disabled kwarg part , you can use it when you edit the message
ppl cant help with dbs and say dont use json
For disabling the button
yeah ik lol
help me sir ples
This is not a channel specific for databases fyi , people who are aware about database help about that , #databases exists for database
not related to your question and json isnt a databases for many reasons
i will not help someone with json if i know theirs better ways
your problem?
who helps in that
yes
it is...
I mean , i just mentioned
The error?
what is?
u wont get it leave it+
Show full code
import nextcord
import random
Question = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."
]
client = nextcord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}"
.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("$hello"):
await message.channel.send("Hello!")
if message.content.startswith("$help"):
await message.channel.send("I am not ur assistant sucka")
if message.content.startswith("$congrats"):
await message.channel.send("Thanks to my coder Ashwary")
if message.content.startswith("fuck"):
await message.channel.send("cut it kiddo")
if message.content.startswith("$8ball"):
await message.channel.send(random.choice(Question))
client.run("
why so much if statements?
elif?

