#discord-bots

1 messages Β· Page 905 of 1

placid skiff
#

yes

light violet
light violet
# placid skiff yes

await coro(*args, **kwargs)
File "main.py", line 116, in on_message
for webhook in message.channel.webhooks:
TypeError: 'method' object is not iterable

placid skiff
#

print channel.webhooks

light violet
#

this

placid skiff
#

you are changing the member object in your function, it will not affect the member variable in your command

slate swan
placid skiff
#

oh wait, did you add await before channel.webhooks?

honest vessel
flat solstice
placid skiff
#

channel.webhooks is an async method, so to use it you should do this:

for webhook in await message.channel.webhooks()
placid skiff
#

member = your_function()

flat solstice
#

ah okay, thanks

light violet
flat solstice
placid skiff
placid skiff
final iron
#

For how many seconds can I block the event loop aka block the connection to discord before I get disconnected

#

I'm going to be running blocking code so I need to know if I should just optimize it or run it in run_in_executor

placid skiff
vague oak
#

yo, have stupid question. i have bot that sends message each hour, but i got for some reason timeout on discord API. code here: https://replit.com/@PogLop/notUsefulBot#main.py, and error message here:

raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.

thx m8ts

placid skiff
#

Seems like that they rate limited you

#

We can't do nothing

proven ore
light violet
#

how do i get the list of guilds my bot is in

potent spear
light violet
slate swan
potent spear
placid skiff
proven ore
#

async isnt just for declaring functions

potent spear
potent spear
grim oar
#

My bad didn't read it.

outer flint
#

is there a way to make so a bot will remove all messages, in a channel, that are neither images nor gifs?

potent spear
#

purge is what you're looking for

grim oar
#

check if message.attachments is empty

outer flint
#

lovely HYPEE

final iron
hushed galleon
#

if you want it to remove messages in real time you just need to do the latter in an on_message

potent spear
grim oar
#

How is BeautifulSoup blocking

potent spear
#

It's not

final iron
#

Oh so then I'm fine

potent spear
#

in your case, you should

proven ore
grim oar
#

Then why running it in thread pool executor

final iron
#

Because I was unaware it wasn't blocking?

grim oar
#

You shud log stuff to check what's blocking

final iron
#

What do you mean?

grim oar
#

Enable logging

potent spear
latent anchor
#

how do i make the bot add role when i run a command?

#

like if i want to add a role 'muted'

hushed galleon
#

well given their Member object you can use member.add_roles(<your role object>), where the muted role's id could be used to get that role object (guild.get_role(343944376055103488))

latent anchor
#

so i'll do bot.command and that two?

#

do i need to add anything else

hushed galleon
#

if you're just adding a role thats basically it

latent anchor
#

oh ok tysm

outer flint
outer flint
#

await message.delete()?

#
if message.guild.id == 551544391395835914:
    if not message.attachments: await message.delete()
potent spear
regal cove
#

hello

outer flint
#

I wonder if the message.guild.id is correct though thinko
it would check if the message is in a specific channel thinko

@commands.Cog.listener()
async def on_message(self, message):
    if message.author == self.bot.user: return
    if message.guild.id == 551544391395835914:
        print("we are in memes")
        if not message.attachments: await message.delete()
potent spear
#

actually both to be perfect

outer flint
#
if message.guild.id == 431065910040854539 and message.channel.id == 551544391395835914:
    if not message.attachments: await message.delete()
#

I wonder if there's a way to delete even when they write a message as a photo description thinko

potent spear
outer flint
#

ah no, don't worry about the content of the photo xD

hushed galleon
outer flint
#

I meant, deleting a message in any case that there's a text
so if people send a photo/gif with a text in it
it gets deleted

potent spear
outer flint
#

I mean like this
it's a photo with a message on top of it

slate swan
#

help me please

potent spear
hoary cargo
potent spear
outer flint
#

doiasodiasiodan

potent spear
outer flint
#

yeah it was an image of discord's background lOl

the idea is "delete any message that has text in it"
doesn't matter if it has photos as well

also I will have to find a way to see how to not remove gifs, cause for now they are removed

potent spear
outer flint
#

yes sir

potent spear
potent spear
slate swan
#

I can't install it, I can only find .gz files even though I am on Windows

outer flint
#

you mean in this way? if not message.attachments: await message.delete()?

potent spear
potent spear
final iron
#

!pypi readline

unkempt canyonBOT
#

The standard Python readline extension statically linked against the GNU readline library.

final iron
#

Huh

#

Brain too smol to comprehend

potent spear
outer flint
# outer flint doiasodiasiodan

gifs are removed as well thinko
cause they are counted as text
if a person writes a text as an "attachment" to a photo [like the message I'm replying to] it doesn't get deleted

slate swan
#

!pip gnureadline

unkempt canyonBOT
#

The standard Python readline extension statically linked against the GNU readline library.

potent spear
slate swan
#
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send("Il manque un argument.")
    elif isinstance(error, commands.MissingPermissions):
        await ctx.send("Vous n'avez pas les permissions pour effectuer cette commande.")```
potent spear
slate swan
slate swan
#

It does not put a blow that the person does not have the permission

potent spear
unreal sierra
#

any ideas for a discord bot?

maiden fable
#

Yes

unreal sierra
#

wsp

maiden fable
#

Make a bot which gives more bot ideas

unreal sierra
#

smort

#

but i need ideas about the ideas :(

maiden fable
#

Indeed

placid skiff
#

make a bot which returns Hunter neural network, so then you can ask ideas to it

#

because conditions aren't met (?)

copper gulch
#

what do you want the bot to delete though

novel lodge
#

i have this line of code
await message.channel.send ('1000') using discord.py
and i want to make it count down to 0 without using 1000 lines. pls help :)

tropic sinew
#

use a loop

novel lodge
#

idk how

#

im a bad coder lol

copper gulch
#
if 'jd' in message.content:

try it like this for now, since this is how I did it in my codes xd

vale wing
#

This code does completely different thing

#

Break the loop

placid skiff
#

Check better bro, it doesn't xD

vale wing
#

Break keyword

jolly basalt
#

yooo, can you help me now

copper gulch
#

try it since you mentioned to delete every word with jd in it xd

vale wing
#

Oh hold up nvm

placid skiff
#

!e

lst_1 = ["jd"]
str_1 = "jd ab cd ef cg"
for i in lst_1:
  print(True if lst_1 in str_1 else False)
#

wtf?

#

oh my bad

unreal sierra
placid skiff
#

!e

lst_1 = ["jd"]
str_1 = "jd ab cd ef cg"
for i in lst_1:
  print(True if i in str_1 else False)
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your eval job has completed with return code 0.

True
unreal sierra
#

oh wait nvm

placid skiff
vale wing
#

I didn't see it is a list

#

Thought he's iterating through a string

placid skiff
#

F

vale wing
#

what tf for do you need a list with one item tho

copper gulch
vale wing
#

Understandable

cerulean elbow
#

whats jd?

vague oak
placid skiff
#

well they have changed a lot of thinks in the last 3 months (don't worry probably no one here readed the new terms of use yet too) so you should check them and maybe you will find something

faint comet
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

faint comet
#

ok thanks

whole dust
#

anyone know why it sent me this everytime i try to send an image to the discord bot and let it edit the image using pillow?

errant jay
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

errant jay
#

ok

whole dust
#

which one?

cosmic agate
whole dust
#

when i try running the code on my friend'slaptop it worked

vale wing
#

I think it's clearly visible

vale wing
cosmic agate
vale wing
#

That's why referencing external files is bad

light violet
#

db2.update_one({ "guild_id": guild.id }, { "$set": { "link": guild.vanity_invite()}})

why link is not updating here

boreal ravine
#

vanity_invite is a property

vale wing
boreal ravine
#

it's not a callable object

light violet
vale wing
#

!d discord.on_member_join

cosmic agate
unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
vale wing
cosmic agate
# vale wing Show the code
@bot.event
async def on_member_join(member, guild):
      embed= nextcord.Embed(Title= "Welcome!", description=f"**Hello {member.mention}!**\nWelcome to **{guild.name}**!")
      embed.set_image(url="https://tenor.com/view/no-way-home-spider-man-no-way-home-tobey-maguire-spider-man-portal-gif-25114767")
      await welcome.send(embed=embed)
boreal ravine
cosmic agate
#

sedd

whole dust
boreal ravine
light violet
cosmic agate
boreal ravine
#

I mean one

cosmic agate
#

oh ok

vale wing
cosmic agate
vale wing
#

@whole dust just copy the file to project root and change the path to relative one

vale wing
cosmic agate
#

its integrated

vale wing
#

Wdym by integrated

cosmic agate
#

like when i type welcome

#

i get dropdown related stuff

vale wing
#

welcome should be discord.TextChannel object

#

Where do you define it

cosmic agate
#

idk

cosmic agate
#

for example there are message

light violet
#

how do i show vanity invite code in my server info embed

cosmic agate
#

messages like, welcome (user), we hope you brought pizza

vale wing
#

What's your python knowledge level

cosmic agate
vale wing
#

?

cosmic agate
#

check my about me

vale wing
#

Understandable

cosmic agate
#

hmm i suppose you were in the same situation

vale wing
#

Look into OOP later

#

!d discord.Guild.get_channel

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.

Changed in version 2.0: `channel_id` parameter is now positional-only.
cosmic agate
vale wing
#

Then do that

cosmic agate
#

hmm

#

ill look

#

sed

vale wing
#

For now I can give you sample code

await message.guild.get_channel(welcome_channel_id).send(...)```
Replace the `welcome_channel_id` with your welcome channel id
light violet
vale wing
#

What is that even lol

#

Oh yeah the set code

vale wing
unkempt canyonBOT
cerulean elbow
#

How do, I run this bot, from github?

hardy wing
#
for i in list:
            await message.channel.send(i)
            await asyncio.sleep(.5)```
how would I make this send in the reverse order the table is in like from end to start
junior verge
#
import discord
from discord.ext import commands
import pymongo
from pymongo import MongoClient

cluster = MongoClient("")
database = cluster["discord"]
collection = database["warn-database"]

class Warnings(commands.Cog):
    def __init__(self, client):
        self.client = client

    @commands.command(name='warnings',aliases=["warns"])
    @commands.has_permissions(manage_messages=True)
    async def warnings(self, ctx, user:discord.Member=None):
        id= user.id
        if collection.count_documents({"memberid":id}) == 0:
            collection.insert_one({"memberid":id,"warns": 0})

        elif user==None:
            return await ctx.send("Please mention a user!")

        warn_count = collection.find_one({"memberid":id})

        count = warn_count["warns"]
        new_count = count + 0

        collection.update_one({"memberid":id},{"$set":{"warns": new_count}})

        await ctx.send(f"{user.mention} has **{new_count}** warnings!")

def setup(client):
    client.add_cog(Warnings(client))
``` Not sure why it says this.
#
import discord
from discord.ext import commands
import pymongo
from pymongo import MongoClient

cluster = MongoClient("y")
database = cluster["discord"]
collection = database["warn-database"]

class Warn(commands.Cog):
    def __init__(self, client):
        self.client = client
    
    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def warn(self, ctx, user:discord.Member=None, *, reason=None):
        id= user.id
        if collection.count_documents({"memberid":id}) == 0:
            collection.insert_one({"memberid":id,"warns": 0})

        if reason==None:
            return await ctx.send("Please mention a reason")
        elif user==None:
            return await ctx.send("Please mention a user!")

        warn_count = collection.find_one({"memberid":id})

        count = warn_count["warns"]
        new_count = count + 1

        collection.update_one({"memberid":id},{"$set":{"warns": new_count}})

        await ctx.send(f"Warned {user.mention} for **{reason}** in **{ctx.guild}** | They now have **{new_count}** warning(s)!")
 
    # @commands.Cog.listener()
    # async def on_command_error(*args): 
        # print(args)


def setup(client):
    client.add_cog(Warn(client))


        


``` It's not in my warn command either
slate swan
#

help

#

I want the solution

#

oh where is the error

junior verge
#

have you done

#

pip install discord

#

Or do you even have a command

slate swan
sage otter
#

for i in reverse(list)

hardy wing
#

oh alr thnx

slate swan
#

؟ @junior verge

junior verge
#

Do in cmd

hardy wing
slate swan
gleaming sail
#

pip3 <command>

junior verge
#

How is this possible? When I don't have any aliases or other commands called that

#

!paste

gleaming sail
#

maybe change the "warning" to something else such as alert. if you read the error it states it already exists

junior verge
#

warnings is like checkwarns

royal umbra
#

Alright does someone know a lot about blockchain bots

gleaming sail
#

is it discord related?

royal umbra
gleaming sail
#

oh my apologies i read it wrong

#

no i don't

royal umbra
#

I have a bot running which is exploring the blocks on a token. I want to receive a messenge about bigger buys into a token. If someone buys 20 bnb worth of this token I want to receive a messenge in a server

junior verge
#
import discord
from discord.ext import commands
from datetime import datetime

class Help(commands.Cog):
    def __init__(self, client):
        self.client = client

@commands.command()
async def help(self, ctx):
  embed=discord.Embed(title=f'Help Menu', timestamp=datetime.datetime.utcnow())
  for command in self.client.walk_commands():
    description = command.description
    if not description or description is None or description == "":
      description='No description Provided'
      embed.add_field(name=f"`.{command.name}{command.signature if command.signature is not None else ''}`", value=description)
  await ctx.send(embed=embed)

def setup(client):
    client.add_cog(Help(client))
``` Is anything wrong with this command?
shut ocean
#

discord already has a help command

#

you have to remove it

misty ridge
#

Can bs4 getText() from a tag with multiple classes , its only 1 tag but it has alot of classes

misty ridge
#

Ok sry to put it here

slate swan
#

old account moment

slate swan
slate swan
#

you're not subclassing the help command

#

you used an unnecessary f-string

#

if not description
is the same as
if description is None

#

you named your bot client

#

you could have made a cool one liner for the description 😒

#

the field doesn't get added if description isn't None

#

you've got indentation problems

#
  File "C:\Users\Mathis\PycharmProjects\FlashBotRebooted\cogs\normal\random-normal.py", line 32, in setup
    await cursor.execute('CREATE TABLE IF NOT EXISTS users (guildId INTEGER , userId INTEGER , ratingStars INTEGER')
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
sqlite3.OperationalError: incomplete input

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\client.py", line 531, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Mathis\PycharmProjects\FlashBotRebooted\bot.py", line 132, in on_command_error
    raise error
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\bot_base.py", line 570, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\core.py", line 920, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\core.py", line 178, in wrapped
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: incomplete input
#

I have this error

#
    @commands.command(
        name="setup",
        description="Setup the review system.",
    )
    async def setup(self, ctx: Context):
        if ctx.message.author == ctx.message.guild.owner:
            await ctx.send("Hi!")
            async with aiosqlite.connect("ratings.db") as db:
                async with db.cursor() as cursor:
                    await cursor.execute('CREATE TABLE IF NOT EXISTS users (guildId INTEGER , userId INTEGER , ratingStars INTEGER')
                await db.commit()
            await ctx.send("Hi!")
        else:
            embed = disnake.Embed(
                title="Error!",
                description="You are not the owner of the server!",
                color=0xffffff
            )
            await ctx.send(embed=embed)

This is my code

maiden fable
#

U forgot a )

#

After INTEGER

final iron
#

I hate sqlite3 errors tbh

#

So unhelpful

slate swan
#

ohh

maiden fable
#

indeed

slate swan
#

thats so stupid

final iron
#

btw connecting to your database each time in a command can cause some issues

#

Just create a bot variable with your connection

sage otter
#

Not really

#

As long as you remember to close it, it’s fine.

final iron
#

Just passing on the information I was told πŸ€·β€β™‚οΈ

sage otter
#

Seems half baked. I mean it can because you could possibly have multiple unclosed connections in the connection pool. But you know if you close them every time you're finished with them, it should be fine.

old plank
#

Hello

final iron
#

πŸ‘‹

old plank
#

Print("hello")

slate swan
#

also, this command for some reason makes this error:

Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\Mathis\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\client.py", line 531, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Mathis\PycharmProjects\FlashBotRebooted\bot.py", line 132, in on_command_error
    raise error
disnake.ext.commands.errors.CommandNotFound: Command "test" is not found
    @commands.command(
        name="Test",
        description="testing",
    )
    async def test(self, ctx: Context, member: disnake.Member):
        async with aiosqlite.connect("ratings.db") as db:
            async with db.cursor() as cursor:
                for guild_id in ("users", "guildId"):
                    user_id = member.id
                    guild_id = ctx.message.guild.id
                    cursor.execute("SELECT rowid FROM components WHERE name = ?", (guild_id,))
                    data = cursor.fetchall()
                    if len(data) == 0:
                        print("No object found")
                    else:
                        print('Component %s found with rowids %s'%(guild_id,','.join(map(str, next(zip(*data))))))
            await db.commit()
slim ibex
#

indentation looks off

slate swan
#

?

ivory shadow
#

Ty

final iron
#

Why not just use f-strings

slate swan
#

its just for a short test

slim ibex
#

!sql-fstrings

#

ah you don't meant the queries LMAO

final iron
#

Nah

slim ibex
#

i see

slate swan
#

its just for a test

#

but i wonder why it says the command doesnt exist

#

the first command is in the same cog and works

slim ibex
#

show the whole cog

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
#

yeah

final iron
#
my_var = "True; DROP TABLE my_table"
connection().cursor().execute(f"INSERT INTO my_table VALUES({myvar})")

:lenny:

slim ibex
#

seeing multiple open connections hurts me

#

but it is aiosqlite so should be fine

vague oak
vale wing
slate swan
#

i fixed it

#

i just deleted it and repasted it, now it works

vale wing
#

Also what are you even trying to iterate here

for guild_id in ("users", "guildId"):
   ...```
It will make two iterations, in first guild_id will be "users" and in second - "guildId"
final iron
slate swan
#

im confused, but i dont question it

slate swan
faint arrow
#

guys i want to let the bot use the file.txt and read it that the user sent thx

vale wing
#

Um what

#

You want to read a file from a message?

faint arrow
#

no the user will send the file to the bot

#

and the bot will read it

#

txt

vale wing
faint arrow
#

ok yeah

vale wing
#

And which of these steps you are having issues with?
obtain message -> obtain file -> convert file -> read file

faint arrow
#

wdym on convert file

vale wing
#

Put it to readable form

faint arrow
#

yeah that one cuz its nonetype

#

empty message

vale wing
#

Can you show what code you have at this moment

faint arrow
# vale wing Can you show what code you have at this moment
  def check(m):
    return m.author == ctx.author and m.channel == ctx.channel and bool(m.attachments[0].filename.endswith('.txt'))
  code = await bot.wait_for('message',check=check)
  await code.delete()
  code = code.content
  await ctx.send(code)
  with open(code,'r') as f:
    code = f.read()
manic wing
faint arrow
vale wing
#

Alright lemme check docs cause I've never done this personally

#

!d discord.File

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False, description=None)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
manic wing
#

what are you actually trying to do?

faint arrow
manic wing
#

thats just await message.attachments[0].read()

#

!d discord.Attachment.read

unkempt canyonBOT
#

await read(*, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves the content of this attachment as a [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "(in Python v3.10)") object.

New in version 1.1.
vale wing
#

Yeah this

#

And use .decode on the result to convert it to string

faint arrow
#

message u mean m on my case right ? or what

#
  def check(m):
    return m.author == ctx.author and m.channel == ctx.channel and bool(m.attachments[0].filename.endswith('.txt'))
  code = await bot.wait_for('message',check=check)
  await code.delete()
  code = code.content
  await ctx.send(code)
  with open(code,'r') as f:
    code = f.read()
manic wing
faint arrow
#

owww

vestal pine
#

hi

manic wing
#

i recommend typehinting to message and renaming it

#

you dont need with open

vestal pine
#
@client.command()
async def info(ctx):
    await register(ctx.author)
    users= await get_date()


    donated= users[str(user.id)]["donated"]
    donations= discord.embed(title="Your Donations till now are")
    donations.add_field(name="Amount", value= donated)


async def register(user):

    users= await get_date()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)]["donated"] = 0
    with open("database.json","w") as f:
       json.dump(users, f)
    return True

async def get_date():
    with open("database.json","r") as f:
        users= json.load(f)
``` error is that ```user``` is not defined
manic wing
#

your check is fine apart from it raising error

vale wing
#

Info command

vestal pine
#

should I define it again in the info command?

vestal pine
vale wing
#

Maybe you meant ctx.author

#

Like what user did you need

vestal pine
#

the user id that will use this command

vale wing
#
donated = users[str(ctx.author.id)]["donated"]```
Perhaps this is what you need
faint arrow
# manic wing i mean `code`
 def check(m):
    return m.author == ctx.author and m.channel == ctx.channel and bool(m.attachments[0].filename.endswith('.txt'))
  code = await bot.wait_for('message',check=check)
  await code.delete()
  code = code.content
  f = await code.attachments[0].read()
  await ctx.send(f)
```som like this ?
vale wing
#

f.decode()

#

You need to convert bytes to str

faint arrow
#

f = await code.attachments[0].read()
AttributeError: 'str' object has no attribute 'attachments'

vale wing
#

You redefined code

#

Why do you even have this

code = code.content```
manic wing
slate swan
#

I want bot features code anyone?

manic wing
#

literally just go through the thousands of python discord bots there are on github

manic wing
slate swan
#

Ok

#

Why do I receive this error when I try enable intents in my bot? (hosted on pebblehost)

14.03 17:13:20 [Bot] Traceback (most recent call last):
14.03 17:13:20 [Bot] File "/run.py", line 9, in <module>
14.03 17:13:20 [Bot] intents.message_content = True
14.03 17:13:20 [Bot] AttributeError: 'Intents' object has no attribute 'message_content'
errant fossil
manic wing
slate swan
#
from discord import Intents

intents = discord.Intents.default()
intents.message_content = True
intents.members = True
client = commands.Bot(command_prefix = '.', intents=intents)
manic wing
#

hmm

#

print(dir(intents))

#

always used all so dk what the hell is on it

slate swan
vale wing
#

It is supposed to be since april or smth

slate swan
#

yesh april 31

honest vessel
#

why not just use discord.Intents.all() ?

slate swan
honest vessel
#

what can backfire?

vale wing
#

Oh that's may

slate swan
slate swan
vale wing
#

!d discord.Intents

unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").

New in version 1.5...
slate swan
#

!d discord.Intents.all

unkempt canyonBOT
#

classmethod all()```
A factory method that creates a [`Intents`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents "discord.Intents") with everything enabled.
honest vessel
slate swan
#

oh ok

manic wing
slate swan
honest vessel
honest vessel
#

when i know u can code n help

#

(no hard feelings tho)

vale wing
#

@slate swan what version of lib are you using

#

Python bot' automatic github code fetching from link is pretty nice

honest vessel
#

it shows a group a streamers that are live and shows in status how many of db are live atm of how many is in db

#

like 6 / 126 is now live.

vale wing
#

Print discord.__version__

manic wing
#

whats yours?

slate swan
#

Well this is my requirements.txt

discord
requests
random
time
os
json
honest vessel
vale wing
#

Pretty sure Intents.message_content is only available in alpha

slate swan
#

Why aren't intents default anymore

#

so annoying

manic wing
#

are there any features you wish discord.py implemented?

vale wing
manic wing
slate swan
vale wing
#

Convert 5h2m to timedelta for example

vale wing
#

You need alpha version to use that intent

#

Check pins for instructions of how to install

slate swan
#

I think enabling all intents works for now

#

If I find a problem then I will do that

vale wing
vestal pine
#

I think I have done something horrible

vale wing
#

But yeah by the time the intent becomes privileged the stable release will have that implemented so doesn't really matter

slate swan
manic wing
vestal pine
#
import discord
from discord.ext import commands
import json
import os
TOKEN = 'token hidden'
PREFIX = ['.cl ', '.clan ', 'kyn', 'Kyn']
INTENTS = discord.Intents.default()
client = commands.Bot(command_prefix=PREFIX)


@client.event
async def on_ready():
    print(f'Logged in as: {client.user.name}')
    print(f'With ID: {client.user.id}')


@client.command()
async def info(ctx):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    donate_amt= users[str(user.id)]["donated"]

    donated = users[str(ctx.author.id)]["donated"]
    donations= discord.embed(title="Your Donations till now are", color=discord.Color.red)
    donations.add_field(name="Amount", value= donated)
    await ctx.send(donated)

async def register(user):

    users= await get_date()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)]["donated"] = 0
    with open("database.json","w") as f:
       json.dump(users, f)
    return True

async def get_date():
    with open("database.json","r") as f:
        users= json.load(f)
    return users

@client.command()
async def donate(ctx, don):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    saved= don
    embed= discord.embed(title=f"{user.name} has donated")
    embed.add_field(name= f"Donations amount: {don}")
    users[str(user.id)]["donated"]+=don


    if don >1000000 or don==1000000: 
        
            await ctx.send(f'lmao why are you so rich my friend, you have successfully donated {don}!')

    else:
            await ctx.send(f'You have successfully donated {don}!')
    

client.run(TOKEN)```


error:

Ignoring exception in command donate:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Startklar\Desktop\Oni clan\main.py", line 48, in donate
await register(ctx.author)
File "c:\Users\Startklar\Desktop\Oni clan\main.py", line 36, in register
users[str(user.id)]["donated"] = 0
KeyError: '811190019528196156'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: '811190019528196156'

vale wing
#

database.json cursed

unreal sierra
#

lmfao

vestal pine
#

what do you mean?

slate swan
slate swan
vale wing
slate swan
vestal pine
vale wing
#

This code executes in case user.id is not in users

vestal pine
#

oh

#

error 😒 :

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Startklar\Desktop\Oni clan\main.py", line 54, in donate
    users[str(user.id)]["donated"]+=don
TypeError: unsupported operand type(s) for +=: 'int' and 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unsupported operand type(s) for +=: 'int' and 'str'
foggy rain
#

Hi

vestal pine
#
import discord
from discord.ext import commands
import json
import os
TOKEN = ''
PREFIX = ['.cl ', '.clan ', 'kyn ', 'Kyn ']
INTENTS = discord.Intents.default()
client = commands.Bot(command_prefix=PREFIX)


@client.event
async def on_ready():
    print(f'Logged in as: {client.user.name}')
    print(f'With ID: {client.user.id}')


@client.command()
async def info(ctx):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    donate_amt= users[str(user.id)]["donated"]

    donated = users[str(ctx.author.id)]["donated"]
    donations= discord.Embed(title="Your Donations till now are", color=discord.Color.red)
    donations.add_field(name="Amount", value= donated)
    await ctx.send(donated)

async def register(user):

    users= await get_date()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)] = {"donated": 0}
    with open("database.json","w") as f:
       json.dump(users, f)  
    return True

async def get_date():
    with open("database.json","r") as f:
        users= json.load(f)
    return users

@client.command()
async def donate(ctx, don):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    saved= don
    embed= discord.Embed(title=f"{user.name} has donated")
    embed.add_field(name="Donations amount: ", value=don)
    users[str(user.id)]["donated"]+=don


    if don >1000000 or don==1000000: 
        
            await ctx.send(f'lmao why are you so rich my friend, you have successfully donated {don}!')

    else:
            await ctx.send(f'You have successfully donated {don}!')
    








client.run(TOKEN)```
foggy rain
#

I wanna create my private discord bot. Please guide me.

final iron
dusk girder
#

wait was I supposed to do @client.command with parentheses?
ig that's why it didn't work, don't remember tho lol

foggy rain
honest shoal
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

foggy rain
vestal pine
#

like that

honest shoal
left crater
#
print("yo")```like this?
vestal pine
#
print("hello world")
foggy rain
vestal pine
honest shoal
dusk girder
#

personal chat
do you mean dms?

vestal pine
#

ig so

dusk girder
#

it's the exact same as on a server

honest shoal
vestal pine
#

atleast it worked

vestal pine
final iron
sly hamlet
#
class Counter(discord.ui.View):

    @discord.ui.button(label='Close Ticket', style=discord.ButtonStyle.red)
    async def count(self, ctx, button: discord.ui.Button, interaction: discord.Interaction):
        with open('data.json') as f:
            data = json.load(f)
        if ctx.channel.id in data["ticket-channel-ids"]:
            channel_id = ctx.channel.id
            def check(message):
                return message.author == ctx.author and message.channel == ctx.channel and message.content.lower() == "close"
            try:
                em = discord.Embed(title="", description="Are you sure you want to close this ticket? Reply with `close` if you are sure.", color=0x000080)
                await interaction.response.send_message(embed=em)
                await bot.wait_for('message', check=check, timeout=60)
                await ctx.channel.delete()
                with open("data.json") as f:
                    data = json.load(f)
                ticket_number = int(data["ticket-counter"])
                channel = bot.get_channel(793569113708036106)
                color = discord.Color.red()
                em = discord.Embed(color=color, description=(f"{ctx.message.author} closed a ticket\n **Ticket #**\n {ticket_number}"))
                await interaction.response.send_message(embed=em)
                index = data["ticket-channel-ids"].index(channel_id)
                del data["ticket-channel-ids"][index]
                with open('data.json', 'w') as f:
                    json.dump(data, f)
            except asyncio.TimeoutError:
                em = discord.Embed(title="", description="You have run out of time to close this ticket. Please run the command again.", color=0x000080)
                


#
Ignoring exception in view <Counter timeout=180.0 children=1> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Close Ticket' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ui\view.py", line 373, in _scheduled_task
    await item.callback(interaction)
TypeError: count() missing 1 required positional argument: 'interaction'```
honest shoal
#

πŸ—Ώ

dusk girder
#

bruh

halcyon sparrow
#

I heard discord .py is back?

vestal pine
#

what should I use then?

honest shoal
dusk girder
halcyon sparrow
#

convert the integer to string

vestal pine
final iron
sage otter
#

You have to re-cast tho

hoary cargo
#

MR_canny_12 bring the json db

sage otter
#

list(reversed(listobj))

patent sequoia
#

Can anyone tell me how to configure a bot to delete messages in a discord channel after a certain time of sending?

left crater
#

you can use asyncio.sleep

vale wing
#

send(..., delete_after=5)

left crater
#

or that ye

patent sequoia
#

Hmmm, i'll try it, thanks

#

Wait, but what I mean is deleting other people's messages, not the bot itself

sage otter
#

Make a task

slate swan
#
    @commands.command(
        name="test",
        description="Setup the review system.",
    )
    async def test(self, ctx: Context, member: disnake.Member, *, rating : int = 0):
        async with aiosqlite.connect("ratings.db") as db:
            async with db.cursor() as cursor:
                await cursor.execute("SELECT userId FROM users WHERE guildId = ?", (ctx.guild.id,))
                data = await cursor.fetchone()
                if data:
                    await cursor.execute("UPDATE users SET userId = ? WHERE guild = ?", (member.id, ctx.guild.id))
                else:
                    await cursor.execute("INSERT INTO users (guildId, userId, ratingStars) VALUES (?, ?, ?)", (ctx.guild.id, member.id, rating))
            await db.commit()

This is my command, but nothing shows up in the database

#

also no errors

vale wing
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
patent sequoia
sage otter
#

That’s not gonna work

#

How are you gonna edit a message that’s not yours.

vale wing
#

Only with delete_after you can

#

Try it yourself

#

However if you provide any other params you are gonna get http exception

sage otter
#

Odd

#

That’s cool ig

patent sequoia
#

It worked perfectly as I wanted. Thank you to everyone who helped.

vestal pine
#

hi its me again

junior verge
#
import discord
from discord.ext import commands
from datetime import datetime

class Help(commands.Cog):
    def __init__(self, client):
        self.client = client

    @commands.command()
    async def help(self, ctx):
        embed=discord.Embed(title=f'Help Menu', timestamp=datetime.datetime.utcnow())
        for command in self.client.walk_commands():
            description = command.description
            if not description or description is None or description == "":
            description = 'No description Provided'
            embed.add_field(name=f"`.{command.name}{command.signature if command.signature is not None else ''}`", value=description)
        await ctx.send(embed=embed)

def setup(client):
    client.add_cog(Help(client))
``` How do I get this fixed?
vestal pine
#
Ignoring exception in command info:
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Startklar\Desktop\Oni clan\main.py", line 24, in info
    donated = users[int(ctx.author.id)]["donated"]
KeyError: 811190019528196156

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 811190019528196156```
this is the error and this is the code

```py
import discord
from discord.ext import commands
import json
import os
TOKEN = 'hidden token'
PREFIX = ['.cl ', '.clan ', 'kyn ', 'Kyn ']
INTENTS = discord.Intents.default()
client = commands.Bot(command_prefix=PREFIX)


@client.event
async def on_ready():
    print(f'Logged in as: {client.user.name}')
    print(f'With ID: {client.user.id}')


@client.command()
async def info(ctx):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    donate_amt= users[str(user.id)]["donated"]

    donated = users[int(ctx.author.id)]["donated"]
    donations= discord.Embed(title="Your Donations till now are", color=discord.Color.red)
    donations.add_field(name="Amount", value= donated)
    await ctx.send(donated)

async def register(user):

    users= await get_date()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)] = {"donated": 0}
    with open("database.json","w") as f:
       json.dump(users, f)  
    return True

async def get_date():
    with open("database.json","r") as f:
        users= json.load(f)
    return users

@client.command()
async def donate(ctx, *don):
    await register(ctx.author)
    users= await get_date()
    user= ctx.author
    saved= str(don)
    embed= discord.Embed(title=f"{user.name} has donated")
    embed.add_field(name="Donations amount: ", value=don)
    users[int(user.id)]["donated"]+=don


    if don >1000000 or don==1000000: 
        
            await ctx.send(f'lmao why are you so rich my friend, you have successfully donated {don}!')

    else:
            await ctx.send(f'You have successfully donated {don}!')
    



client.run(TOKEN)```
junior verge
#

Good answer

junior verge
vestal pine
#

cuz u dont need a descreption

junior verge
#

lemme try

vestal pine
#

ok

vague arrow
#

Will discord bots using discord.py stop working after April 30th?

vestal pine
#

no

vestal pine
dense vortex
#

why would it stop working

vestal pine
#

it was going to stop cuz of the slash commands thing

dense vortex
#

it better not stop lol i only know how to use python

vestal pine
#

there are many other libraries

#

like nextcord or pycord

#

and they are in python too

dense vortex
#

o

vestal pine
#

there is aslo disnake

slate swan
junior verge
#

ye just a tab

vestal pine
slate swan
slate swan
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | KeyError: 'secondkey'
vague arrow
slate swan
dusk karma
#

For some reason, after ive edited my code and changed the prefix, the bot just ignores the changes like i never made them

#

The prefix.

slate swan
#

did you restarted your bot?

dense vortex
#

did u close the terminal and save it and then run the code again

dusk karma
#

Yeah, the bot is hosted on Heroku Github. Does it have anything to do with that?

slate swan
#

yes its hosting the old code of your bot

dusk karma
#

But github has the new code?

slate swan
#

you need to update it with your current code so it will run your bot with the new changes

dusk karma
#

My github has my new code.

slate swan
#

seems like its still running the old code

dense vortex
#

maybe u need to remove the space between = ''

#

but idk lol

slate swan
#

that wouldnt matter

dense vortex
#

hey i just try whatever man

dusk karma
slate swan
dense vortex
vague arrow
dusk karma
dense vortex
#

lol

slate swan
slate swan
dense vortex
#

chill lol

slate swan
dusk karma
#

Restarting heroku dynos and re-deploying

#

Is there maybe a VS Code plugin where i can edit my code from Github live or update from VS?

vague arrow
dusk karma
#

still taking old code 😐 you can see its updated

slate swan
#

thats weird its still running for some what reason

vale wing
#

Add __pycache__ to .gitignore btw

slate swan
#

why exactly?

dusk karma
#

what?

vale wing
#

The token um

slate swan
#

isnt pycache for like caching logs or something related to runtime

dusk karma
slate swan
#

reset it

dusk karma
#

As you can see, im a dumbass.

vale wing
slate swan
slate swan
sage otter
#

It’s generated at compile time

slate swan
#

ah so it caches bytes

slate swan
slate swan
dusk karma
slate swan
dusk karma
#

I don't know anything about Github, I just followed a tutorial.

vale wing
dusk karma
sage otter
#

Implement pycache??????

dusk karma
#

add it

slate swan
sage otter
#

that’s what you meant

#

You don’t really need to by any circumstances.

#

But it prevents clutter ig

slate swan
#

؟؟

vale wing
slate swan
#

anyone knowp why this happens when i run?

File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1007, in new
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
exit status 1

#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1007, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

thats what ahppened when i pip installed discord.py

slate swan
manic wing
#

run pip uninstall python

slate swan
#

I did exactly that

manic wing
slate swan
#
raceback (most recent call last):
  File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1007, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
#

is something wrong in requirements.txt?

vale wing
#

@manic wing btw what's wrong with pip install discord

slate swan
#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/typing.py", line 1007, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
manic wing
#

!pypi discord

unkempt canyonBOT
vale wing
#

So basically it redirects to discord.py right?

manic wing
#

sort of but it gets updated less often and isn’t the real deal

vale wing
#

Ok

manic wing
slate swan
#

yp

#

doesanyone know how to get the name of command in like a command error handler?

slate swan
#

tysm

#

fast and ez

manic wing
unkempt canyonBOT
slate swan
#

what about command aliaes?

manic wing
#

ctx.command.aliases

slate swan
#

W

manic wing
#

returns a list of str

slate swan
#

so

#

{str(ctx.command.aliases)}

manic wing
#

or you can use str.join(list)

slate swan
#

oki

manic wing
#

!d str.join

unkempt canyonBOT
#

str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
manic wing
#

!e x = ["a", "b", "c"]
print(",".join(x))

unkempt canyonBOT
#

@manic wing :white_check_mark: Your eval job has completed with return code 0.

a,b,c
austere herald
slate swan
#

i like tha format

lime trench
#

Hello, im trying to make the bot get a certain message, it can get messages sent by a user, but not by itself when the message is a embed. How could i get it?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10008): Unknown Message
msg = await ctx.fetch_message(message)
I don’t want to make another param just for the channel if I were to use partial message either

cold sonnet
#

ctx.channel.fetch_message

#

hope message is an id

sly hamlet
#

what can i do to get the author name when my button is presed py color = discord.Color.red() em = discord.Embed(color=color, description=(f" closed a ticket\n **Ticket #**\n {ticket_number}")) await channel.send(embed=em)

modest plover
#

inter.author probably

lime trench
sly hamlet
modest plover
#

try it ig

formal basin
#

I can’t buy anything

modest plover
#

havent done much with buttons

modest plover
formal basin
#

Ok

formal basin
# modest plover send the code, screenshots dont load

@client.command()
async def buy(ctx,item,amount = 1):
await open_account(ctx.author)

res = await buy_this(ctx.author,item,amount)

if not res[0]:
    if res[1]==1:
        await ctx.send("That Object isn't there!")
        return
    if res[1]==2:
        await ctx.send(f"You don't have enough money in your wallet to buy {amount} {item}")
        return


await ctx.send(f"You just bought {amount} {item}")
sly hamlet
formal basin
# modest plover send the code, screenshots dont load

@client.command()
async def buy(ctx,item,amount = 1):
await open_account(ctx.author)

res = await buy_this(ctx.author,item,amount)

if not res[0]:
    if res[1]==1:
        await ctx.send("That Object isn't there!")
        return
    if res[1]==2:
        await ctx.send(f"You don't have enough money in your wallet to buy {amount} {item}")
        return


await ctx.send(f"You just bought {amount} {item}")
lime trench
#

same error

left crater
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

cold sonnet
#

perhaps there's just no message with that id in that channel

vale sierra
#

hello, what is the pip install for the discord activities ?

formal basin
#

@client.command()
async def buy(ctx,item,amount = 1):
await open_account(ctx.author)

res = await buy_this(ctx.author,item,amount)

if not res[0]:
    if res[1]==1:
        await ctx.send("That Object isn't there!")
        return
    if res[1]==2:
        await ctx.send(f"You don't have enough money in your wallet to buy {amount} {item}")
        return


await ctx.send(f"You just bought {amount} {item}")
formal basin
dusk karma
#

Update: the bot doesnt work at all. :/

vestal pine
#

hi

#

I am having this keyerror about 2 hrs ago

#

but I couldnt solve it

#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Startklar\Desktop\Oni clan\main.py", line 22, in info
    donations_amt= users[str(user.id)]["gold"]
KeyError: '811190019528196156'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke      
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke     
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped     
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: '811190019528196156'```
#
import discord
from discord.ext import commands
import json
import os
TOKEN = 'token hidden'
PREFIX = ['.cl ', '.clan ', 'kyn ', 'Kyn ']
INTENTS = discord.Intents.default()
client = commands.Bot(command_prefix=PREFIX)


@client.event
async def on_ready():
    print(f'Logged in as: {client.user.name}')
    print(f'With ID: {client.user.id}')

@client.command()
async def info(ctx): 
    user= ctx.author
    await open_account(ctx.author)
    users= await get_bank_date()

    donations_amt= users[str(user.id)]["gold"]

    em= discord.Embed(title= f"{ctx.author.name}'s donatiosn amount ", color= discord.Color.red())
    em.add_field(name="the amount you have donated: ", value= donations_amt)
    await ctx.send (embed=em)

@client.command()
async def donate(ctx, **don):
    await open_account(ctx.author)

    users= await get_bank_date()
    user= ctx.author

    donated= don

    await ctx.send (f"you have donated {donated} succesfully! ")




    users[str(user.id)]["gold"] += donated
    with open("database.json", "w") as f:
        json.dump(users, f)


async def open_account(user): 
    users= await get_bank_date()

    if str(user.id) in users:
        return False
    else:
        users[str(user.id)]= {}
        users[str(user.id)]["gold"] = 0
        return

    with open("database.json", "w") as f:
        json.dump(users, f)
    return True

async def get_bank_date():
    with open("database.json", "r") as f:
        users= json.load(f)
    return users

client.run(TOKEN)```
vague arrow
vestal pine
vague arrow
#

So just make sure they open account before you donate to them essentially

vestal pine
#

thats what I was trying to do

#

like it should check if they have a account opened before or not

#

if yes then it should go to next

#

if not i t should create one for them

slate swan
#

how i can make spolier at webhook from dhooks ?

patent sequoia
#

I am trying to run this but it is not prompting on the server. In the code it says there is an inconsistency in this part, does anyone know what it could be?

slate swan
#

yo

#

how do i dm ctx.author

#

is it like await ctx.author.send

left crater
#

Yeah

slate swan
#

tysm<3

loud flare
#

I've a problem

slim ibex
loud flare
#

I got the error :
SyntaxError: Non-UTF-8 code starting with '\xfe' in file C:\...\zoumoubot.py on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details

patent sequoia
loud flare
#

And it should be a problem of encoding, but all the characters of my script are UTF-8 and I don't manage to run my bot

slim ibex
#

name it one word

loud flare
#

Also, it has been working thirty minutes ago and I've made no major change

#

And it doesn't work whether I put "# -- coding: utf-8 --" or not

outer parcel
#

Guys there is something weird happening in my code for some time it the buttons work but suddenly it always says no module discord.ui found

sick birch
#

What version is your d.py?

outer parcel
#

Let me check

#

1.7.3

patent sequoia
# slim ibex name it one word

I changed it to a single word name as well, but when I run the bot it is not sending the message on the discord channel. No error appears in the console, but it doesn't work either...

sick birch
#

Yeah you need to be on 2.0.0

outer parcel
#

how can i update

torn sail
outer parcel
#

just erros appear in console

#

whenever i type it and download it

dapper cobalt
outer parcel
#

?

dapper cobalt
outer parcel
#

ok

#
  ERROR: Command errored out with exit status 1:
   command: /home/runner/Tuition/venv/bin/python3 /tmp/pip-standalone-pip-xtbszjnk/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-jzks134z/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://package-proxy.replit.com/pypi/simple/ -- setuptools wheel
       cwd: None
  Complete output (1 lines):
  /home/runner/Tuition/venv/bin/python3: can't find '__main__' module in '/tmp/pip-standalone-pip-xtbszjnk/__env_pip__.zip/pip'
  ----------------------------------------
WARNING: Discarding git+https://github.com/Rapptz/discord.py#egg=discord.py. Command errored out with exit status 1: /home/runner/Tuition/venv/bin/python3 /tmp/pip-standalone-pip-xtbszjnk/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-jzks134z/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://package-proxy.replit.com/pypi/simple/ -- setuptools wheel Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement discord-py (unavailable) (from versions: 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.16.5, 0.16.6, 0.16.7, 0.16.8, 0.16.9, 0.16.10, 0.16.11, 0.16.12, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.7.2, 1.7.3)
ERROR: No matching distribution found for discord-py (unavailable)
#

error it seems it can only get 1.7.3

torn sail
patent sequoia
#

I looked for the error in my code but could not find it. It runs normally, but is not responding in discord. I already gave the necessary permissions to the bot in the room but it doesn't send the message in the welcome channel...

torn sail
#

It will work

outer parcel
#

It never worked

#

it only finds 1.7.3 as latest version

sick birch
outer parcel
#

wdym

dapper cobalt
#

!d discord.Client.get_channel

unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
outer parcel
manic wing
#

are there any features you wish dpy/your fork implemented?

outer parcel
#

me?

manic wing
#

anyone

outer parcel
#

all i want is discord.ui, before it was working perfectly but it suddenly gave the error

#

that no module called discord.ui

torn sail
wicked atlas
sick birch
wicked atlas
#

you need to install it directly from the repository

#

To install the development version, do the following:

$ git clone https://github.com/Rapptz/discord.py
$ cd discord.py
$ python3 -m pip install -U .[voice]```
buoyant igloo
torn sail
#

channel.send needs to be awaited

slim ibex
#

^

patent sequoia
#

Oh, fact

slim ibex
#

idk why you removed await

patent sequoia
patent sequoia
cursive barn
#

looks okay, I would look into using discord.ext.commands.Bot instead of discord.Client solely for additional built in support features.

patent sequoia
#

Ok πŸ™‚

hardy yoke
cursive barn
# patent sequoia Ok πŸ™‚

also your print statements indicate that your are messaging the user and the channel, but your code only ever messages the channel. you may want to consider adding that function by way of member.send as discord.Member is a subclass of discord.abc.Messageable

buoyant igloo
#

2.0

cursive barn
sick birch
silent ermine
sick birch
#

if you're using replit to circumvent the ratelimit that's against the terms of service

#

If you're getting ratelimited it's for a reason and you should respect that

silent ermine
sick birch
#

I haven't used the forks. If this is about base d.py slash commands I could help

silent ermine
sick birch
#

Not sure about that. Haven't used the other forks so I can't be the judge of that

brisk orbit
#

p sure yea

sick birch
silent ermine
#

kk

flat solstice
#

Okay so I updated to latest d.py a about 10 mins ago and now I can't start my bot, getting this errorpy File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\aiohttp\helpers.py", line 284, in get_running_loop if not loop.is_running(): File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\client.py", line 111, in __getattr__ raise AttributeError(msg) AttributeError: ('loop attribute cannot be accessed in non-async contexts. ', 'Consider using either an asynchronous main function and passing it to asyncio.run or ', 'using asynchronous initialisation hooks such as Client.setup_hook') File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\client.py", line 111, in __getattr__ raise AttributeError(msg) AttributeError: ('loop attribute cannot be accessed in non-async contexts. ', 'Consider using either an asynchronous main function and passing it to asyncio.run or ', 'using asynchronous initialisation hooks such as Client.setup_hook') Exception ignored in: <function ClientSession.__del__ at 0x000001D938C3C820> Traceback (most recent call last): File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\aiohttp\client.py", line 326, in __del__ if not self.closed: File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\aiohttp\client.py", line 963, in closed return self._connector is None or self._connector.closed AttributeError: 'ClientSession' object has no attribute '_connector'which I assume to be related to the asycio changes. This is my full code, I felt sharing the repo made more sense than lots of code blocks or online sites https://github.com/SnowyJaguar1034/Zupie

buoyant igloo
#

I haven’t checked ur code and I can already tell that it is because the loop or sumthing is out of an async function. (Idk if im right, im too lazy to check)

slate swan
#

is there a way to use get_bucket with slash commands?

#

@sick birch sorry for ping idk

dense vortex
#

Can someone help me? This is my error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Games' object has no attribute 'random'

dense vortex
#

omg ty lol. i been trying to figure it out for a bit now and everyone i asked advice from said something wrong and ur the first one of like 5 people to actually be usefull lol

dense vortex
#

they all said stuff like remove import random. idk why

slate swan
sick birch
sick birch
slate swan
#

I want to make a command which sends random embed responses. I have searched it a lot but i didn't find anything

modest plover
slate swan
#

wait because it said something about str in the error

modest plover
#

What's the error?

slate swan
#

'str' object has no attribute 'to_dict'

buoyant igloo
slate swan
#

Does anyone here have replit?

buoyant igloo
#

Me

slate swan
#

I could send an invite link

#

In dms

buoyant igloo
slate swan
#

True

buoyant igloo
#

It’s prob not needed

slate swan
#

await ctx.send(embed=random.choice(mouse10))

modest plover
#

Show the mouse10 list?

slate swan
#

Ok wait

buoyant igloo
#

u should make the random.choice a variable (just a suggestion)

modest plover
#

Because I think it's taking the random choice as 'value' rather than value

slate swan
#

mouse10=['zero', 'sharkoon']

modest plover
#

Possibly, I haven't touched random too much

compact sky
#

how can i make it so that my bot is always running, even when im offline and closed the tab? i tried connecting it to a flask web server and then used an uptimerobot monitor to ping the bot every 5 minutes, it works but sometimes the bot just goes offline still, and i have no clue how

buoyant igloo
#

Before the list

slate swan
buoyant igloo
buoyant igloo
slate swan
#

It says undefined name

buoyant igloo
#

Define zero and sharktoon

#

Before the list

slate swan
#

Wait

slate swan
#

I think it's ok

buoyant igloo
# compact sky how

Because that’s how it is, even if u have a $1000 uptime robot of some sort or if u talking about database use SQLITE

#

Bruh

slate swan
#

It worked but it always sends the one embed

buoyant igloo
#

Send replit

slate swan
#

Ok wait

buoyant igloo
#

Or just the code

cyan hare
buoyant igloo
cyan hare
#

in dms or

stone beacon
buoyant igloo
#

U can send it here

cyan hare
#

okay i send it here

slate swan
compact sky
#

never done it before

buoyant igloo
quaint epoch
#

yo

#

anyone there

modest plover
supple thorn
modest plover
#

That's what I'm thinking

quaint epoch
supple thorn
#

i've been literally thinking what is this conversation for the past 5 minutes

slate swan
#

you cant host a bot in a db bruh

quaint epoch
supple thorn
#

you can't

quaint epoch
#

a database stores info for your bot, infractions, messages, bans

flat solstice
#

Anybody got any suggestions/tips on when/where i should use @before_invoke() and @after_invoke()? I'm not sure when I should use them before I'm not sure if I need to use them. I se d.py's docs say they are useful for closing db connections when they are no longer needed but I'm not sure where else they can be useful

quaint epoch
#

a hosting platform is what makes your bot online

#

!d disnake.ext.commands.Bot.before_invoke

unkempt canyonBOT
#

@before_invoke```
A decorator that registers a coroutine as a pre-invoke hook.

This is for text commands only, and doesn’t apply to application commands.

A pre-invoke hook is called directly before the command is called. This makes it a useful function to set up database connections or any type of set up required.

This pre-invoke hook takes a sole parameter, a [`Context`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Context "disnake.ext.commands.Context").

Note

The [`before_invoke()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot.before_invoke "disnake.ext.commands.Bot.before_invoke") and [`after_invoke()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot.after_invoke "disnake.ext.commands.Bot.after_invoke") hooks are only called if all checks and argument parsing procedures pass without error. If any check or argument parsing procedures fail then the hooks are not called.
slate swan
buoyant igloo
quaint epoch
#

!d disnake.ext.commands.Bot.after_invoke

unkempt canyonBOT
#

@after_invoke```
A decorator that registers a coroutine as a post-invoke hook.

This is for text commands only, and doesn’t apply to application commands.

A post-invoke hook is called directly after the command is called. This makes it a useful function to clean-up database connections or any type of clean up required.

This post-invoke hook takes a sole parameter, a [`Context`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Context "disnake.ext.commands.Context").

Note

Similar to [`before_invoke()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot.before_invoke "disnake.ext.commands.Bot.before_invoke"), this is not called unless checks and argument parsing procedures succeed. This hook is, however, **always** called regardless of the internal command callback raising an error (i.e. [`CommandInvokeError`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.CommandInvokeError "disnake.ext.commands.CommandInvokeError")). This makes it ideal for clean-up scenarios.
quaint epoch
patent sequoia
buoyant igloo
quaint epoch
#

well, if you want data to be temporary like sniped messages or the sort, dtbases aren't necessary, you can just store it in a dict

supple thorn
buoyant igloo
supple thorn
#

πŸ—Ώ

buoyant igloo
#

Yeah

quaint epoch
#

oh yeah

compact sky
#

another question, is there a fancier way of making commands than if message.content.startswith(command) that most people use?

quaint epoch
#

you can store messages from previous sessions in a database

#

i forgot that

slate swan
compact sky
quaint epoch
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
quaint epoch
#

this represents a bot

slate swan
#

the heck

patent sequoia
#

Is there an error in the code that is preventing it from working correctly? My discord bot isn't sending messages, but the console doesn't show any errors. I already checked the bot permissions and everything is fine.

quaint epoch
#

triple m's

slate swan
#

oops

#

does this look fine to u @slate swan ```py
per = 0
def is_premium():
async def check(ctx):
array = cl.find_one({"_id" : 849658396675276841})['list']
global per
if ctx.guild.id in array:
per = 1800
return per
else:
per = 3600
return per
return commands.check(predicate = check)

@client.command()
@is_premium()
@commands.cooldown(1, per, commands.BucketType.guild)
async def test(ctx):
await ctx.send("L")```

quaint epoch
#

!d disnake.Client.get_channel

unkempt canyonBOT
quaint epoch
#

is that channel id a text channel?

patent sequoia
#

Yep

quaint epoch
#

maybe instead of sending a message in a channel, do await member.send('Welcome!')

#

since if "Welcome" is just spammed in that channel by a bot

patent sequoia
#

The first def is working well

quaint epoch
#

it wouldn't look very nice

patent sequoia
flat solstice
quaint epoch
#

never had the need to

patent sequoia
flat solstice
#

yeah i'm in the same boat, then again never haven't used it I don't know if maybe I should have used it and just didn't

patent sequoia
quaint epoch
#

use a bot, not a client

raven pewter
#
    if file.endswith(".py"):
        name = file[:-3]
        bot.load_extension(f"cogs.{name}")```
 Is their a new way to write this in v2.0.0a
patent sequoia
stone beacon
#

No, it's an integer

#

Hence "id"

#

Id can be for any type of channel whether text or voice and etc..

slate swan
#

am i smart for this or dumb lmao ```py
def is_premium(ctx):
array = [864528215036002314]

print(ctx.guild.id)
if ctx.guild.id in array:
  return True
else:
    return False

@client.command()
@commands.cooldown(1, f'{3600 if is_premium is False else 1800}', commands.BucketType.guild)
async def test(ctx):
print(is_premium)
await ctx.send("d")```

flat solstice
#

anyone know how to add d.py 2.0 app_commands to my main.py file, my bot var has a command tree automatically registered so I don't need to declare one (in fact I get a warning if I try to declare a second) however I get a warning that tree is not defined when I try to dopy @tree.command() @app_commands.guilds(discord.Object(id=default_guild)) async def tree(interaction: discord.Interaction): await bot.tree.sync(guild=discord.Object(id=interaction.guild_id)) await interaction.response.send_message(f'Synced the tree.', ephemeral=True)and if I do @bot.tree.command I get another warning about making duplicate command tree's

buoyant igloo
flat solstice
buoyant igloo
#

Oh

dense vortex
#

made a topic generator

#

lol

silent ermine
dense vortex
slate swan
final iron
#

Send the full traceback

quick gust
#

i think u need to turn it to an int

slate swan
#

the color has to be an int

quick gust
#

for the color= field

slate swan
#

a hex base which is a int

#

!e print(type(0x000000))

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

<class 'int'>
slate swan
#

just type hint hexcode to an int

quick gust
#

no, then u also have to remove the double quotes from 0x

#

:int

#

not =

tacit storm
#

πŸ’€

final iron
#

Type hint it, don't assign it

slate swan
#

shouldnt you typehint a hexcode as discord.Color..

#

no?

pliant gulch
#

Why not typehint it as discord.Colour? It calls the Colour converter which accepts hexcode & rgb

slate swan
slate swan
slate swan
#

lucky ou have andy to cover yourooFight

reef trail
#

can anyone help me with starting my bot, since dpy updated there was a lot of breaking changes and i dont understand how the docs want me to start my bot since the exmaple they gave was never how i was doing it to begin with lol
here is how im currently doing it https://paste.pythondiscord.com/iqaromuwiv

slate swan
#

What do you mean?

#

It's the time_zone.name and asn lines that are giving the error

#

Otherwise the code works perfectly

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
sick birch
#

Seems kind of fishy

slate swan
slate swan
sick birch
#

A multipurpose bot with IP geolocation features?

slate swan
sick birch
#

Right, but that specific part is bordering on rule 5

slate swan
#

!rule 5

unkempt canyonBOT
#

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

slate swan
#

yeah well it isn't breaking any laws or breaching terms

#

because it's getting access from online information

#

It's already public, which doesn't make it illegal

sick birch
#

How are you getting access to someone's IP?

slate swan
#

Who says I'm getting someone's ip?

slate swan
#
async def uwuip(ctx, ip=None)```
sick birch
slate swan
#

Yeah it does, but an ip can also be found online, which in that case, makes it public

#

If you ping google.com it'll give you an IP, which makes it public information, which doesn't break the law etc

sick birch
#

Yes their DNS points to that record but I'm concerned about its uses with actual users

slate swan
#

but discord does not allow that

#

how would you even get their IP

#

Of google?

sick birch
#

I think we should err on the side of safety and not assist you with this project. We cannot be 100% sure of the intentions behind this IP geolocation feature

slate swan
#

google.com's ip that it's letting you ping is 142.250.179.142

slate swan
#

Which is accessible to the public

#

that gets your IP ( from.which request was made ), not the user's

sick birch
#

Yes we know, that's what their DNS records point to. I'm talking about the potential uses for actual users

slate swan
#

Yeah well, even then if it's being used on users, it still won't give any other information out then the geolocation

#

So no harm done there

slate swan
#

for instance if i take my proxy ip, it'll just give me general information

#

there's a reason why im not including alot of information in the codeblock

#

i'd rather use the api that im using rn because i've had a subscription to it for a while now

#

and i can put to use via this way

#

so thank you, but no thank you

slate swan
#

because i have $ to waste?

#

cool