#discord-bots
1 messages · Page 429 of 1
untill 2022
😘
not you again
so basically everyone is forced to move over to slash
thats what they plan, at least
is it having slash command
at least that what they say
i have seen this in here
they shoot their own foot hard
Next platform

uh

that's just normal code, not a bot at all
does that has anything to do with discord
guys which is the easiest in it
i dont know
wrap it yourself
we all mostly dislike this javascript stuff
huh, why?
i hate js
why
personally I'd go with Twilight or Kord from that list
r u replying to me
?
ye
ay, no shxtposting
any specific reason
tell that to owner of discord.js
lol
kord is not even in the list official api libraries maybe
dont get why he had to do it tho, thats kinda pathetic ngl
Twilight is in rust, a language i enjoy, and has a decent developer api, Kord is in kotlin, well maintained and runs anywhere on the jvm
He has a full time job and maintaining such a large project is a huge committment
no i mean the owner of discord.js mocking rapptz statement
anyone would feel happy if they "win" their rival
where?
6 of these are java based and idk what nostrum is and kotlin is rust based i think
🤪
Where?
^
lol
everyone thinks they have to move away from discord.py cause of the slash commands issue
- you have till next year to decide
- there is a few 3rd party libs, https://pypi.org/project/discord-py-slash-command/, https://dislashpy.readthedocs.io/en/latest/examples.html
just think people are being a lil bit dramatic thats all 
@vocal plover can u suggest the easy one cause we need to shift in just a week after that we will change it to a better one
great that i wrote a crappy discord api wrapper last month
but it will continue to be up to date?
but now i am in question, if discord plan to make every bot go slash
Yes
Not a lot of support though so 99/100 things you gotta find our yourself lol
doesnt that mean all wrapper would eventually get rewrite
there are no official discord api libraries
well, I won't be able to convert my bot's commands to slash commands cz my bot only does chatting 
lmao
oops i meant something else
are you lonely lol
@vocal plover ^
i didn't very understand but will discordpy continue to be up to date?
no
were u waiting for me to join the chat 
oh okay
discord.py project is closed

everyone is
I dont think there's any need to switch from discord.py yet, I'd wait a couple weeks/months, see where the ecosystem goes, and then re-evaluate how to proceed
The library doesn't just vanish tomorrow lol
huh?

everyone is always waitinh for u to show up
yes
why tho 
¯_(ツ)_/¯
we r going to switch faster
lol
btw, I don't really understand the WA api docs thing...
imma put my discord bot & api project on hold first
all libraries require you to rewrite the bot to use slash commands; so if you are going to start a new bot, then use something else
eh I never looked into it. the docs are WEIRDDDDDDDDDDDDDDDDD
😂 djs help channels are going crazy xD
If you need help no one can help (almost)
my expectations for good docs have risen since I have seen discord.py docs
:doubt:
wdym?
@visual island

ignored
@maiden fable hunterrr
Hiiiiii
Not many people code in kotlin, atleast those who want to provide help.
Nah 
lool
@agile goblet
may I know the reason why everyone waits for me?

then why did kotlin even got a disord api wrapper
i see, what about twilight
twilight, imo is a good choice for a discord lib - as long as you like rust
idk if it's worth learning js
Can some one tell me the OptionType of int in dislashpy
its just syntax
i'd say twilight (rust) or java altough i think java may be easier to go from python.
the syntax is a bit different from python, but most of the concepts are the same
a bit
and is there a lot of libraries like in python?
what is the easiest for a python user
hey can someone tell me a bot making website for python
cause everything is looking like hell for me
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.
Java would be easier than rust.
i see
thank you alec
so shall i switch to jda or what?
Only thing I'm salty about is this - it was a ton of effort to make
you don't want to use discordjs?
You could, but if you want absolute future proof rust is def the way to go.
no, js is looking like devil to me
All those hours spent on css wasted 
uh okay
it can still work for enhanced dpy cz it has the same syntax
how?
Resume nothing is in vain, also people did benefit from it. Look at it from the bright side.
Unless someone takes over the name discord.py on pypi and has a well maintained fork I'll likely abandon that tutorial and improve my own lib and make a tutorial on that, since maintaining both wont be worthwhile
anyone here build bots before?
how are u so much sure about this
rust is pretty flexible, fast, uses very little memory and it's a pretty growing community unlike java and python.
is it having buttons and dropdowns ?
or we need to install additional library
python imo is more for starters and for the use of easy temporary fixes. Or to automate some small task like playing a game for you.
how is rust different from python? (aside of syntax)
@cloud dawn ^
It does need a library but the library is big, bigger than pythons.
yeah, and very complicated unlike discord's API
Maybe it’s that I just created a team, and the bot writes to me that the team already exists?
I'm curious about that library, can you share it?
hiiiiiiiii

does it have anything more than python
ikr
?
Like i said it is a lot faster than python and uses less memory. Also has more functions in the most used API wrapper.
anyone well versed with making discord bots?
i see

@cloud dawn is serenity a rust api library
serenity is a rust discord API wrapper yes
the point of python is it's readability and beginner-friendly, soo... 
mhm
Use aiohttp
do u mind if I dm u?
sure thanks
uhh, sorry but I don't provide DM help. Can you post your question here itself? (sorry again)
It's an async library so use an async module.
it's ok
yeah, he's a coding God 
What?! No DM help? Despicable hmh yes.
im trying to make a bot that sends a warning message if a user sends a specific message
Exactly
NOOOOOOOO
no please I am fking not a God
which is the best in between this
JDA, Serenity, Kord, Twilight
hi fking not a God, im artixian


if member.id == 493451846543998977:
await ctx.guild.ban(member)
btw, have you read the announcement?
so idk how
send from where to where
@cloud dawn ^
Yep sad 
i am sending .txt file to the bot
twilight

And i like the name more
from where?
did u just....... roast me....?
and the i nedd to do some function with that .txt file in python
how is it better than the other can u plz explain
yeah, really sad 
@arctic vapor
493451846543998977 == hunter lmao
import discord
client = discord.Client()
list1 = ['hey', 'hello']
@client.event
async def on_ready():
print('we have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if any(word in message.content for word in list1):
print(f"user '{message.author}' sent '{message.content}'
in'{message.channel}' ")
await message.channel.send("please don't use "+ message.content)
client.run('')
this is code
huh?
493451846543998977
just a dad joke 
oh yeah
eh, I know
but the warning message is getting looped
Better than?
It's responding to its own message
oh ok
if message.author==client.user: return
the .txt file will be hosted on the cloud i want the bot to send me back those txt file to verify it
i mean how is it better than kord, JDA, serenity
Np
sorry idk cloud
i mean hosted on replit.com
- I don't like kotlin
- JDA is Java and Java is Java
- Twilight is obv a better name than Serenity
how can you compare 3 different libs written in 3 different languages 
Hence my comment 😂
in the way pandabweer compared and said me that which is better 🤣
with open('directory.txt') as f: ?
r these really reason?
thank u
np
No this is just my opinion, it doesn't really matter what you use. Python as if now is not bad to use.
java is very hard right?
It's not hard but you do need to invest time in it like every other language.
Not really, try c++ once
👏

Oh yeah I forgot that I need to do that
The c# one is already a nightmare
i am searching for a library that is easy to use than js and has almost most of the things in it
i tried c# once
what happened to enhanced dpy?
shouldn't it be a blue text link with the link hidden in it
You send the requests
What is that?
tbh i think it will be messed up very soon
!pypi enhanced-dpy
I don't think so, but ok
did they update it? a month ago it was working
It's markdown...
though as it is not made by danny i cannot trust over it
They didn't change anything
twilight/discord.js/JDA but if you are looking for something similar and want support. discord.js is the best way to go since the other ones just don't have any social skills because they put more time inside the api wrapper.
yr wish
Uh that's nothing more than a bunch of shorthands for usual methods and attributes 
don't space btw them
ok
Please don't ever recommend that people give bots amine perms, it's incredibly bad practise and security
Me forcing them to put it in admin mode
hey @glass latch your son's name is Kamlesh???
👀 .
if something doesn't work they have the admin link if they don't want to ask support in the support server
.
Alright i'm going back to helping channels this has been more than enough ot talk.
does discord.js have everything in it
?
Pretty much yes
Aswell i've already answered this.
who is he i am just 20 years old
so djs has the highest number of things in it
?
No that would be twilight
what is twilight¨
what does it have extra?
They are both good libraries it's just a difference between rust and java
anyone got python discord lib that support slash commands yet
dislash
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...
!pypi dislash.py
cool
dislash?
https://github.com/EQUENOS/dislash.py should the comminity maybe work on this if there is going to be a pulled fork
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...
anyone looking for a team to maintain dpy?
there's thousands, if not tens of thousands of bots using discord.py, and with message intents, they'll all break
Thats not entirely how that works
your bot will break anyway regardless of the lib if you're not using slash commands and dont get the intent
(outside of purely having a mention prefix to get the content for that specific message)
Wait
?
Only if the bot is in undere 75 server right?
Why an error occurs if this is the only command
Remove the main help command
hey i have doubt:
Deleted, Here's what happened
The main one not the one you created
discord.py has a built-in help command
You can disable it by passing help_command = None when creating the Bot instance
No
Doesn't mean the lib is going to end
Uh like , there are other developers who may work on it , not officially tho
The library still works fine
but updates
when i text anything to the discord i made function which makes the message to append with other string . 2. but when is send a this sting to other function i cant send the appended message with message.channel.send(string)
library will still work of course
Nothing is getting broke.
The Thousands of bots on dpy, most of them are unverified are not affected at all.
The bunch of verified once have the option of using non-orthogonal packages like discord-slash and more.
The huge verified bots on dpy already made their own implementation of slash commands and interactions by their own.
But yes, it might be an issue in future since there will be no maintenance of the lib and no community.
So no need to panik for Oh! Danny shut down dpy, now everything broke. You can still install it and use and it'll work totally fine.
anyone
not all
Anyone who is willing to support discord.py; DM me.
there are many bots that feels 'weird' with slash commands
!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)
I agree slash commands are nowhere near to normal commands and it's a lot of work and time to upgrade to them. But let's not panik, maybe there will be a better version anytime soon
It's just that their old bots are not getting broke
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near ""691198774587949067, 500, 500"": syntax error``` what's this error
yeah
RIP discord.py 2015-2021
it shouldn't die until April 2022
But let's just hope discord reset their plan for the message intents thing
ye :(
can't all lib devs protest to disc? :O
they can, but discord didn't even hear them
like "who tf are you"..
idk if i should move to js or c++
if support gets lost that is
What would be the command to get pins from a channel and return it as a list?
you can also wait it out and see what happens over the coming weeks/months with other forks it just takes time unless you can't wait that long
yea hopefully someone takes control of the discord.py module
Anyone know?
!d discord.TextChannel.pins
await pins()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves all messages that are currently pinned in the channel.
Note
Due to a limitation with the Discord API, the [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message") objects returned by this method do not contain complete [`Message.reactions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.reactions "discord.Message.reactions") data.
Okay thanks
lmao dpy dead all under my predictions
it's a lot of work, sadly i don't think it'll happen
that's why I implemented my own lib long before this happened
it sucks it's gonna hold off
async def on_message(message):
banned_requests = ["I got banned", "im banned"]
msg = message.content
if {banned_requests} in msg:``` the list here doesnt work, any idea on how i can implement it?
for x in banned_requests, if msg.content == x
Hello, I am making an order on my bot for the covis tracker. I finished the script but I got 2 errors. One at try: and one at except:. Can you help me ? Here is the code:
@bot.command()
async def covid(self, ctx, *, countryName = None):
try:
if countryName is None:
embed=discord.Embed(title="This command is used like this: +covid [country]", colour=0xff0000, timestamp=ctx.message.created_at)
await ctx.send(embed=embed)
else:
url = f"https://coronavirus-19-api.herokuapp.com/countries/{countryName}"
stats = requests.get(url)
json_stats = stats.json()
country = json_stats["country"]
totalCases = json_stats["cases"]
todayCases = json_stats["todayCases"]
totalDeaths = json_stats["deaths"]
todayDeaths = json_stats["todayDeaths"]
recovered = json_stats["recovered"]
active = json_stats["active"]
critical = json_stats["critical"]
casesPerOneMillion = json_stats["casesPerOneMillion"]
deathsPerOneMillion = json_stats["deathsPerOneMillion"]
totalTests = json_stats["totalTests"]
testsPerOneMillion = json_stats["testsPerOneMillion"]
embed2 = discord.Embed(title=f"**COVID-19 Status Pour le/la {country}**!", description="Ces informations ne sont pas toujours disponibles, elles peuvent donc ne pas être exactes !", colour=0xff0000, timestamp=ctx.message.created_at)
embed2.add_field(name="**Nombre total de cas**", value=totalCases, inline=True)
embed2.add_field(name="**Cas aujourd'hui**", value=todayCases, inline=True)
embed2.add_field(name="**Mort en total**", value=totalDeaths, inline=True)
embed2.add_field(name="**Morts aujourd'hui**", value=todayDeaths, inline=True)
embed2.add_field(name="**Cas rétablis**", value=recovered, inline=True)
embed2.add_field(name="**Cas actifs**", value=active, inline=True)
embed2.add_field(name="**Cas critique**", value=critical, inline=True)
embed2.add_field(name="**Cas pour 1 million**", value=casesPerOneMillion, inline=True)
embed2.add_field(name="**Mort pour 1 million**", value=deathsPerOneMillion, inline=True)
embed2.add_field(name="**Tests totaux**", value=totalTests, inline=True)
embed2.add_field(name="**Tests pour 1 million**", value=testsPerOneMillion, inline=True)
embed2.set_thumbnail(url="https://cdn.discordapp.com/attachments/564520348821749766/701422183217365052/2Q.png")
await ctx.send(embed=embed2)
except:
embed3 = discord.Embed(title="Nom de pays invalide ou erreur de l'API", colour=0xff0000, timestamp=ctx.message.created_at)
embed3.set_author(name="Erreur")
await ctx.send(embed=embed3)
def setup(bot):
bot.add_cog(covid(bot))```
yo nobs
help
how to make that only ctx.author can use it
do a check for reaction
button press*
how 
please
that's not how to use try
they can help here also
it's try and except
how...
try:
#code
except:
#code
#Test
@bot.command()
async def ButtonTest(ctx):
await buttons.send(
content = "This is an example message!",
channel = ctx.channel.id,
components = [
ActionRow([
Button(
label="Hello",
style=ButtonType().Primary,
custom_id="button_one"
)
])
]
)
#Buttons PlaceHolder
@buttons.click
async def button_one(ctx):
await ctx.send("Hello!")```
i never used try: or except:
lol
oh sorry, i replied to the wrong message
@slate swan
it's not try, paired with a else
any idea where can we host our discord bot for free other than replit.com
Heroku
Honestly if you aren’t storing anything on the file system heroku is an option just not recommended.
Yes
i give up on discord bots
Which package are you using?
why
Well yesterday’s news I’m sure didn’t help
I gave up on discord bots a week before daddy Rapptz dumped away his gold
I just shifted my view of bots. That was about it. Before I was making them mega apps. Now I view them as specific and complementary.
I hear discord.js fully supports slash.
btw, how is your esoteric lib going?
There’s also another python package that says it’s supported. Heroli or something.
oh I'm discontinuing it until October I have a big React project at the moment
I see
I love react. I hate front end.
hikari
that doesnt make sense
you can use dislash
I somehow get an error when i use dislash
I learned that I like how react approaches it. But I also learn I just hate frontend design.
Heh.
i also so i gave up on bot making and play cs full time
i didnt give up
gfu , maybe discord.py will be taken over ig
Does anyone have the invite to dislash's support server
Gives you a good excuse to learn another language. Thinking either rust or elixr
Since dpy doesnt support slash commands, i need to use the package
Although I think rust is more practical
i never used rust , maybe ill try
or go into more deep python
on JavaScript
it's best language
I can stomach typescript. It’s actually pleasant.
its boring
and i want to learn web development too so i switched to that
Been working with fastapi. Nice library for web
Channel = client.get_channel('881166507374174248')
Text= "React to this message to get Introvert role"
eMoji = await client.send_message(Channel, Text)
await client.add_reaction(eMoji, emoji='🏃')
``` This is giving an error- Bot has no attribute 'send_message'
It sound like you are following a very old tutorial. In get_channel it should be a int That gives you a textchannel you then call send_message on.
Like add emoji.add_reaction(' your emoji')
?
You need to store the result of get channel in a variable.
can u see my code?
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
await client.change_presence(activity=discord.Game("with Peoples' Lives"))
Channel = client.get_channel(881166507374174248)
Text= "React to this message to get Introvert role"
eMoji = await client.send_message(Channel, Text)
await client.add_reaction(eMoji, emoji='🏃')
@client.event
async def on_reaction_add(reaction, user):
channel = client.get_channel(881166507374174248)
if reaction.message.channel.id != channel:
return
if reaction.emoji == "🏃":
Role = discord.utils.get(user.server.roles, name="Introvert")
await client.add_roles(user, Role)
is there a problem here?
You are using very old syntax.
oh
Most methods were moved out of client.
thanku sir
that's another reason
someone know?
you didn't specify the member while running the command
and set member to ctx.author is none
guild = ctx.guild, not guild - ctx.guild
ikr
yeah
holy fuck
someone know how can i do 2 commands in one commands? like if someone type !open to open a ticket and i want an option to type !close to close the ticket, how i do it?
use a database
I like react, I hate css.
i love front end but i don't know it.
Don't worry Im learning Grids and Flexboxes
👍
@willow vine, describe your problem here, i would be happy to help 🙂
okay thank you
https://stackoverflow.com/questions/68957866/to-find-all-users-in-the-given-roles-discord-py
here's a link to the piece of code I'm facing issue over
.
someone know why is this happend?
Rip d.py
wait did they change the name of this channel to discord bots because they new discord.py will be cancelled :/
what

It's discord-bots since a long time because we support all libraries related to discord bots and python
How can I add a cooldown between DM's (global cooldown for Welcome DM's so i dont trigger antispam)
when u send a DM, u save the current time, and before sending another DM, u check if the last msg was sent X seconds ago, and if it is, just wait for a while before sending another DM
Thanks
mapping
https://cdn.discordapp.com/attachments/343944376055103488/881176818739204146/unknown.png
someone know why is this happend?
will discord.py end soon ?
why?
it has already ceased any development as of yesterday
no
it already has
yes.
wat
*it stopped getting updates
no, you should learn js and then djs
Hi im trying to extract some message from an embed message, such that it only sends when the title starts with 'remember'
if message.author.id == 12345:
if message.embeds:
if message.embeds[0].fields[0].title.startswith('Remember'):
await message.channel.send(message.embeds[0].fields[0].value)
i mean, if d.py will be end
Why is this channel alive?
how wouldn't it be
embed.set_image(url=")
i don't have url
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)
Note that the filename in the File constructor and the filename in the URL must match, and must be alphanumeric.
just upload the image to discord and copy the url
for i,x in enumerate(bot.commands):
``` all parameters of `x`?
for i,x in enumerate(bot.commands):
help_embed.add_field(
name=f"> !{x.name}",
)
``` what is the parameter of `x` for args of command?, `x.args`? `x.arguments`?
probably unless someone makes a fork of d.py that has slash command support
also what does it mean when discord says they r removing message intents
does it mean bots cant receive messages
can someone help me with us 😭
https://stackoverflow.com/questions/68957866/to-find-all-users-in-the-given-roles-discord-py
can i use dislash with discord.Client?
!d discord.Role.members
members```
Returns all the members with this role.
Please tell me how to do it right?
They changed their name a long time ago
You are overcomplicating it. It's something like this:
async def members_of_both(self, a: discord.Role, b: discord.Role) -> typing.List[discord.Member]:
return [m for m in a.members if b in m.roles]
granted, that is untested
u know what ima use just d i s c o r d - p y - s l a s h - c o m m a n d s
guy any github repo for a dashboard
no one is responding :/
for i,x in enumerate(bot.commands):
```what is attribute of `x` to see parameters? - like `!example <exam> <ple>`
DM me to help revive Discord.py
i have error in this code
this is the error
have you read it?
someone please help
yes
but wait
yes
why did you put attachment there
i am doing in replit

you send that
em = discord.Embed()
em.set_image(file=discord.File('attachment://Screenshot from 2021-08-28 19-07-46.png'))
await ctx.send(embed = em)
this code is i added @slate swan
completely wrong
someone please
f = discord.File("filepath", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await ctx.send(embed=embed, file=f)
oh sorry
this
the only thing you change is the filepath
which I don't know how it works on replit
ok
ok
important is that the filename kwarg in the first line should be the same as the set_image() url
(set_image url contains attachment:// tho)
Thats the point
They changed it long ago cause they probably knew it would be cancelled soon
I have this command in my cog:
@bot.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def globalrank(self, ctx, user: None):
print("ay")
if user is None:
user = ctx.author
data = get_public_leveling_data()
xp = data[str(user.id)]["globalxp"]
lvl = data[str(user.id)]["globallvl"]
to_the_next_lvl = data[str(user.id)]["globalto_the_next_lvl"]
print("got data")
xpleft = to_the_next_lvl - xp
line4 = f""
RankEmbed = discord.Embed(title=f"{user.name}'s stats")
RankEmbed.add_field(name="| Level", value=f"{lvl} |", inline=False)
RankEmbed.add_field(name="| Experience", value=f"{xp} \\ {to_the_next_lvl} |", inline=False)
RankEmbed.add_field(name="| Experience until the next level", value=f"{xpleft} |", inline=False)
await ctx.send(embed=RankEmbed)
print("command ended")```
it is not printing any of the things I printed but the cooldown is working (it is sending the cooldown error message). do someone know why? (it is also not ending thr embed...)
??
if its in a cog the decorator must be @commands.command()
not @bot.command()
and 
How do I get an account creation date?
thaks
Hello
ok I will fix it
How to restrict command to multiple user?? Instead of @commands.is_owner() or @command.has_role('easy')
a
Also my base code look like this
@bot.command()
async def test():
await ctx.send('hi')
My python is 4.0.1_arm64 but it's similar to 3.x (idk)
multiple users as in?
id
the thing is, there is not just 2 arguments, i want it to be such that the user can input how many ever roles they want, and it should return users in all those roles
def if_its_in_list(ctx):
id_list = [650516102488784934, 871631839725518938]
return ctx.author.id in id_list
@bot.command()
@bot.check(if_its_in_list)
async def test():
await ctx.send('hi')
Hmm hmm
like this @vale narwhal and sorry i was afk
Alr lemme try
ok
I know that, it still doesn't answer my question though
heyy
hey
send me code
and no errors
or just do
@bot.check()
def check(ctx):
return False ```
code here or dm?
Ah
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "<string>", line 43
def if_its_in_list(ctx):
^
IndentationError: unindent does not match any outer indentation level
lemme read
its on_member_remove()
not on_member_leave()
indent properly
got it
whaa im talking about rewrite version
yeah i am talking about that too
oh

remove works the same as leave?
I want the code to display mention all the users with the given roles(can be any number) as argument
https://stackoverflow.com/questions/68957866/to-find-all-users-in-the-given-roles-discord-py
can someone help me out?
yes
mention separately?
you copy pasted my code?
on what editor you are?
I added some space hold on
Im on mobile as i said
python 4.0.1_arm64 IDE
you have to check if you are missing any space or tab
ya
or there is any extra space
Im checking
basically the list should look like this -
['<@user1.id>', '<@user2.id>']
add a not so that you will get an error
ah
and you can use that error as a error handeling
I didn't get error on the old one
Just mistyped some space
yes you won't
hm
try they should not able to use it
How can i make my bot send a vote reminder every 12 hours
whats wrong with this
tasks.loop
How can i add the message when other people that wasn't in the list used it
yeh
wait
try it without 0x
`
async def(ctx, role: discord.User):
mention_list = []
for member in Role.members:
mention_list.append(member.mention)
np.hstack(mention_list)
`
and tell me
might work
Oops when i add "not in" it show me the error
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "<string>", line 49, in <module>
File "<string>", line 45, in if_its_in_list
AttributeError: 'function' object has no attribute 'author'
[Program finished]
it won't
my bad
def if_its_in_list(ctx):
id_list = [650516102488784934, 871631839725518938]
return ctx.message.author.id not in id_list
@bot.command()
@commands.check(if_its_in_list)
async def test():
await ctx.send('hi')
why its a hex
use this code
ah
that wont fix anything
just try it
no its a hex bruh
because its a object not str
that isnt how python works
and in think they want str not object
Still the same but now it's "message"
and it isnt a error
i mean what ever yeh
anyone know ig the cogs structure is right ?
use this @vale narwhal
screenshot
so i can understand what you mean
yes it is
i fixed it
is it returning an error?
Y’all are doin dpy stuff?? After wat happened
it solved now
tell me too what was wrong
thanks
I’m gonna make a fork
@vale narwhal worked?
yu cant have numbers without "" in json
so in py file i just did int(stuff)
you can have them
if you add "" it will be a string
how can i edit a embed to another embed
no no work for me
we can't have octs and hexs in json
but you can do one thing
i get this error
Other people still able to use it
you can use str to store hex and then convert it into int
thats unrelated but how can i download an image from an url?
invite me there
anyone ^
That's for only 1 role
you can edit with the ID, await msg.edit(embed=embed)
response = requests.get("https://i.imgur.com/ExdKOOz.png")
file = open("sample_image.png", "wb")
file.write(response.content)
file.close()
thanks
hmm wym
ohh wai
one min
nope does not work
await embed.edit(embed_1=embed)
no
it does bro come dm
msg = await channel.fetch_message(msg_id)
if you want to edit by id
show what you're trying to do
show us full code
@bot.command()
async def pages(ctx):
contents = ["This is page 1!", "This is page 2!", "This is page 3!", "This is page 4!"]
pages = 4
cur_page = 1
embed = discord.Embed(title="\u2754 Command Help",color=0x099AF5)
embed.add_field(name="**Utility**", value="``-covid\n-wiki\n-google\n-youtube\n-translate\n-calc``")
reacts = await ctx.send(embed=embed)
embed_1 = discord.Embed(title="\u2754 Command Help",color=0x099AF5)
embed_1.add_field(name="**Fun**", value="``-snipe\n-say\n-trivia``")
await reacts.add_reaction(":arrow_backward:")
await reacts.add_reaction(":arrow_forward:")
def check(reaction, user):
return user == ctx.author and str(reaction.emoji) in [":arrow_backward:", ":arrow_forward:"]
while True:
try:
reaction, user = await bot.wait_for("reaction_add", timeout=60, check=check)
if str(reaction.emoji) == ":arrow_forward:" and cur_page != pages:
cur_page += 1
await reacts.edit(embed_1=embed)
await reacts.remove_reaction(reaction, user)
elif str(reaction.emoji) == ":arrow_backward:" and cur_page > 1:
cur_page -= 1
await embed.edit(content=f"Page {cur_page}/{pages}:\n{contents[cur_page-1]}")
await reacts.remove_reaction(reaction, user)
else:
await reacts.remove_reaction(reaction, user)
except asyncio.TimeoutError:
await embed.delete()
break```not my code just testing some code
bro you're tryna do await embed.edit...
tf
you edit the message with the new embed
uh
ok
import discord
from io import BytesIO
from typing import IO, Any
from functools import partial
from concurrent.futures import ThreadPoolExecutor
from discord.ext import commands
from PIL import Image, ImageFilter, ImageDraw, ImageFont
def blocking_io(fp: IO[Any]):
with Image.open(fp) as img:
img = img.convert('RGB')
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("arial.ttf", 15)
draw.text((10, 25), "world", font=font)
im1 = img.filter(ImageFilter.CONTOUR)
return im1.tobytes()
class Imageprocessing(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.group(name='img', invoke_without_command=True)
async def image(self, ctx):
await ctx.send(f'Please use a subcommand for {ctx.command.name}')
@image.command(name='contour')
async def image_contour(self, ctx, user: commands.MemberConverter = None):
user= user or ctx.author
asset= user.avatar_url_as(size=128)
with ThreadPoolExecutor() as executor:
partial_blocking_io = partial(blocking_io, fp=BytesIO(await asset.read()))
returned_image = await self.bot.loop.run_in_executor(executor, partial_blocking_io)
await ctx.send(file=discord.File(BytesIO(returned_image), f'{user.name}.png'))
def setup(bot):
bot.add_cog(Imageprocessing(bot))```
can anyone help with this? another version of this code worked, but this is not working if IO is discord asset.
PIL is sync library, so I want that thread to run in another thread and it will return the image in bytes and send that file after the image processing is complete.
guys suggest me a discord api library
stop making bots
why
?????????????????????????????????????????????????????
@velvet yarrow
this channel is for bots
yes
you said that i should use tasks right? But what if it goes offline. I want it to remind based on time as their is no way my bot gonna stay online for 12 hours
making bots is boring rn
ok, did you figure it out?
discord wants all bots to have slash commands
are you using any database
no one asked. U legit typing this in this channel
or json
well yeah....
but why
which one
but it wld be easier if i use time module right?
yes
that is the best way to do that
so?
json != database
you can just compare current time and that time
how can i do tht. Im bad at time management
like you can create a task.loop()
im learning but json seems better
wtf
that will run every 5 min and get time from database
how json is better than postgres
then compare if its 12 hr
for my bot rn
database?
json
json is not a database and its not better than anything else.
im using tinydb
its sufficient and easy
postgresql is easy
not for me
do you know sql?
guys
use mongo
bruh lets not argue abt tht
anyone knows how can i send a message on this account with python?
k 😞
do you?
no
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
no
it's not that
that's not a reason to show how
guys which api library has slash cmd
yeah we get it. But for legal reasons we cant help u with tht
you know how to get current date and time
datetime.datetime.now
then format it maybe
time.time()?
or datetime.now()
but i dont want the date
..
!e ```py
from datetime import datetime
datetime object containing current date and time
now = datetime.now()
print("now =", now)
dd/mm/YY H:M:S
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print("date and time =", dt_string)
@velvet yarrow :white_check_mark: Your eval job has completed with return code 0.
001 | now = 2021-08-28 16:23:18.064459
002 | date and time = 28/08/2021 16:23:18
we need this thing
ok
we need both date and time
ok
because every 24 hr day changes
!e ```py
from datetime import datetime
date_time_str = '18/09/19 01:55:19'
date_time_obj = datetime.strptime(date_time_str, '%d/%m/%y %H:%M:%S')
print ("The type of the date is now", type(date_time_obj))
print ("The date is", date_time_obj)
@velvet yarrow :white_check_mark: Your eval job has completed with return code 0.
001 | The type of the date is now <class 'datetime.datetime'>
002 | The date is 2019-09-18 01:55:19
here we can convert string in to date time object @gloomy coral
!e ```py
import time
print(time.time())
import datetime
print(datetime.from_timestamp(time.time()))
oops
ok
What to do if, when deploying to heroku, it says that there is no module - dislash.py?
!d datetime.datetime.fromtimestamp
classmethod datetime.fromtimestamp(timestamp, tz=None)```
Return the local date and time corresponding to the POSIX timestamp, such as is returned by [`time.time()`](https://docs.python.org/3.10/library/time.html#time.time "time.time"). If optional argument *tz* is `None` or not specified, the timestamp is converted to the platform’s local date and time, and the returned [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") object is naive.
If *tz* is not `None`, it must be an instance of a [`tzinfo`](https://docs.python.org/3.10/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and the timestamp is converted to *tz*’s time zone.
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
this is how to compare them
ah ok
add it to requirements.txt
thanks
yeah, thats easy to use
this is how we can compare date and time for getting if 12 hr passed
oh hi
Hello
im still using ur time converter lol
but what if it goes offline?
time doesn’t stop when your bot goes offline
@client.command()
async def afk(self, ctx,*, reason="No reason provided"):
member = ctx.author
if member.id in afks.keys():
afks.pop(member.id)
this is giving me error, str object has no attribute author
lol
i was watching a tutorial
@hasty iron
use the append mode
yes
so why self
when it comes online again it will start loop again and check from json you saved the date and time as string
Self is a reference to the instance of the class
What should one do about discord.py not being maintained anymore? Wait for a fork? Switch languages? I'm pretty okay with Java, JS and Rust so switching languages might not be the worst idea for me
oh
oh i see
make one yourself
yes
it’s relatively easy
Just send a request to the endpoint
is it easy really?
with the required data
i made fully functioning slash commands in 700~ lines
i that less
wtf
it might seem alot, but most of those are models
it can be less
@client.command()
async def afk(ctx,*, reason="No reason provided"):
member = ctx.author
if member.id in afks.keys():
afks.pop(member.id)
else:
try:
member.edit(nick=f"[AFK] {member.display_name}")
except:
pass
afks[member.id] = reason
afkEmbed = discord.Embed(title = ":zzz: Member is afk", description = f"{member.mention} has gne AFK", color = member.color)
afkEmbed.set_thumbnail(url = member.avatar_url)
afkEmbed.set_author(name= member.display_name, icon_url = member.avatar_url)
afkEmbed.add_field(name="AFK note: ", value=reason)
await ctx.send(content=None, embed=afkEmbed)
Why is this giving errors again? str object has no attribute author
700 lines isnt much
is Hikari good?
line number
yes, u want an example?
?
oh sorry wrong ping
and yes, number_of_lines != complexity
isint it a api library
line number
how to ask for input in channel? I am new to this stuff
oh okay
msg = message.content.lower()
with open("messages.txt", "a") as aa:
aa.write(f"Author: {message.author.display_name}, Channel: {message.channel}, Message: {msg}")
aa.write("\n")
``` @chilly turret
!pypi hikari
does it have slash commands
im still confused
anybody can help?
i see mo author here
I need to get the message author
wait im confused. Wdym discord.py is not maintained
2nd line
its ctx.message.author @upbeat otter
uhh how do i get a list of cog commands
what's a good wrapper now to use now?
enhanced dpy @spring flax for the future
i dont think hikari is good
add more features to it yourself if you want
Apart from that, and yeah i know it is functional
apart from enhanced dpy?
Does messages sent in threads get dispatched from the api version dpy 1.7.3 uses?
!d discord.ext.commands.Cog.get_commands is this what you wanted? @gritty flame
get_commands()```
np
its fixed thankuuuu @velvet yarrow
no problem
Is this what you were talking about? @gritty flame
https://pypi.org/project/enhanced-dpy/
yeh
most people are relying on it
since the dev is gonna add slash support
@commands.command()
@commands.cooldown(1, 3, commands.BucketType.user)
async def globalrank(self, ctx, user: discord.Member):
if user is None:
user = ctx.author
data = get_public_leveling_data()
xp = data[str(user.id)]["globalxp"]
lvl = data[str(user.id)]["globallvl"]
to_the_next_lvl = data[str(user.id)]["globalto_the_next_lvl"]
xpleft = to_the_next_lvl - xp
line1 = f"| Level : {lvl}"
line1 = line1.ljust(40, ' ')
line1 = f"{line1}|\n"
line2 = f"| Experience : {xp} \\ {to_the_next_lvl}"
line2 = line2.ljust(40, ' ')
line2 = f"{line2}|\n"
line3 = f"| Experience until the next level : {xpleft}"
line3 = line3.ljust(40, ' ')
line3 = f"{line3}|\n"
precent = round(xp / to_the_next_lvl)
precent = 40*precent
line4 = f"[" + "X" * precent + "0" * (40 - 1) + "]"
line4 = line4.ljust(40, ' ')
RankEmbed = discord.Embed(title=f"{user.name}'s stats",
description=f"{line1}----------------------------------------\n{line2}----------------------------------------\n{line3}----------------------------------------\n{line4}")
await ctx.send(embed=RankEmbed)```
How can I make the ljust work?
how do I check is user reacted to a msg
@slate swanHeyyy matan
Hey, how can i wait for any user input in my bot
i need someone to write 1,2 for example
yeah?
u wont remember me probably
if (message.reference and member == (await message.channel.fetch_message(message.reference.message_id)).author) or member.id in message.raw_metions:
``` Why is the `.raw_mentions` giving me errors? btw i am not using cogs
are you eve?
other discord api libraries are just making me mad
haha, good
well, do you know how can I fix the problem?
umm wait
Nice to see you again black goku :D
where's the problem?
I am trying to make the embed look like this :
|level : 1 |
but instead it looks like this :
|level : 1|
how can I fix it?
i see
code ⬆️
i dont think it works like that tho
is it possible to get rate limited for editing a message for 1000+ times
check discord py docs
or normal discord docs
@slate swan
There may be a way
im too lazy to check docs lol
use the ```
''''''
strings
and its hard to find
wait
Not yet... I still don't get what's wrong with my code
so im quite confused the discontinuation of discord api for discord.py, does that mean any bot that was written in discord py will no longer work
5 times is the limit
how can I use them?
5 times per what?
5 times per second?
can i do 1 edit per second for 1 thousand times
messages cann be edited only 5 times
nope 7
I recommend taking a help channel and ask
hmm wouldnt u need to worry about rate limiting 🤔
thats what im asking about!
ive made a timer command which edits message every second
like
0

how to detect user reaction
are privileged intents id verification only applicable for bots in 75+ server
or every bot
dankmemer has a cooldown on commands cause its that big of a bot
1 second cooldown but i want it to edit 100+ times
1 edit per second for 100+ times
not quite sure
i mean make a cooldown for that command






