#discord-bots

1 messages · Page 1004 of 1

minor totem
#

Do you have two command decorators?

tired hinge
#

check if you have multiple @bot.command() in your code.

#

gosh these dudes are annoying

minor totem
#

They can enjoy their pings hysteria

pulsar thunder
#

How to make a bot recognize emojis like general emojis not server specific ones

supple thorn
supple thorn
#

Elaborate on recognize

pulsar thunder
#

Umm kinda?

#

Wait

supple thorn
#

That is an emoji

pulsar thunder
#

This is named yert and can be used to recognize as
if 'yert' in message.content

#

Same way for others

supple thorn
#

Just check if the emoji is in the message content then

#

\🗿

pulsar thunder
#

Don't get offended pls 🖕

#

This isn't working for middle_finger

supple thorn
#
if '🗿' in message.content:
    ...
pulsar thunder
#

Tried

#

Didn't work

supple thorn
#

Print the message.content

#

Whay does it say

pulsar thunder
#

It does print as the emoji

#

Not words

supple thorn
slate swan
#

you need to use the unicode form of the emoji

pulsar thunder
#

How

supple thorn
#

You're trying to find the emoji

slate swan
#

\🗿 \🖕

#

😳

#

these are unicodes

supple thorn
#

😔

slate swan
#

sarthak you mean little child

#

😡

#

😔 what did i do

pulsar thunder
#

I just typed the emoji in it didn't work

supple thorn
slate swan
pulsar thunder
#

K

slate swan
supple thorn
slate swan
slate swan
supple thorn
slate swan
#

ayo?

supple thorn
sterile hamlet
#

erm i came to ask a question is now a bad time?

slate swan
pulsar thunder
slate swan
slate swan
slate swan
sterile hamlet
pulsar thunder
slate swan
unkempt canyonBOT
#

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

works!
pulsar thunder
#

Works damn

#

Thnx

#

But does it also work for words?

slate swan
#

yes

#

yes, it works for any kind of string

#

its just checking if a string is in a string

sterile hamlet
#

alright don't flame me for my dumb question. How do i separate client.events so if i have multiple they don't intefere with eachother?

supple thorn
unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").

Example...
supple thorn
#

You ain't stealing this from me 😠

slate swan
#

🤨

pulsar thunder
#

How to use same output for multiple inputs in my code

supple thorn
slate swan
slate swan
sterile hamlet
# slate swan wdym by interfere?

like i'm using py if message.content.startswith(''): but because its empty it means any sort of message recieved by the bot does whatever my code tells it to. But i don't want it for every message only messages from users

slate swan
#

just check ids ig im not really sure what you refer to

supple thorn
#

Like what do you want

pulsar thunder
#

I want same reply for hi also , so do I have to type another if loop?

slate swan
#

oh

#

he ment his bot is detecting his own messages lol

supple thorn
slate swan
#

!d or

unkempt canyonBOT
#
or

6.11. Boolean operations


or_test  ::=  and_test | or_test "or" and_test
and_test ::=  not_test | and_test "and" not_test
not_test ::=  comparison | "not" not_test
``` In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: `False`, `None`, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true. User-defined objects can customize their truth value by providing a `__bool__()` method.

The operator [`not`](https://docs.python.org/3/reference/expressions.html#not) yields `True` if its argument is false, `False` otherwise.
supple thorn
#

!or

unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
supple thorn
slate swan
#

yep

#

😔 suggest some restful apis i can wrap

slate swan
pulsar thunder
#

So will [(hello,hi) in message ] work?

slate swan
upbeat gust
supple thorn
#

What

slate swan
#

!ot and lets not talk about it

slate swan
supple thorn
#

<@&831776746206265384>

#

No?

upbeat gust
supple thorn
#

Why here of all places

slate swan
#

this is a python server

#

bro

upbeat gust
#

🙄

slate swan
#

bro what?

hollow badger
#

!mute 841634873453051904 Investigating

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1650975007:f> (59 minutes and 59 seconds).

sterile hamlet
# supple thorn Like what do you want

essentially i'm using a twitter api to save data to a txt file, i then read that txt file into the bot and it posts to a channel, I'm tryna figure out why it won't read the file and post to a channel, so i thought it might be interfering events . this is my reading code ```py
@client.event
async def on_data(ctx):
with open('tweets.txt', 'r') as filehandler:
content = filehandler.readline()
await ctx.send('content')

slate swan
#

thanks

unkempt canyonBOT
#
Not likely.

Package could not be found.

slate swan
slate swan
supple thorn
#

Fuck

slate swan
#

How can I make a command that starts with a number?

sterile hamlet
slate swan
#

!pip tweepy

slate swan
unkempt canyonBOT
supple thorn
sterile hamlet
upbeat gust
supple thorn
slate swan
#

the deco has a name kwarg

unkempt canyonBOT
sterile hamlet
slate swan
#

thx

slate swan
supple thorn
sterile hamlet
slate swan
supple thorn
slate swan
slate swan
upbeat gust
#

Are you dispatching it

supple thorn
slate swan
#

Just use a random number between 100 and 1500 as your ms ping duh

supple thorn
#

I don't use twitter

slate swan
supple thorn
upbeat gust
#

when using the actual latency would be shorter code 💀

slate swan
#

No its not

supple thorn
# slate swan ofc

I'll dm you about it when i finish my wrapper and somehow get a developer account

slate swan
#

Random number is just random.randint(100, 1500).

supple thorn
supple thorn
#

To trick the users?

upbeat gust
slate swan
#

Not fixed latency,,

sterile hamlet
upbeat gust
slate swan
#

That is why random

sterile hamlet
slate swan
#

The best trick.

supple thorn
upbeat gust
slate swan
#

Whatever

#

Its just numbers, then why not just randomize then

#

No need to calculate actual real time latency.

supple thorn
upbeat gust
#

why is this a discussion anyway

supple thorn
#

He made it a discussion

slate swan
#

Yes.

#

BTW, water tastes good.

#

Anyone else like water?

#

:exit:

maiden fable
unkempt canyonBOT
slate swan
#

mhmm

#

ok

supple thorn
slate swan
#

The number of ingredients?

#

the price, nutritional values etc

supple thorn
slate swan
#

Hmm

#

imagine discord returning random data

supple thorn
#

I forgot what that's called

slate swan
#

LOL 5 kg suger

#

Imagine

sterile hamlet
supple thorn
#

Lmao

slate swan
#

anyways, off topic

slate swan
slate swan
#

🗿

sterile hamlet
supple thorn
#

I haven't been banned yet you see

slate swan
#

😳

sterile hamlet
#

how do you get banned from a programming discord

supple thorn
slate swan
#

😏

supple thorn
upbeat gust
slate swan
#

something in return 😏

slate swan
#

🗿

#

caeden~

slate swan
slate swan
#

im joking ill do it for experience

#

😔 i mean i can fanboy your wrapper ez

#

🤨

unkempt canyonBOT
sterile hamlet
upbeat gust
slate swan
#

a command is a function and so is a event

#

🤨

#

or do you mean different functions?

upbeat gust
slate swan
upbeat gust
#

alright then

slate swan
#

only thing that changes is their behavior

#

when ever i trying to open a discord.py file i am getting a long list of error anytime before

paper sluice
#

what file? the source code?

slate swan
#

Traceback (most recent call last):
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 999, in _create_direct_connection
hosts = await asyncio.shield(host_resolved)
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 865, in _resolve_host
addrs = await self._resolver.resolve(host, port, family=self._family)
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\resolver.py", line 31, in resolve
infos = await self._loop.getaddrinfo(
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 855, in getaddrinfo
return await self.run_in_executor(
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed

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

slate swan
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
paper sluice
supple thorn
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.

paper sluice
#

hello coccaine

supple thorn
#

Or is your file legit corrupted

supple thorn
slate swan
slate swan
sterile hamlet
supple thorn
#

I mean

#

I'm implementing a cache in my wrapper but i can't recommend that

supple thorn
#

If you got questions ask @slate swan kek

#

Or just ask me

#

If he's off or something

slate swan
paper sluice
#

send the full error then

wraith pine
#

[errno 2] no such file or directory

how to fix?

slate swan
#

what's your code?

#

"no such file or directory"
any guess as to what the error means?

wraith pine
#

error when starting the bot

slate swan
#

-_-

wraith pine
#

I want to run it, but it gives an error

slate swan
#

can I see your code

#

!token

#

that's a discord token

unkempt canyonBOT
#

Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

boreal ravine
wraith pine
#

I already

slate swan
slate swan
sterile hamlet
supple thorn
unkempt canyonBOT
#

pokelance/cache.py lines 22 to 23

self._pokemon_cache_data: Dict[str, Any] = {}
self._sprites_cache_data: Dict[str, Union[str, Dict]] = {}```
slate swan
# slate swan https://paste.pythondiscord.com/ivehiyujeb
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 999, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 865, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\resolver.py", line 31, in resolve
    infos = await self._loop.getaddrinfo(
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 855, in getaddrinfo
    return await self.run_in_executor(
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed
supple thorn
#

Yeah just a normal dictionary

boreal ravine
slate swan
# slate swan https://paste.pythondiscord.com/ivehiyujeb
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 563, in connect
    self.ws = await asyncio.wait_for(coro, timeout=60.0)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 445, in wait_for
    return fut.result()
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\gateway.py", line 306, in from_client
    socket = await client.http.ws_connect(gateway)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 132, in ws_connect
    return await self.__session.ws_connect(url, **kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client.py", line 754, in _ws_connect
    resp = await self.request(
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\client.py", line 520, in _request
    conn = await self._connector.connect(
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\connector.py", line 1011, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host gateway.discord.gg:443 ssl:default [getaddrinfo failed]

During handling of the above exception, another exception occurred:```
supple thorn
#

We say cache cause cool

slate swan
#

no

#

i am getting this same error in all the discord files

#

we use it for less api calls

slate swan
#

😫 what should i do

boreal ravine
vale wing
slate swan
#

😳

vale wing
#

Use discord.ext.commands.Bot

slate swan
#

owo

#

🗿

vale wing
#

And create commands with @bot.command for non cog implementation

boreal ravine
slate swan
slate swan
vale wing
#

👁️ 👄 👁️

slate swan
#

😿

#

exenifix just described why

#

yeah pls

wraith pine
#

[errno 2] no such file or directory

how to fix?

my cod

slate swan
#

becaue i am very confused right now

#

client = discord.Client()

#

no

#

hah

#

dont use that lol

slate swan
sterile hamlet
slate swan
#

bro

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **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...
slate swan
#

a subclass

vale wing
slate swan
#

:)

slate swan
#

provide the functionality to manage commands...

vale wing
#

They should remove that "quickstart" guide from their docs

slate swan
vale wing
#

Make a pr some1

slate swan
#

yes exenifix, pls do :>

slate swan
#

yea

vale wing
#

Okbro

slate swan
#

:>

#

yeah, but call it a "bot" not client

#

variable naming🙀

#

💀 is it really a big issue? just asking :'/

#

yes

#

owo

slate swan
slate swan
slate swan
slate swan
#

they subclass it😈

slate swan
#

💀

slate swan
#

they pros😈 🙏

#

wait no thats not what i mean

#

i was talking about nicknames

vale wing
#

Nvm they are already doing something like that in #7654

slate swan
#

lol

vale wing
slate swan
#

hi cokecake :>

supple thorn
slate swan
#

yes

#

discordcpp

#

c != cpp

#

oh

supple thorn
#

I was confused for a sec

slate swan
#

he ment bare c and not cpp

vale wing
#

C isn't a programming language any longer 😉

supple thorn
#

On how you could use discordcpp with c

slate swan
#

cpp is better than c

vale wing
#

Yes

#

Also c# is good

slate swan
slate swan
supple thorn
vale wing
#

Tryna write discord bot on java you will get serious schizophrenia

supple thorn
#

Didn't work out when i had a panic attack using semicolons

slate swan
supple thorn
#

Yes i know

slate swan
#

i believe js and py are the most used languages for bot dev?

vale wing
#

Yes

supple thorn
#

That's why i'm a python dev

slate swan
vale wing
#

I remember how one guy made a bot with html (idk how but it worked)

#

Maybe he just put a script tag

slate swan
#

but that sounds hilarious lmao

#

other than that i've seen some people using serentiy rs

supple thorn
#

I'd like to learn cpp to have a language faster than python under my belt

slate swan
slate swan
slate swan
slate swan
vale wing
#

I know c# for unity and c++ for arduino

slate swan
#

ooo

vale wing
slate swan
slate swan
#

🗿 i made one in my cmd

final iron
slate swan
#

and my first bot was made with pen & paper :

slate swan
#

my first bot was in my head, in the form of thoughts

#

💀 yes, replying to commands right?

#

ofc

#

lmao

supple thorn
slate swan
#

connected to the v9 gateway

slate swan
supple thorn
#

iirc unreal uses cpp for coding the scripts

boreal ravine
#

Not to brag but my first bot was stolen from FCC 😏

slate swan
vale wing
#

All the bots were quarks in prehistoric times

slate swan
slate swan
#

oh lol nvm

slate swan
supple thorn
#

Write code in school and scan it at home

slate swan
#

the best thing is

slate swan
#

how did i not notice that

#

😭 ikr

#

wow

#

been taking it for granted ;-;

#

ouu

supple thorn
#

I wonder if my handwriting is good

#

I should post it here some day

#

Nah you guys would clown me

slate swan
#

i can assure you by the quality of your profile picture and the position you are sitting in right now it is very good handwriting

#

💀 so what if i put pfp of an egirl? lmao

#

what about my handwriting then? 💀

#

uh

#

😂 nvm jk

#

hot

supple thorn
slate swan
#

😂

supple thorn
#

Your hand suddenly gets compelled to write uwu now

slate swan
paper sluice
#

handwritting with normal pfp 💀
handwritting when egirl pfp \💀

supple thorn
#

Power of ashley's name

#

And avatar

slate swan
slate swan
supple thorn
#

Gone. Reduced to c code

vale wing
#

How to catch Forbidden, cause this doesn't catch it

supple thorn
slate swan
#

termux?

#

disnake.errors.Forbidden, not disnake.Forbidden @vale wing

slate swan
vale wing
slate swan
#

oh lol nvm

vale wing
#

Cause I'm not home

supple thorn
#

I'm teared on if i should make docs for my wrapper

slate swan
supple thorn
#

My wrapper is pretty simple and has only like 5 methods

vale wing
#

If you ctrl + press disnake.Forbidden it will get you to errors

#

It gets imported in main module

slate swan
#

oh

#

I see

supple thorn
#

I don't think people would get confused without docs

slate swan
#

well try it anyway

vale wing
#

I even tried HTTPException it still smokes weed

slate swan
#

commented code 👍
uncommented code 👎

supple thorn
#

Isn't spaghetti

#

Hopefully

upbeat gust
slate swan
#

lol that's glad to know

slate swan
supple thorn
#

You'll see when i finally publish it on it's github repo

slate swan
#

alright sir

supple thorn
#

Hello okimii

slate swan
#

Hello okimii

slate swan
paper sluice
slate swan
slate swan
slate swan
supple thorn
slate swan
boreal ravine
#

!rule 7

unkempt canyonBOT
#

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

supple thorn
#

It just that i feel like using sphinx for this minimal library is fucking overkill

slate swan
#

how to remove name and value?

slate swan
supple thorn
slate swan
upbeat gust
slate swan
slate swan
boreal ravine
#

Stop

supple thorn
#

Sometimes the more i talk to sarth or okimii the more shit i need to do

boreal ravine
#

!rule 7

unkempt canyonBOT
#

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

slate swan
slate swan
#

i love making discord bots bleep boop

slate swan
slate swan
slate swan
supple thorn
#

I wonder how fast a discord bot would be if it's hosted on a super computer

supple thorn
slate swan
slate swan
slate swan
slate swan
#

in terms of just raw speed something like a message create post request

slate swan
slate swan
#

^^^

vale wing
# supple thorn What if 1tbps speed

1tbps is more like bandwidth, the speed of internet is the length of connector between computers (let's say a wire) divided by the time it takes for an electric signal to complete the distance. It will be almost equal to the speed of electric charge in an electric conductor

slate swan
#

the speed of light 👀

#

exenifix, be my physics teacher pls

#

^^^

#

xD

vale wing
#

I was bad at physics at school 😳

slate swan
#

...

#

gonna start physics soon, what's it like?

vale wing
#

I can be your music teacher tho

#

😀 👍

#

solfeggio is pretty enjoyable trust me

vale wing
slate swan
#

oo

#

fun

vale wing
#

Like liNeAr aCcEleRaTioN

maiden fable
#

In short, u need to take memory pills in order to remember those without going in deep

vale wing
#

I always hated mechanics and liked nuclear physics 😈

maiden fable
#

Whoops mod here

velvet compass
#

fwiw physics made calculus make sense

maiden fable
#

Time to get warned

slate swan
#

😭

maiden fable
#

Nvm

slate swan
#

please have mercy on our souls

maiden fable
#

I didn't say anything 😶

slate swan
#

💀

slate swan
unkempt canyonBOT
slate swan
#

the moderator has been moderated yert

vale wing
#

Oh mo

velvet compass
slate swan
#

is there any library for interactions types?

sick birch
slate swan
#

How do you loop over all messages in a channel with the v2 version?

sick birch
#

And yeah like brad said if you already know calculus it makes physics much easier

sick birch
unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
slate swan
slate swan
slate swan
#

yes

#

I like Nextcord

#

isn't that a gateway library?

slate swan
# unkempt canyon

ah thank you, I was using .flatten() which was causing some errors

slate swan
slate swan
slate swan
#

okay

sick birch
#

Interactions are received through the gateway unless you specify otherwise

slate swan
slate swan
sick birch
#

They come in INTERACTION_CREATE payloads

sick birch
#

But you’d have to set up a web server to listen for them

slate swan
#

however, is a good idea using https interactions?

zenith mural
#

does anyone know how to keep a bot online 24/7

sick birch
vivid light
#

Hey! What should I use for a modmail bot?

slate swan
slate swan
sick birch
#

You have to expose your local network to the internet

slate swan
#

^

sick birch
#

And also use case is kind of limited

slate swan
sick birch
#

You’d have to set up a web server using flask or something similar

#

And you get raw payloads you have to parse yourself

slate swan
slate swan
#

well thought https interactions was the "future of discord bots"

sick birch
# slate swan wym

There’s not many times where you HAVE to use HTTPS interactions over gateway ones

slate swan
#

hm okay

sick birch
slate swan
#

okay

slate swan
sick birch
slate swan
sick birch
#

discord moment

paper sluice
inland beacon
#
from os import environ

from discord.ext.commands import Bot, Intents, Context

bot = Bot(command_prefix='>', intents=Intents.all())

@bot.command()
async def ping(ctx: Context) -> None:
    await ctx.send(bot.latency*1000)

bot.run(environ['TOKEN'])
```py

```sh
KeyError: 'TOKEN'
#

???

slate swan
#

we dont help with selfbots

inland beacon
#

not self bot

slate swan
#

editing bot=False wont change a thing

paper sluice
#

u editing message wont change anything

inland beacon
#

what is self bot?

paper sluice
#

we wont help ya

inland beacon
placid skiff
slate swan
#

reverse searched, the code doesnt exist there

#

and the error is pretty much self explanatory

inland beacon
#

what it mean?

placid skiff
#

it means that before developing a discord bot in python you should know python first

inland beacon
#

no..

zenith mural
paper sluice
#

xD

zenith mural
#

you can import TOKEN from config

placid skiff
#

"what is key" in 3... 2... 1...

inland beacon
#

Thanks. I'll google my error from now on.. 🥲

slate swan
#

@sick birch sry for pinging u, but why doesn't exist a discord API library for py?

slate swan
#

oh NVM

paper sluice
#

embeds!!!!!!

slate swan
#

right

#

I mean I'm talking about a library that provides typings

cloud dawn
#

@inland beacon Like Sarth said we don't help with self bots, not knowing what a key error is whilst having perfect type annotations and return types.

paper sluice
#

organization 💀

slate swan
inland beacon
slate swan
#

like the discord models such as Roles and channels?

zenith mural
#

from config import TOKEN

slate swan
#

yes

slate swan
cloud dawn
zenith mural
#

ah ok

slate swan
#

!d discord.User

unkempt canyonBOT
#

class discord.User```
Represents a Discord user.

x == y Checks if two users are equal.

x != y Checks if two users are not equal.

hash(x) Return the user’s hash.

str(x) Returns the user’s name with discriminator.
slate swan
#

hm okay

placid skiff
# slate swan hm okay

discord packages in python are OOP based, that means that every discord model is an object in those package

slate swan
#

you can refer to their docs and see what library suits you :D
personally i'd recommend discord.py or hikari

cloud dawn
#

!code

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.

placid skiff
#

they're models in common terms

slate swan
cloud dawn
slate swan
#

he meant discord models as in the resources you get from discord

placid skiff
#

well what said panda is also true lol

slate swan
placid skiff
slate swan
#

ty

slate swan
cloud dawn
slate swan
#

your issue?

slate swan
#

try it
???

#

please use a codeblock

placid skiff
cloud dawn
slate swan
#

and from what i see, its inconsistent py async def purge(ctx, x): ... await ctx.channel.purge(limit=int(x)) instead of doing this you could have typehinted x as int

await ctx.message.delete()

the message already gets deleted with the purge, simply add +1 to the purge to include that message

placid skiff
slate swan
#

💀

#

....

#

I will just go away now

#

!pip aiopyql

unkempt canyonBOT
#

A fast and easy-to-use asyncio ORM(Object-relational Mapper) for performing C.R.U.D. ops within RBDMS tables using python

slate swan
#

seems cool

#

literally just 2 lines of changes..

#

also, make sure the command is above bot.run

#

I mean, javascript is object oriented too.....

cloud dawn
slate swan
#

huh....

cloud dawn
#

sick when

slate swan
#

🤡 is it just me who is unable to process this discussion?

slate swan
paper sluice
slate swan
#

just end that topic

slate swan
#

and yes even though discord is not a programming language

#

they call those models "objects"

#

yeah though i got confused between both

#

the ... is just the code you already had, i just didnt want to rewrite everything again

#

anyways, imma just go away and play cr 😔

#

cya ash, have fun 👋

maiden fable
slate swan
maiden fable
#

I, uhhh, will just go away instead

paper sluice
#

people repellent chat

silver agate
#

hello 🙂

silver agate
boreal ravine
silver agate
boreal ravine
#

the coc

paper sluice
#

clash of clans

slate swan
boreal ravine
#

oh

silver agate
#

coc = clash of clans mate

boreal ravine
#

i thought they meant clash of code

slate swan
#

yeah agree

#

coc > cr

#

imo

#

make a coc bot on discord

#

😳

paper sluice
#

there is an api for that

slate swan
#

oh wait coc got an API?

#

yeah

#

gg, few more days to waste

#

LMAO

paper sluice
#

imma waste my days learning cpp lemon_hyperpleased

boreal ravine
#

i'm laughing my ass off too

slate swan
#

ash got no time

paper sluice
#

i had a lvl 1, th13 acc

slate swan
cloud dawn
#

!indention

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

youre missing imports and indentations man

paper sluice
#

learn python before u make a discord bot...

slate swan
cloud dawn
#

I have send you some info.

#
  • import zoneinfo
paper sluice
#

from datetime import datetime

slate swan
cloud dawn
#

!e import zoneinfo

unkempt canyonBOT
#

@cloud dawn :warning: Your eval job has completed with return code 0.

[No output]
cloud dawn
#

Looks fine to me

slate swan
#

I added the + sign, panda 😔

cloud dawn
#

The + isn't in the `` :)

fervent vapor
#

hello

cloud dawn
#

Hi

fervent vapor
#

I am having a problem

slate swan
fervent vapor
#

parse_json = json.loads(apiData)

fervent vapor
#

this is giving me a huge error

cloud dawn
fervent vapor
#

and I dont undersand why

slate swan
fervent vapor
#

of course

slate swan
#

Hi

fervent vapor
paper sluice
#

Hi

fervent vapor
#

wont let me send an image, and i cant copy the console for some reason

slate swan
#

!json

unkempt canyonBOT
#

When using JSON, you might run into the following error:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This error could have appeared because you just created the JSON file and there is nothing in it at the moment.

Whilst having empty data is no problem, the file itself may never be completely empty.

You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.

Different data types are also supported. If you wish to read more on these, please refer to this article.

fervent vapor
#

could i send it to you in dms?

paper sluice
paper sluice
fervent vapor
paper sluice
slate swan
#

Yo

slate swan
fervent vapor
#

could you explain it to me because i am not sure what that means

cloud dawn
slate swan
#

Im having issue with this

#

json.decoder.JSONDecodeError: Expecting value: line 1 column 25 (char 24)

#

Not 1 its 25

paper sluice
#

👀

paper sluice
#

show ur json @slate swan

slate swan
#

Coloum 25

slate swan
#

Im trying to dump

slate swan
cloud dawn
paper sluice
slate swan
#

when i open json it looks like
{"968163683282862110": [

code :
list = [newDate,winlimit]
logs1[message.id] = list
with open("giveawaytime.json", "w") as f:
json.dump(logs1, f)

#

i'm high, ill just go away

paper sluice
quaint epoch
#

does everyone here just not sleep?

paper sluice
#

dont do drugs kids

quaint epoch
#

all the regulars are on 24/7 helping

cloud dawn
paper sluice
slate swan
#

?

paper sluice
slate swan
quaint epoch
slate swan
cloud dawn
#

How do you become a regular lol

paper sluice
#
with open(file) as file:
    data = json.load(file)

data.update(new_dict)
with open(file, 'w') as file:
    json.dump(data, file)

@slate swan

slate swan
quaint epoch
paper sluice
#

i dont trust anything with +

slate swan
#

never used update attribute ¯\_(ツ)_/¯

quaint epoch
slate swan
cloud dawn
slate swan
quaint epoch
paper sluice
#

bad experiences in past

quaint epoch
#

oh yeah we're here to help

#

not talk

slate swan
paper sluice
#

nah im not gonna say that...

slate swan
#

Then why the error come this thing doesnt have any attribute that

quaint epoch
cloud dawn
# quaint epoch mina?

Yeah her she's awesome, bee is also a good lad and greyblue some of the mods too basically any staff member that looks in #discord-bots from time to time.

quaint epoch
slate swan
#

uh whats walrus

#

but its limited to 3.10

cloud dawn
slate swan
#

its a new operator

quaint epoch
paper sluice
slate swan
#

..

paper sluice
#

it came some time ago

#

3.8 i believe

quaint epoch
#

just like py def walrus(new): x = new return x

cloud dawn
#

!pep 572

unkempt canyonBOT
#
**PEP 572 - Assignment Expressions**
Status

Accepted

Python-Version

3.8

Created

28-Feb-2018

Type

Standards Track

quaint epoch
#

btw, can you do :-=?

slate swan
paper sluice
quaint epoch
#

anyway, cya

slate swan
#

..

cloud dawn
slate swan
#

Cya

slate swan
quaint epoch
cloud dawn
slate swan
#

Imagine using things and not known names of it

paper sluice
#

me rn 💀

#

ehh?

slate swan
#

huh?

#

!ot

unkempt canyonBOT
cloud dawn
#

This isn't really the appropriate place to say this.

#

Anywhere on the server really.

vivid light
#

Error 404 - I haven't started yet lol

slate swan
#

Which ide?

vivid light
#

VCS

slate swan
#

index.py 💀 definitely not js background

paper sluice
slate swan
#

Invalid token

#

Idk

#

no, its a SSL certificate validation issue

#

Oh

vivid light
slate swan
paper sluice
#

!d ssl

unkempt canyonBOT
paper sluice
#

very helpful

cloud dawn
#

Secure Sockets Layer

slate swan
paper sluice
#

This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, macOS, and probably additional platforms, as long as OpenSSL is installed on that platform.

cloud dawn
#

It's more of a method to let users know that their connection is "safe".

slate swan
#

Wow

paper sluice
#

Warning Don’t use this module without reading the Security considerations. Doing so may lead to a false sense of security, as the default settings of the ssl module are not necessarily appropriate for your application.

slate swan
cloud dawn
#

We can help you solve a problem regarding a command we aren't going to make it for you, regardless of how much faster we can make it.

slate swan
#

Ok

olive osprey
#

indents

cloud dawn
#

!indention again.

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

olive osprey
#

basic python

cloud dawn
#

Your await is all the way to the left it needs to be inside the function.

vivid light
#

Panda where is the lock icon? lol

cloud dawn
#

Lock icon? pithink

slate swan
#

🔐

vivid light
#

ah wait ok got it i guess

cloud dawn
#

🔒

slate swan
#

🔑

cloud dawn
#

🔓

paper sluice
#

u didnt change anything, we already told u what to chaneg

slate swan
#

Lmao did u understand?

cloud dawn
#

😂

vivid light
#

lmao

#

i add the keychain as login or system?

paper sluice
#

(dont)? rob houses

slate swan
cloud dawn
#

Don't rob anything.

vivid light
#

the certificate

slate swan
#

what are u doing

paper sluice
#

(...)? (☞゚ヮ゚)☞ ¯_(ツ)_/¯

vivid light
#

installing the SSL certificate

slate swan
#

..

cloud dawn
#

It was my 6th year of discord anniversary this month I see rn.

#

I'm getting old

paper sluice
#

we didnt tell u to put something, we just told u to fix indents and import the missing modules

cloud dawn
#

What exactly is your issue right now?

vivid light
#

I'll just keep it as it is lol

paper sluice
#

same, they didnt change anything ... 🤷‍♂️

slate swan
cloud dawn
slate swan
#

Discord is more than 10 year old ?

paper sluice
#

no

#

it was released in 2015

cloud dawn
slate swan
#

Oh 👍

paper sluice
#

sparky writes, deletes, writes again edits, then recurses again until he reaches an overflow error

slate swan
#

..

vivid light
#

it finally worked thanks :3

cloud dawn
#

Couple syntax errors along the way.

slate swan
#

:D

slate swan
paper sluice
slate swan
#

Bad grammmer pithink

paper sluice
#

inspired by js

slate swan
#

No

cloud dawn
#

We aren't going to be much help if you just copy code.

slate swan
#

I dont need to write anything right my complier makes it right :D

#

U can use channel.send

cloud dawn
#

This got made almost 4 years ago.

slate swan
#

Lmao

#

pass_context

eager bough
#

hi

slate swan
#

Hi

eager bough
#

everyone

cloud dawn
#

I recommend checking out some yt vids and do some more research.

#

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

slate swan
#

Can bot create guilds and invite ppl to it?

cloud dawn
#

Or start with more simpler commands, and I recommend just running code. Check if it works, if it does not debug it and try to fix it. If you are still unable to fix it you can always come here.

slate swan
#

@maiden fable miracle happened online classes from 1 may

cloud dawn
cloud dawn
slate swan
#

U have to do research urself

#

None can teach you how to research

cloud dawn
#

The purpose of this site is to help you understand and to learn the syntax of Python.

slate swan
#

I cant explain

#

There should be module named syntax change

#

from compiler import syntax_change

#

Imagine

cloud dawn
#

I mean you can start with pretty basic things like send text to specific channels or embeds, learning cogs and looking trough the api docs. That's how I got started.

cloud dawn
unkempt canyonBOT
eager bough
#

hi

#

hi everyone

slate swan
#

!e

noob = ["W","e",2,3,"o",2]
idk = (noob[0],noob[4],noob[0])
print(idk)
unkempt canyonBOT
#

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

('W', 'o', 'W')
eager bough
#

lol

#

who wanna be friends (:

#

anyone?

#

So everyone hate's me i see

cloud dawn
#

No you're in an on topic channel.

maiden fable
cloud dawn
eager bough
#

anyone wanna see my discord bot's

#

I made

cloud dawn
#

Sure.

eager bough
#

):

#

my error

#

it is huge ):

cloud dawn
#

I can only see html

eager bough
#

It is a discord bot

#

Bruh my bot has been baned in discord

#

I use vpn so idc if u saw my ip

#

No i am not changing the token

#

For it is not nessacery

#

because

#

I wanna make a discord bot with a friend

#

):

slate swan
eager bough
#

for rate limit

#

basicly it bc i use replit

#

as my client

#

correct @slate swan

slate swan
eager bough
#

@slate swan Is my best friend (:

#

drag the folder

slate swan
eager bough
#

(:

slate swan
#

like, how are you creating the picture?

eager bough
#

Np

#

(: