#discord-bots

1 messages · Page 429 of 1

shut ocean
#

bots can't get messages anymore

steady geyser
#

untill 2022

cloud dawn
#

😘

steady geyser
#

not you again

reef dock
#

so basically everyone is forced to move over to slash

chrome edge
#

thats what they plan, at least

hoary gust
#

is it having slash command

steady geyser
shut ocean
steady geyser
#

i have seen this in here

chrome edge
#

they shoot their own foot hard

shut ocean
#

Next platform

reef dock
chrome edge
#

uh

reef dock
shut ocean
#

that's just normal code, not a bot at all

chrome edge
#

does that has anything to do with discord

hoary gust
#

guys which is the easiest in it

reef dock
#

i dont know

chrome edge
#

wrap it yourself

shut ocean
#

we all mostly dislike this javascript stuff

chrome edge
#

huh, why?

hoary gust
#

i hate js

elfin agate
arctic vapor
vocal plover
#

personally I'd go with Twilight or Kord from that list

hoary gust
#

?

vocal plover
#

ye

chrome edge
hoary gust
arctic vapor
chrome edge
#

lol

hoary gust
#

kord is not even in the list official api libraries maybe

chrome edge
#

i think he feel happy now

#

more users

arctic vapor
#

dont get why he had to do it tho, thats kinda pathetic ngl

vocal plover
#

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

vocal plover
arctic vapor
vocal plover
#

oh that

#

Yeah thats a bit petty

chrome edge
#

anyone would feel happy if they "win" their rival

cloud dawn
vocal plover
#

kotlin is jvm

#

nostrum is elixir

shut ocean
arctic vapor
chrome edge
#

lol

reef dock
hoary gust
#

@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

chrome edge
#

great that i wrote a crappy discord api wrapper last month

dim wing
hoary gust
#

and is kord a official a api library

#

?

chrome edge
#

but now i am in question, if discord plan to make every bot go slash

cloud dawn
cloud dawn
chrome edge
#

doesnt that mean all wrapper would eventually get rewrite

vocal plover
maiden fable
#

well, I won't be able to convert my bot's commands to slash commands cz my bot only does chatting 7408_shrekstare

hoary gust
dim wing
#

i didn't very understand but will discordpy continue to be up to date?

chrome edge
#

no

maiden fable
dim wing
#

oh okay

vocal plover
#

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

cloud dawn
maiden fable
maiden fable
agile goblet
#

everyone is always waitinh for u to show up

lament mesa
#

yes

maiden fable
#

why tho Thonk

lament mesa
#

¯_(ツ)_/¯

hoary gust
#

lol

visual island
chrome edge
#

imma put my discord bot & api project on hold first

shut ocean
#

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

maiden fable
cloud dawn
#

😂 djs help channels are going crazy xD

hoary gust
#

@cloud dawn u said kord have 99/100. so what is not present in it

#

?

cloud dawn
cloud dawn
maiden fable
#

7408_shrekstare my expectations for good docs have risen since I have seen discord.py docs

chrome edge
#

:doubt:

maiden fable
#

arceeeeeeeee

#

Hiiiiiiiii

hoary gust
rare pewter
#

@visual island potatowave potatowatermelon

maiden fable
#

SadCatCrying ignored

rare pewter
#

@maiden fable hunterrrpotatosnuggling

maiden fable
#

Hiiiiii

cloud dawn
rare pewter
dim wing
maiden fable
#

@agile goblet PepeGiggleHehe may I know the reason why everyone waits for me?

maiden fable
chrome edge
hoary gust
vocal plover
#

twilight, imo is a good choice for a discord lib - as long as you like rust

dim wing
#

idk if it's worth learning js

frigid badge
#

Can some one tell me the OptionType of int in dislashpy

chrome edge
#

its just syntax

cloud dawn
lament mesa
dim wing
#

and is there a lot of libraries like in python?

hoary gust
molten meteor
#

hey can someone tell me a bot making website for python

hoary gust
#

cause everything is looking like hell for me

vocal plover
cloud dawn
hoary gust
molten meteor
#

thank you alec

hoary gust
#

so shall i switch to jda or what?

vocal plover
dim wing
cloud dawn
hoary gust
lament mesa
dim wing
maiden fable
cloud dawn
vocal plover
#

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

elfin agate
#

anyone here build bots before?

hoary gust
cloud dawn
# hoary gust how?

rust is pretty flexible, fast, uses very little memory and it's a pretty growing community unlike java and python.

hoary gust
#

or we need to install additional library

cloud dawn
#

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.

chrome edge
hoary gust
cloud dawn
visual island
rare saddle
#

Maybe it’s that I just created a team, and the bot writes to me that the team already exists?

zinc reef
hoary gust
hoary gust
#

?

slate swan
#

heyyyy

#

I need help

cloud dawn
slate swan
#

anyone well versed with making discord bots?

hoary gust
#

@cloud dawn is serenity a rust api library

slate swan
#

serenity is a rust discord API wrapper yes

visual island
maiden fable
glass latch
#

but i am facing some issues with it

cloud dawn
slate swan
glass latch
#

sure thanks

maiden fable
cloud dawn
visual island
cloud dawn
#

What?! No DM help? Despicable hmh yes.

slate swan
#

im trying to make a bot that sends a warning message if a user sends a specific message

maiden fable
maiden fable
hoary gust
#

which is the best in between this
JDA, Serenity, Kord, Twilight

arctic vapor
#

hi fking not a God, im artixian

visual island
glass latch
#

how do i send a .txt fila and process it

#

i am using replit

cloud dawn
#
if member.id == 493451846543998977:
    await ctx.guild.ban(member)
visual island
glass latch
#

so idk how

chrome edge
rare pewter
glass latch
#

i am sending .txt file to the bot

cloud dawn
maiden fable
cloud dawn
#

And i like the name more

chrome edge
maiden fable
#

did u just....... roast me....?

glass latch
#

and the i nedd to do some function with that .txt file in python

hoary gust
visual island
maiden fable
cloud dawn
slate swan
#
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

maiden fable
visual island
#

493451846543998977

arctic vapor
visual island
#

oh yeah

maiden fable
slate swan
#

but the warning message is getting looped

cloud dawn
rare pewter
slate swan
rare pewter
#

if message.author==client.user: return

glass latch
slate swan
#

ok got it

#

thanks

hoary gust
rare pewter
#

Np

glass latch
cloud dawn
lament mesa
glass latch
#

like this

hoary gust
chrome edge
glass latch
chrome edge
#

np

cloud dawn
hoary gust
#

java is very hard right?

cloud dawn
#

It's not hard but you do need to invest time in it like every other language.

slate swan
#

Not really, try c++ once

cloud dawn
lament mesa
cloud dawn
hoary gust
#

i am searching for a library that is easy to use than js and has almost most of the things in it

slate swan
#

why is it showing like this

#

Lol

hoary gust
maiden fable
slate swan
cloud dawn
hoary gust
slate swan
maiden fable
unkempt canyonBOT
maiden fable
slate swan
#

It's markdown...

hoary gust
slate swan
#

They didn't change anything

cloud dawn
slate swan
# unkempt canyon

Uh that's nothing more than a bunch of shorthands for usual methods and attributes blobpain

#

don't space btw them

#

ok

#

[] ()

vocal plover
# slate swan

Please don't ever recommend that people give bots amine perms, it's incredibly bad practise and security

cloud dawn
#

Me forcing them to put it in admin mode

honest lodge
slate swan
#

👀 .

slate swan
chrome edge
#

.

cloud dawn
#

Alright i'm going back to helping channels this has been more than enough ot talk.

hoary gust
#

?

vocal plover
#

Pretty much yes

hoary gust
#

?

slate swan
#

Has it been forked yet

#

I cry so much

#

My dreams

#

My bots

#

All Redundant

cloud dawn
glass latch
hoary gust
#

?

cloud dawn
slate swan
#

what is twilight¨

hoary gust
cloud dawn
#

They are both good libraries it's just a difference between rust and java

prime wolf
#

anyone got python discord lib that support slash commands yet

cloud dawn
maiden fable
unkempt canyonBOT
prime wolf
#

cool

cloud dawn
#

Imo i think dislash is the best for slash commands.

#

Looked at both repo's

slate swan
#

dislash?

crystal kestrel
#

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

night crater
#

Sip 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)

limber isle
#

Wait

signal forge
#

?

limber isle
#

Only if the bot is in undere 75 server right?

rare saddle
#

Why an error occurs if this is the only command

slate swan
glass latch
#

hey i have doubt:

rare saddle
stray path
vagrant brook
#

You can disable it by passing help_command = None when creating the Bot instance

high flame
#

we got scammed learning d.py eyesFinite

vagrant brook
#

No

high flame
#

at least imo

#

danny retired

vagrant brook
#

Doesn't mean the lib is going to end

slate swan
#

Uh like , there are other developers who may work on it , not officially tho

vagrant brook
#

The library still works fine

high flame
glass latch
#

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)

high flame
#

library will still work of course

slate swan
# crystal kestrel there's thousands, if not tens of thousands of bots using discord.py, and with m...

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.

slate swan
#

Anyone who is willing to support discord.py; DM me.

visual island
slate swan
#

!ytdl

unkempt canyonBOT
#

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)
slate swan
eager harness
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near ""691198774587949067, 500, 500"": syntax error``` what's this error
slate swan
visual island
#

it shouldn't die until April 2022

#

But let's just hope discord reset their plan for the message intents thing

slate swan
#

ye :(

royal dock
#

can't all lib devs protest to disc? :O

slate swan
visual island
#

like "who tf are you"..

slate swan
#

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?

royal dock
slate swan
#

yea hopefully someone takes control of the discord.py module

maiden fable
#

!d discord.TextChannel.pins

unkempt canyonBOT
#

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.
slate swan
tame nymph
#

lmao dpy dead all under my predictions

slate swan
tame nymph
#

that's why I implemented my own lib long before this happened

#

it sucks it's gonna hold off

bold oxide
#
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?
boreal ravine
slate swan
#

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*

slate swan
slate swan
slate swan
#

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

glass latch
#

any idea where can we host our discord bot for free other than replit.com

maiden fable
#

Heroku

fast musk
#

Honestly if you aren’t storing anything on the file system heroku is an option just not recommended.

maiden fable
#

Yes

high flame
#

i give up on discord bots

white perch
tame nymph
fast musk
#

Well yesterday’s news I’m sure didn’t help

tame nymph
#

I gave up on discord bots a week before daddy Rapptz dumped away his gold

fast musk
#

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.

white perch
#

Does anyone know a good package for slash commands

#

even buttons, context menus

fast musk
#

I hear discord.js fully supports slash.

visual island
fast musk
#

There’s also another python package that says it’s supported. Heroli or something.

tame nymph
visual island
#

I see

fast musk
#

I love react. I hate front end.

tame nymph
frigid badge
white perch
fast musk
#

I learned that I like how react approaches it. But I also learn I just hate frontend design.

#

Heh.

frigid badge
white perch
#

i didnt give up

frigid badge
white perch
#

Does anyone have the invite to dislash's support server

fast musk
#

Gives you a good excuse to learn another language. Thinking either rust or elixr

white perch
#

Since dpy doesnt support slash commands, i need to use the package

fast musk
#

Although I think rust is more practical

frigid badge
#

or go into more deep python

tame nymph
#

it's best language

fast musk
#

I can stomach typescript. It’s actually pleasant.

high flame
#

and i want to learn web development too so i switched to that

fast musk
#

Been working with fastapi. Nice library for web

upbeat otter
#
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'
fast musk
#

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.

upbeat otter
#

oh

#

thanku

#

doesnt work

#

same error

novel cargo
upbeat otter
fast musk
#

You need to store the result of get channel in a variable.

upbeat otter
#

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?

fast musk
#

You are using very old syntax.

upbeat otter
#

oh

fast musk
#

Most methods were moved out of client.

upbeat otter
#

i see

#

so what do i do now?

fast musk
#

Find a newer tutorial and consult the official docs

#

Sorry on mobile

upbeat otter
#

thanku sir

high flame
#

that's another reason

slate swan
#

someone know?

high flame
#

member: discord.Member=None

#

give it a default value

fickle turret
#

you didn't specify the member while running the command

high flame
#

and set member to ctx.author is none

slate swan
fickle turret
#

guild = ctx.guild, not guild - ctx.guild

slate swan
#

oh i didn't see that

#

thx

#

omg

valid vault
#

ikr

high flame
slate swan
#

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?

high flame
#

use a database

lament mesa
high flame
#

i love front end but i don't know it.

tame nymph
lament mesa
#

👍

void hill
#

@willow vine, describe your problem here, i would be happy to help 🙂

slate swan
willow vine
#

okay thank you

willow vine
# void hill <@!430318015804866560>, describe your problem here, i would be happy to help 🙂
#

.

slate swan
#

someone know why is this happend?

rotund creek
#

wait did they change the name of this channel to discord bots because they new discord.py will be cancelled :/

arctic vapor
#

what

rotund creek
slate swan
crystal kestrel
#

can i use dislash with discord.Client?

#

or specifically, AutoShardedClient

slate swan
#

How can I add a cooldown between DM's (global cooldown for Welcome DM's so i dont trigger antispam)

crystal kestrel
#

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

slate swan
mighty gazelle
slate swan
#

why?

manic wing
reef dock
spring flax
manic wing
slate swan
#

wat

reef dock
#

*it stopped getting updates

slate swan
#

oh

#

well k

#

so i should learn d.js?

hasty iron
#

no, you should learn js and then djs

north cedar
#

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)
slate swan
hasty iron
#

you can update it on your own

#

fork the github repo

novel rampart
#

how did i put image in my file in embed

novel cargo
#

Why is this channel alive?

slate swan
#

how wouldn't it be

slate swan
novel rampart
#

i don't have url

slate swan
#
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.

slate swan
#
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`?
gray edge
#

also what does it mean when discord says they r removing message intents

#

does it mean bots cant receive messages

willow vine
crystal kestrel
#

can i use dislash with discord.Client?

unkempt canyonBOT
rare saddle
rare saddle
fast musk
#

granted, that is untested

crystal kestrel
#

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

hoary gust
#

guy any github repo for a dashboard

crystal kestrel
#

no one is responding :/

slate swan
#
for i,x in enumerate(bot.commands):
```what is attribute of `x` to see parameters? - like `!example <exam> <ple>`
novel rampart
#

this is the error

slate swan
#

have you read it?

novel rampart
slate swan
#

this is not the correct name

#

or

#

you're not in the directory that you think you are

novel rampart
#

then

#

in file

#

that image is added

slate swan
#

but wait

novel rampart
slate swan
#

why did you put attachment there

novel rampart
#

i am doing in replit

slate swan
novel rampart
slate swan
#

the place where you put attachment doesn't have the file path

#

show me the code

novel rampart
#
   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

slate swan
#

completely wrong

slate swan
#

f = discord.File("filepath", filename="image.png")
embed = discord.Embed()
embed.set_image(url="attachment://image.png")
await ctx.send(embed=embed, file=f)

novel rampart
slate swan
#

I messed it up too

#

damn

slate swan
#

the only thing you change is the filepath

#

which I don't know how it works on replit

novel rampart
#

ok

novel rampart
slate swan
#

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)

rotund creek
#

They changed it long ago cause they probably knew it would be cancelled soon

slate swan
#

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...)
brisk helm
#

??

oak warren
#

not @bot.command()

slate swan
#

wth

#

why do you typehint something to None

oak warren
#

and this

heavy gull
#

How do I get an account creation date?

heavy gull
#

thaks

velvet yarrow
#

Hello

slate swan
#

ok I will fix it

vale narwhal
#

How to restrict command to multiple user?? Instead of @commands.is_owner() or @command.has_role('easy')

#

a

velvet yarrow
#

ok

#

so now we will make a custom check

vale narwhal
#

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)

calm musk
#

multiple users as in?

vale narwhal
willow vine
velvet yarrow
#
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')
vale narwhal
#

Hmm hmm

velvet yarrow
#

like this @vale narwhal and sorry i was afk

vale narwhal
#

Alr lemme try

velvet yarrow
#

ok

willow vine
calm musk
velvet yarrow
calm musk
#

how do i get on_member leave working

#

on_member_join works fine

velvet yarrow
calm musk
#

and no errors

manic wing
#

or just do

@bot.check()
def check(ctx):
  return False     ```
calm musk
#

code here or dm?

vale narwhal
#

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

velvet yarrow
#

not on_member_leave()

calm musk
#

indent properly

calm musk
velvet yarrow
calm musk
#

oh

vale narwhal
calm musk
willow vine
velvet yarrow
willow vine
#

in one list

#

i want all the mentions

velvet yarrow
#

on what editor you are?

calm musk
#

elaborate?

vale narwhal
#

Im on mobile as i said

#

python 4.0.1_arm64 IDE

velvet yarrow
#

you have to check if you are missing any space or tab

vale narwhal
#

ya

velvet yarrow
#

or there is any extra space

vale narwhal
#

Im checking

willow vine
vale narwhal
#

Alr no crash

#

Lemme try run command

velvet yarrow
#

add a not so that you will get an error

vale narwhal
#

ah

velvet yarrow
#

and you can use that error as a error handeling

vale narwhal
#

Just mistyped some space

velvet yarrow
vale narwhal
#

hm

velvet yarrow
#

because its how it was ment to be

#

use this

vale narwhal
#

Oh yes

#

other people still can use it so

#

Ima try that

velvet yarrow
gloomy coral
#

How can i make my bot send a vote reminder every 12 hours

gritty flame
#

whats wrong with this

gloomy coral
#

and time 12 hours?

#

smart bro

velvet yarrow
#

json

velvet yarrow
#

hours=12

vale narwhal
#

How can i add the message when other people that wasn't in the list used it

gritty flame
velvet yarrow
velvet yarrow
calm musk
velvet yarrow
#

and tell me

calm musk
#

might work

vale narwhal
#

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]
velvet yarrow
calm musk
#

why not dead

velvet yarrow
#
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')
gritty flame
velvet yarrow
#

use this code

vale narwhal
#

ah

gritty flame
#

that wont fix anything

velvet yarrow
gritty flame
#

no its a hex bruh

velvet yarrow
gritty flame
#

that isnt how python works

velvet yarrow
#

and in think they want str not object

vale narwhal
junior junco
gritty flame
#

and it isnt a error

velvet yarrow
#

its json right?

gritty flame
junior junco
#

anyone know ig the cogs structure is right ?

gritty flame
#

ohhhhhh

#

u are smart

#

now it says value expected

velvet yarrow
#

so i can understand what you mean

velvet yarrow
vale narwhal
#

Lemme try the command

gritty flame
calm musk
summer phoenix
#

Y’all are doin dpy stuff?? After wat happened

junior junco
velvet yarrow
junior junco
#

thanks

summer phoenix
velvet yarrow
#

@vale narwhal worked?

gritty flame
#

so in py file i just did int(stuff)

velvet yarrow
#

if you add "" it will be a string

stark bobcat
#

how can i edit a embed to another embed

gritty flame
#

no no work for me

velvet yarrow
#

we can't have octs and hexs in json

stark bobcat
velvet yarrow
#

but you can do one thing

stark bobcat
#

i get this error

vale narwhal
velvet yarrow
#

you can use str to store hex and then convert it into int

hollow nexus
#

thats unrelated but how can i download an image from an url?

velvet yarrow
vale narwhal
#

k

#

dm

stark bobcat
calm musk
velvet yarrow
stark bobcat
#

ohh wai

#

one min

#

nope does not work

#

await embed.edit(embed_1=embed)

velvet yarrow
calm musk
velvet yarrow
#

make it await message.edit(embed=embed)

#

you need a msg to edit

calm musk
#

msg = await channel.fetch_message(msg_id)

stark bobcat
#

oh yeah i name it wrong

#

sry mb

calm musk
#

if you want to edit by id

velvet yarrow
stark bobcat
manic wing
velvet yarrow
#

show us full code

stark bobcat
#
@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
manic wing
#

tf

#

you edit the message with the new embed

stark bobcat
#

uh

stark bobcat
calm musk
#

not the other way

compact harbor
#
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.

hoary gust
#

guys suggest me a discord api library

calm musk
high flame
#

stop making bots

hoary gust
#

?????????????????????????????????????????????????????

high flame
#

just giving advice

#

dont spam

gloomy coral
#

@velvet yarrow

compact harbor
velvet yarrow
gloomy coral
#

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

high flame
#

making bots is boring rn

high flame
#

discord wants all bots to have slash commands

gloomy coral
velvet yarrow
#

or json

gloomy coral
hoary gust
velvet yarrow
high flame
gloomy coral
#

but it wld be easier if i use time module right?

gloomy coral
#

ez enough

velvet yarrow
#

that is the best way to do that

high flame
#

that's json

gloomy coral
#

so?

high flame
#

json != database

velvet yarrow
#

you can just compare current time and that time

gloomy coral
#

ik

#

he asked if json

high flame
#

ugh

#

just learn postgresql

gloomy coral
velvet yarrow
#

like you can create a task.loop()

gloomy coral
high flame
velvet yarrow
#

that will run every 5 min and get time from database

high flame
#

how json is better than postgres

velvet yarrow
#

then compare if its 12 hr

gloomy coral
#

for my bot rn

gloomy coral
velvet yarrow
#

like json or else

gloomy coral
#

json

high flame
#

json is not a database and its not better than anything else.

gloomy coral
#

im using tinydb

gloomy coral
high flame
#

postgresql is easy

gloomy coral
#

not for me

high flame
#

do you know sql?

rancid mirage
#

guys

hoary gust
gloomy coral
#

bruh lets not argue abt tht

rancid mirage
#

anyone knows how can i send a message on this account with python?

high flame
#

k 😞

rancid mirage
#

do you?

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

rancid mirage
#

no

high flame
#

self bots against tos

#

we never helped with that here

rancid mirage
#

it's not that

gloomy coral
#

yes

#

@velvet yarrow wht shld i do?

rancid mirage
#

i just want to troll my friend

#

:/

high flame
hoary gust
#

guys which api library has slash cmd

gloomy coral
#

yeah we get it. But for legal reasons we cant help u with tht

velvet yarrow
gloomy coral
#

then format it maybe

high flame
#

or datetime.now()

gloomy coral
#

but i dont want the date

rancid mirage
#

..

gloomy coral
#

i want time right?

#

yes ik this

#

thanks

velvet yarrow
#

!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)

unkempt canyonBOT
#

@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
velvet yarrow
#

we need this thing

gloomy coral
#

ok

velvet yarrow
#

we need both date and time

gloomy coral
#

ok

velvet yarrow
#

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)

unkempt canyonBOT
#

@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
velvet yarrow
#

here we can convert string in to date time object @gloomy coral

high flame
#

!e ```py
import time
print(time.time())

import datetime

print(datetime.from_timestamp(time.time()))

#

oops

rare saddle
#

What to do if, when deploying to heroku, it says that there is no module - dislash.py?

hasty iron
#

!d datetime.datetime.fromtimestamp

unkempt canyonBOT
#

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.
velvet yarrow
#

this is how to compare them

high flame
rare saddle
lament mesa
gloomy coral
#

ok

#

now wht?

velvet yarrow
# gloomy coral ?

this is how we can compare date and time for getting if 12 hr passed

gloomy coral
lament mesa
#

Hello

gloomy coral
gloomy coral
hasty iron
#

time doesn’t stop when your bot goes offline

upbeat otter
#
@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

hasty iron
#

why self

#

do you know when to add self or not

gloomy coral
#

lol

upbeat otter
#

i was watching a tutorial

upbeat otter
hasty iron
#

ok that tutorial was probably using cogs

#

you aren’t using cogs

upbeat otter
#

use the append mode

upbeat otter
hasty iron
#

so why self

velvet yarrow
upbeat otter
#

I am new to discord py

lament mesa
#

Self is a reference to the instance of the class

scarlet lava
#

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

hoary gust
#

@hasty iron is there any other python discord api library that has slash commands

#

?

hasty iron
#

make one yourself

lament mesa
#

yes

hasty iron
#

it’s relatively easy

lament mesa
#

Just send a request to the endpoint

hoary gust
#

is it easy really?

lament mesa
#

with the required data

hasty iron
#

i made fully functioning slash commands in 700~ lines

hoary gust
hasty iron
#

it might seem alot, but most of those are models

velvet yarrow
#

it can be less

upbeat otter
#
@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

gritty flame
#

Hi, i have 2 questions

#

so first one how would i get all commands in a cog

lament mesa
spring flax
#

is Hikari good?

velvet yarrow
upbeat otter
#

yes, u want an example?

hasty iron
velvet yarrow
#

oh sorry wrong ping

lament mesa
#

and yes, number_of_lines != complexity

hoary gust
brave geyser
#

how to ask for input in channel? I am new to this stuff

hasty iron
#

oh okay

upbeat otter
#
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
upbeat otter
#

welcome

hoary gust
#

!pypi hikari

unkempt canyonBOT
hoary gust
upbeat otter
#

anybody can help?

upbeat otter
gloomy coral
#

wait im confused. Wdym discord.py is not maintained

upbeat otter
#

2nd line

velvet yarrow
upbeat otter
#

thanx

gritty flame
#

uhh how do i get a list of cog commands

spring flax
#

what's a good wrapper now to use now?

hasty iron
#

its still functional

gritty flame
#

enhanced dpy @spring flax for the future

hoary gust
#

i dont think hikari is good

hasty iron
#

add more features to it yourself if you want

spring flax
#

Apart from that, and yeah i know it is functional

gritty flame
#

apart from enhanced dpy?

lament mesa
#

Does messages sent in threads get dispatched from the api version dpy 1.7.3 uses?

spring flax
#

!d discord.ext.commands.Cog.get_commands is this what you wanted? @gritty flame

unkempt canyonBOT
velvet yarrow
upbeat otter
#

its fixed thankuuuu @velvet yarrow

velvet yarrow
#

no problem

spring flax
gritty flame
#

most people are relying on it

#

since the dev is gonna add slash support

slate swan
#
    @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?
zinc lion
#

how do I check is user reacted to a msg

upbeat otter
#

@slate swanHeyyy matan

brave geyser
#

Hey, how can i wait for any user input in my bot

#

i need someone to write 1,2 for example

slate swan
upbeat otter
#
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
lament mesa
#

You have made a typo

#

message.raw_metions
Its message.raw_mentions

slate swan
hoary gust
#

other discord api libraries are just making me mad

upbeat otter
#

how did u remember

slate swan
#

oh - I didn't recognize you as black goku lol.

#

I saw our dms

upbeat otter
slate swan
#

well, do you know how can I fix the problem?

upbeat otter
#

umm wait

slate swan
#

Nice to see you again black goku :D

upbeat otter
#

where's the problem?

slate swan
#

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?

upbeat otter
#

i see

upbeat otter
#

i dont think it works like that tho

haughty sedge
#

is it possible to get rate limited for editing a message for 1000+ times

upbeat otter
#

or normal discord docs

#

@slate swan

#

There may be a way

haughty sedge
upbeat otter
#

use the ```
''''''
strings

haughty sedge
#

and its hard to find

upbeat otter
willow vine
wraith flume
#

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

upbeat otter
slate swan
haughty sedge
#

5 times per second?

#

can i do 1 edit per second for 1 thousand times

upbeat otter
haughty sedge
#

nope 7

upbeat otter
reef dock
#

hmm wouldnt u need to worry about rate limiting 🤔

haughty sedge
#

ive made a timer command which edits message every second

#

like

#

0

high flame
zinc lion
#

how to detect user reaction

reef dock
arctic vapor
#

are privileged intents id verification only applicable for bots in 75+ server

#

or every bot

high flame
#

without a cooldown

reef dock
#

dankmemer has a cooldown on commands cause its that big of a bot

haughty sedge
#

1 edit per second for 100+ times

high flame
#

i mean make a cooldown for that command