#discord-bots

1 messages ¡ Page 627 of 1

velvet tinsel
#

we refer every code as thingy

#

f in the chat

slate swan
#

im trying to make the command ignore users who it can not dm, including itself

arctic python
#

Maybe. In which case it'd be continue.

slate swan
#

otherwise, dm

arctic python
slate swan
velvet tinsel
#

kept raising the error non stop

#

until sherlock told me that error handlers exist for a reason

slate swan
#

thats what i have right now

velvet tinsel
#

i think....

slate swan
slate swan
velvet tinsel
velvet tinsel
velvet tinsel
slate swan
velvet tinsel
slate swan
sullen shoal
#

just passing an if conditional is same as not having it

slate swan
slate swan
sage otter
velvet tinsel
slate swan
#

And just use ctx.guild.members

velvet tinsel
#

and why botid that's wrong

velvet tinsel
slate swan
arctic python
# slate swan thats what i have right now

You need to put the if statement inside the loop. So like:

@bot.event
async def on_guild_join(ctx):
    for member in bot.get_all_members():
        if member.id == bot_id:
          continue
        await ctx.send(embed=embed)
        print(f'done')
``` ish
slate swan
#

what are the aliases for continue?

#

is that like pass? or return?

arctic python
slate swan
velvet tinsel
#

test = ctx.guild.members.id

sullen shoal
#

continue skips the current iteration

velvet tinsel
slate swan
velvet tinsel
#

or you can make a for loop

sullen shoal
arctic python
sullen shoal
#

both have different uses

arctic python
#

And yeah, != and is not are different operators.

velvet tinsel
slate swan
#

not that

#

Pass = ignores
returns = returns
continue = keeps going
break = breaks the func

slate swan
sage otter
#

dementati too fast :/

velvet tinsel
#

and return has to be in a func as well

slate swan
velvet tinsel
slate swan
velvet tinsel
#

he's a demon at python

slate swan
arctic python
sullen shoal
slate swan
#

And wouldn't dming all members get you rate limited

sullen shoal
#

!e
for i in range(30):
continue
print("it wont work")

unkempt canyonBOT
#

@sullen shoal :warning: Your eval job has completed with return code 0.

[No output]
slate swan
velvet tinsel
slate swan
#

Your making me look bad

#

Cause your in trouble with modspithink

velvet tinsel
#

!e

for i in range(30):
  pass
  print("test")
unkempt canyonBOT
#

@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.

001 | test
002 | test
003 | test
004 | test
005 | test
006 | test
007 | test
008 | test
009 | test
010 | test
011 | test
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/jusuyuhaho.txt?noredirect

sullen shoal
#

just making your mind sharp

#

pass does nothing

velvet tinsel
#

damn

sullen shoal
#

thats its job

slate swan
velvet tinsel
slate swan
#

😔

velvet tinsel
#

it's 9:30 here

#

i needa sleep

#

night night everyone

slate swan
#

5:30pm

slate swan
sullen shoal
#

i gotta go sleep too, my sleeping schedule kinda fucked up

#

almost 3am

#

gn

sage otter
#

I mean you're a programmer. Sounds pretty normal to me…

slate swan
slate swan
#

Im kinda feeling like a crazy person

#

So ima use json as a db😈

tawdry perch
slate swan
arctic python
#

I'm kinda feeling like a crazy person, so I'mma travel into the city on a kid's tricycle.

#

That's what that sounds like.

#

It's like, sure, you can do that, and it'll get you there eventually. But it's not efficient.

slate swan
#

Thats the point json isnt suited for it lmaoyert

sage otter
#

I mean tbh json isn’t meant for config either but people still use it. Crazy world.

slate swan
#

Yeah😭

#

This chat is always dead in the evenings but mostly active in the morning and nights

arctic python
#

That depends on where you live.

cedar stream
#

Ig ppl are enthusiastic and full of ideas in the morning and give up on their project by the evening

#

Do yall still use dpy or did u switch to different fork?

dark pawn
#

can someone help me with this problem. im not that good at python so im not sure how to create and save instances of classes for each user. this is what i have but it never remembers that the class for the user exists

velvet tinsel
velvet tinsel
#

I'm going to code python on an enigma

arctic python
dark pawn
velvet tinsel
velvet tinsel
cedar stream
# dark pawn

U might wanna use commands.Bot instead of discord.Client

slate swan
#
@bot.event
async def on_guild_join(ctx):
    members = ctx.guild.members
    for member in members:
        try:
#embed stuff
            await member.send(embed=embed)
            print(f'done')
        except:
            print("Something went wrong")```
error: ```    members = ctx.guild.members
AttributeError: 'Guild' object has no attribute 'guild'
arctic python
#

That's like saying I'm gonna go into the city by riding a washing machine.

cedar stream
arctic python
#

It's a machine, but it's not a vehicle.

slate swan
cedar stream
#

Also rename ctx to guild

slate swan
arctic python
# dark pawn

!paste Would you mind using the service described in the box below to paste your code instead of a screenshot? It's easier to read this way.

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.

cedar stream
#

It’ s not ctx

#

It’ s discord.Guild

slate swan
#

so just async def on_guild_join(guild : discord.Guild): not async def on_guild_join(ctx, guild : discord.Guild):

slate swan
dark pawn
slate swan
cedar stream
#

I switched to that

slate swan
cedar stream
#

Ty

slate swan
#

Beautiful walter

cedar stream
#

Tyty

dark pawn
#

then it says the instance doesnt exist

sage otter
#

Tbh most of the forks that people made are complete garbage. Especially that edpy shit. Said they’d stay with Danny’s original design and keep everything original. And guess what. It’s like a completely different library.

cedar stream
sage otter
#

I’ll honestly stay with the main library until it breaks. Then move to novus.

dark pawn
cedar stream
slate swan
#

Its same syntax but a bit complicated relating to buttons

sage otter
#

Most of the components on dpys master branch

#

Slash commands aren’t even that special. To me they are just shitty versions of message commands.

#

The fact that discord is wanting people to go to them is baffling.

cedar stream
cedar stream
cedar stream
sage otter
#

That’s depends

#

If you're bots not verified you can continue to use them.

#

If you're bots verified figure out a way to get message intent.

cedar stream
#

Wont they be removing them in 2022?

sage otter
#

If you have automated mod features you’ll more than likely get accepted for the intent.

cedar stream
#

Message intent is mainly for on_message event

sage otter
#

Your bot won’t able to read message content anymore and know if someone’s trying to invoke a message command.

cedar stream
#

So discord.py will be useless w/o support for slash commands

sage otter
#

Not really.

cedar stream
sage otter
#

Privledged intent enforcement is towards verified bots.

sage otter
sage otter
#

🤷‍♂️

cedar stream
#

Otherwise it wouldn’t be able to use on message event

#

And idk how they would make automod without it

sage otter
#

No 🤦‍♂️. Every bot can still operate as normal until they start enforcing the intent some time in 2022

cedar stream
#

But u alr need to apply for the intent if u verified?

sage otter
#

can apply

cedar stream
#

If u need it

sage otter
#

They opened the applications early

cedar stream
#

Where can I read that stuff

#

Do they have it on dev portal?

#

I fr thought they were gonna completely wipe classic commands

sage otter
#

ddevs

cedar stream
#

Ty

sage otter
#

That’s where they make the announcements about all that stuff.

cedar stream
#

Lemme see

sage otter
cedar stream
sage otter
#

🤷‍♂️

cedar stream
#

They will just make it so u cant see message content

#

Basically uwill still know when someone sent something but u wont know what they sent, except in dms or if bot is mentioned

zenith basin
#

it won't let me create bot inv link
?
help

slate swan
#
@bot.event
async def on_guild_join(guild : discord.Guild):
    members = guild.members
    for member in members:
        try:        
#embed stuff
            await member.send(embed=embed)
            asyncio.sleep(2)
            print(f'dmed {member.name}#{member.discriminator}')
        except:
            print("Something went wrong")``` when the execution finishes, the console gets flodded with "Something Went Wrong", how can i close the loop after all the members are dmed? and how can i limit it to 1 DM per 2 seconds? to prevent ratelimits
zenith basin
#

pls

cedar stream
cedar stream
slate swan
slate swan
cedar stream
slate swan
cedar stream
#

The exception ur getting could be something else

slate swan
#

@slate swan dont use a bare exception

cedar stream
#

So just remove try clause and see what errors u get

slate swan
#

ecxept Exception for e:
print(e)

#

right?

cedar stream
#

Just remove try clause for now

slate swan
cedar stream
#

Just remove the try clause

slate swan
#

Yeah

#

i got this error

cedar stream
#

It’ s bad practice to just catch every exception

slate swan
#
  asyncio.sleep(2)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
cedar stream
#

Await asyncio.sleep

slate swan
#

ohhh right

slate swan
#

Its a coroutine it must be awaited

zenith basin
cedar stream
#

Also if you get an exception it helps to read it

slate swan
#

Theirs a url to make a button for a bot and another for a random url invite

zenith basin
slate swan
#

@zenith basin btw your nickname is wrong

#

Pip should be lower case: pip install Wolf

abstract kindle
#

can someone explain what pass_context = True means?

slate swan
manic wing
#

now ctx is always required

abstract kindle
#

Okay, I've just seen it in some examples and I was confused as to what it was

#

Thanks guys

manic wing
#

most examples are crap

slate swan
slate swan
vague falcon
#

does anyone have python command to bring bot online?

vague falcon
slate swan
vague falcon
#

Forgets...

slate swan
cerulean osprey
# slate swan Wdym

I think he means like… if the bot’s replit (for example) is stopped then is it possible to turn it on

#

With a command

#

(I think)

slate swan
manic wing
cerulean osprey
#

I don’t think so either, since if whatever the bot is running on is currently stopped.. the command won’t even work KEKW

cerulean osprey
#

Yeah, it’s not possible I don’t think

#

Since the bot won’t take any commands if it’s off

manic wing
#

you make a second backup bot

slate swan
cerulean osprey
#

Yeah lol

pliant gulch
#

Seems like groovy has switched to fully interaction based stuff?

pliant gulch
slate swan
#

@pliant gulch how do you know that?

#

And how do you know this kind of stuffyert

pliant gulch
pliant gulch
#

I did the same thing to my test client and noticed it lost a presence but still received commands

#

Although commands as in interactions only

#

It doesn't have any websocket unless you do HTTP Interaction and websocket combined

slate swan
#

I see🤔

pliant gulch
slate swan
#

Thats cool🤔 yert

pliant gulch
#

Pretty cool yes, but I had no idea this is what happened until like a week later

slate swan
pliant gulch
#

When I was testing INTERACTION_CREATE dispatching I wasn't receiving it

#

Until I realized I set the endpoint

pliant gulch
pliant gulch
#

I mean, you will still receive events if your using gateway but you won't receive INTERACTION_CREATE

#

And if you want to receive it you need a HTTP server that verifies a requests is from discord

slate swan
#

You make my head hurtjam_cavedude

pliant gulch
#

Me too

slate swan
pliant gulch
#

Not really

slate swan
pliant gulch
#

Just expose yourself to more things ¯_(ツ)_/¯

#

You get it overtime ig

slate swan
#

Makes sense,i mean i do it here because everybody is always talking about stuff i dont know but i learn from it

cedar stream
#

And work on projects

slate swan
cedar stream
# slate swan I do

If ur into backend u can also learn a framework like django or quarkus

cedar stream
#

Check out quarkus

slate swan
cedar stream
slate swan
cedar stream
slate swan
#

Yeah ik

cedar stream
#

Literally every library u use has an api

#

Api is not related to web

#

Or rest service

slate swan
#

Ye

#

Backend uses apis too

cedar stream
#

Yes as backend developer you need to create a good and logical api that frontent dev will use

abstract kindle
#

hey guys, every time i try to have my bot send a DM to the author of the message, nothing happens and I get no errors...

#

What is happening???

slate swan
abstract kindle
#
 # REGISTERS THE USER // CREATES ACCOUNT IN masterdbmac.sqlite DATABASE
    @commands.command()
    async def register(self, ctx):
        await ctx.send("Hey!")
        uid = ''.join(random.choice(string.ascii_letters) for i in range(5))
        await self.send(ctx.author, f"Your unique ID is {uid}.")
cedar stream
#

Send ss of code

slate swan
cedar stream
slate swan
abstract kindle
#

its in a cog

slate swan
#

A front end?

abstract kindle
#

? that works?

cedar stream
cedar stream
#

Go read about apis

slate swan
cedar stream
#

Yes

slate swan
cedar stream
#

Read about what an api is

slate swan
#

I have bruh

cedar stream
#

Lemme give u an article

abstract kindle
#

I've been checking on the internet about it and everything is saying client.send

slate swan
#

Why would i use a api when i dont even know what it is

cedar stream
# slate swan Why would i use a api when i dont even know what it is
MuleSoft

What is an API? (Application Programming Interface) API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API. What exactly is an API? Finall...

cedar stream
abstract kindle
#

Ohhhhh, it's if i already have the user.id from message.author

cedar stream
#

!d discord.Member.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
abstract kindle
#

I see now. Everything else was telling me how to do it when it was separate from an event

cedar stream
abstract kindle
#

yeah

#

And if its in a cog, it would be self, right?

cedar stream
#

No

#

Send me ss of ur file

#

self would be an instance of the cog

abstract kindle
#

yeah so if I have self.bot = bot at the top of the code

cedar stream
#

It’ s self.bot then

#

Not self

#

And you dont have it at the top, you put it in a constructor hopefully

abstract kindle
#

its under the whole def __init__ thing

cedar stream
#

Yes that is good

abstract kindle
#

Oh I see, it's self.bot not self

cedar stream
#

Yes

abstract kindle
#

ok got it

cedar stream
#

Still use ctx.author.send

slate swan
manic wing
slate swan
manic wing
#

well, in short; you’re wrong.

slate swan
#

I mean in your perspective but i really didn't specified it really

daring olive
#

the dpy library is a wrapper for the discord API

slate swan
#

Yeah?

daring olive
#

yup

slate swan
#

Lol

daring olive
slate swan
#

Yeah

slate swan
daring olive
#

hmm i don't think that's quite the right analogy. it's more like the API end points are little lego pieces and the dpy library is a wrapper which lets you build using those lego pieces with its predefined classes

#

idk if that's the best analogy either tbh lemon_sweat

slate swan
#

Kinda seems the same to me,but thats a good example

bronze pilot
#

Made a YouTube music streaming feature for my bot, but I am confused with the following line of code:

#
source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
#

I understand the function of single and double asterisks when declaring functions, but why are there two asterisks before FFMPEG_OPTIONS?

cerulean osprey
#

How would I make my bot do something if someone starts typing in a specific channel?

daring olive
#

streaming youtube media outside of official platform options is against their tos so please don't ask here

slate swan
cerulean osprey
#

Damnit I forgot docs was a thing

bronze pilot
#

got it. still a valid question though, no?

cerulean osprey
#

Mb lol

slate swan
cerulean osprey
slate swan
cerulean osprey
#

Yeah lol

slate swan
#

I always do it

slate swan
unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
pliant gulch
bronze pilot
#

ye I was told already

slate swan
slate swan
pliant gulch
cerulean osprey
# slate swan I always do it

Looking on docs it says discord.on_typing so would it be like

@client.event
async def on_typing(<channel id>):
    #<code>

?

slate swan
slate swan
#

I think so

cerulean osprey
#

Alr lol, sorry for bothering, Ill try it out and if you want Ill let you know if it works KEKW

rocky mist
#

can someone help?

cerulean osprey
#

Maybe

rocky mist
#

how

cerulean osprey
#

Whats the error?

rocky mist
cerulean osprey
rocky mist
#

Nothing wrong

slate swan
cerulean osprey
#

The red underline

cerulean osprey
cerulean osprey
rocky mist
#

its normal but today its like

slate swan
#

Do a task for it

cerulean osprey
#

Will that happen everytime?

slate swan
#

Which i do not recommend

cerulean osprey
#

Hmmm, so how would I use a task for it?

slate swan
#

Maybe the bottom will give you a error i forgot its kinda long

#

@cerulean osprey btw atom means:
an action that cannot be interrupted

cerulean osprey
#

Hmmm, so this is currently my on_ready

@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')
    poiu = random.choice(songs)
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=str(poiu)))

    bert = client.get_channel(898815070207877133)
    await bert.send('I have come online once more')

So as of now, nothing so far has happened for it to error. Is it maybe bc of the print statement making sure the bot is ready before running the change presence?

slate swan
#

No not at all

cerulean osprey
#

Or have I just been lucky egwDevilThisIsOkay

slate swan
#

Its just discord sometimes disconnects you because as said its a atom action

visual island
slate swan
#

Its too long😭

cerulean osprey
#

Damn, alright so it would be

async def startup():
    #<change presence witchcraft>

bot.loop.creat_task(startup())```
?
cerulean osprey
#

pogger thank you

pliant gulch
#

What is the problem right now?

cerulean osprey
#

Oh yeah KEKW

pliant gulch
#

Whats with the create_task here

cerulean osprey
slate swan
pliant gulch
#

Why though

#

You can just pass the activity to the bots constructor

pliant gulch
#

commands.Bot(activity=..., ...)

slate swan
#

That works fine too

pliant gulch
#

This will set the presence directly when IDENTIFYING

#

Which is done when connecting to the gateway

slate swan
pliant gulch
cerulean osprey
#

So in this case, my presence is set by a random song from a set list, so would I move that list above commands.Bot() and do

poiu = random.choice(songs)
client = commands.Bot(activity = client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=str(poiu))), ...)```?
pliant gulch
slate swan
distant warren
#

I want a discord bot to create a voice channel

cerulean osprey
pliant gulch
cerulean osprey
#

Lemme try

pliant gulch
slate swan
visual island
#

gateway

slate swan
visual island
slate swan
distant warren
#

How can I make a Discord.py bot make a voice channel?

pliant gulch
#

And I'm unsure how discord.py reconnects so I can't say

pliant gulch
#

But at least from my experience the websocket only reconnects when it receives a RECONNECT OpCode

#

Being 7

cerulean osprey
#
client = commands.Bot(command_prefix="-", 
          help_command = None,
          poiu = random.choice(songs)
          activity = discord.Activity(type=discord.ActivityType.listening, name=str(poiu)))
``` its giving me an error on the `activity` line
pliant gulch
pliant gulch
visual island
pliant gulch
cerulean osprey
#

Yk that is a good question, I just copy and pasted what I had in the on_ready KEKW

#

And the error is just invalid syntax

pliant gulch
visual island
pliant gulch
slate swan
distant warren
slate swan
pliant gulch
# pliant gulch Heres the RFC

And after reading this closer, seems like for whatever reason sending the presence payload to the websocket during the time frame of READY being dispatched fucked something up

#

Can't be sure of it unless discord dev have disclosed it alr or smthg as we can't see the source I don't think

pliant gulch
patent lark
cerulean osprey
#

Oh nvm its erroring at something else that I added but was highlighting the activity line.. that makes sense 😎 so I need help again bc Im a little confused as you will see in the code Imma provideKEKW

 @client.event
async def on_typing(channel=909685766244945921):
    await channel.send(f'Woah, {<@{user.id}>}! Before you send your message, just be warned, you will be softbanned if you message here!')
``` this is designed to warn people before they send messages in my spam catcher channel, but Im not exactly sure how to ping them. The thing I tried was an honest shot in the dark and had no real expectations of working. How would I ping them?
pliant gulch
#

I'm not versed in all of discord.py's internals so it can be the exponential backoff or something else

patent lark
#

!d discord.on_typing

unkempt canyonBOT
#

discord.on_typing(channel, user, when)```
Called when someone begins typing a message.

The `channel` parameter can be a [`abc.Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") instance. Which could either be [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel"), [`GroupChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.GroupChannel "discord.GroupChannel"), or [`DMChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.DMChannel "discord.DMChannel").

If the `channel` is a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") then the `user` parameter is a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"), otherwise it is a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

This requires [`Intents.typing`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.typing "discord.Intents.typing") to be enabled.
cerulean osprey
#

Yeah I read that on docs lol, but how would I ping them?

pliant gulch
#

You receive user

#

Thus you can use .mention

cerulean osprey
#

So user.mention?

pliant gulch
#

Yes

cerulean osprey
#

TypeError: on_typing() takes from 0 to 1 positional arguments but 3 were given :o

pliant gulch
#

!e ```py
def func(): ...
func(1, 2, 3)

unkempt canyonBOT
#

@pliant gulch :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | TypeError: func() takes 0 positional arguments but 3 were given
pliant gulch
#

You can see why this would error right?

cerulean osprey
#

Yeah, but if you are abt to ask me to explain then I cant bc idk how to word it KEKW

pliant gulch
#

Ok well if you know why it is erroring then you should know how to fix it right

cerulean osprey
#

Yes, but also no. Ik that I would have to do on_typing(channel=<id>, user=<insert thing you put for user>, when=<insert thing> but idk how to fill in the last two

#

And when I leave it at user it yells at me

pliant gulch
#

No, you wouldn't do channel=

#

You just add the parameters to the function signature like the doc showed

#

!e ```py
def func(param): ...
func(1)

unkempt canyonBOT
#

@pliant gulch :warning: Your eval job has completed with return code 0.

[No output]
cerulean osprey
#

Ohhhhhhhhh KEKW

pliant gulch
#

🤔

cerulean osprey
#

So then what would I put for the other 2 then? Just user and when?

pliant gulch
#

What do you think?

cerulean osprey
#

I think that when I do it still yells at me with scary red underlining monkaGiga

pliant gulch
#

Can you show what you are doing exactly

cerulean osprey
#
async def on_typing(909685766244945921, user, when):
pliant gulch
#

Man

#

Why on earth are you setting the parameter as the id?

slate swan
#

How do I print something when someone replied to one of my bot's msgs?

visual island
slate swan
#

Reference

cerulean osprey
#

Bc I wanted to set it to a specific channel and have 0 clue how to do it with on_typing() so I just attempted to guess

visual island
unkempt canyonBOT
#

discord/gateway.py line 582

raise ReconnectWebSocket(self.shard_id) from None```
pliant gulch
#

They use exponential backoff to reconnect

abstract kindle
#
        await ctx.author.send("Create a username.")
        check = message_check(channel=ctx.author.dm_channel)
        username = await self.bot.wait_for("message", timeout=30.0, check=check)
        await ctx.author.send(f"Your username is {username}")
#

Can someone tell me why this is returning this:

Your username is <Message id=913584734020440104 channel=<DMChannel id=913566891073744967 recipient=<User id=326903703422500866 name='Kazido' discriminator='0139' bot=False>> type=<MessageType.default: 0> author=<User id=326903703422500866 name='Kazido' discriminator='0139' bot=False> flags=<MessageFlags value=0>>

distant warren
#
@client.event
async def on_guild_channel_create(channel):
  #things

in the things comment, I want to check if the channel is a voice channel or a text channel

unkempt canyonBOT
#

discord/client.py line 513

except ReconnectWebSocket as e:```
visual island
abstract kindle
#

How would I convert that to a string? str(username) just puts the same thing in..

visual island
visual island
#

if you string the message, it would appear like that

abstract kindle
#

basically I want their response to be a string that I can store as a variable

tiny ibex
#

How to search for a video using ytdl??

visual island
abstract kindle
#

yeah!

visual island
unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
distant warren
tiny ibex
visual island
visual island
tiny ibex
#

Finding youtube videos is not against YouTube ToS

visual island
abstract kindle
#

got it thanks

visual island
tiny ibex
visual island
#

use their API

#

I've tried it my own in the past

tiny ibex
visual island
# tiny ibex googleapis are shit
    _query = parse.urlencode({'search_query': "video title"})
    _content = request.urlopen('http://www.youtube.com/results?' + _query)
    _results = re.findall(r'/watch\?v=(.{11})', _content.read().decode())
```I found this somewhere in the past (still work tho currently)
distant warren
#

I need help

tiny ibex
distant warren
#
@client.event
async def on_guild_channel_create(channel):

I wanna check if channel is vc or text, Its still not working

distant warren
distant warren
#

still not working

tiny ibex
acoustic parcel
#

im using repl to code discord bots and when i type "import discord" this happens , can someone help?

distant warren
tiny ibex
acoustic parcel
#

oh how?

distant warren
#

there is package on the left

tiny ibex
#

Sometimes installing from shell doesn't work

visual island
tiny ibex
acoustic parcel
#

ohhh

tiny ibex
#

Just click on it

#

And search discord

acoustic parcel
#

is it version 1.7.3?

distant warren
tiny ibex
#

Yup

acoustic parcel
#

theres like 20 options

#

alright thanks :DD

tiny ibex
#

Install the first one

visual island
distant warren
#
    if channel.type in (discord.ChannelType.voice, discord.hannelType.text):
#

is that it??

visual island
#

discord.hannelType is wrong

tiny ibex
#
    if channel.type in (discord.ChannelType.voice, discord.ChannelType.text): 
distant warren
#

1 sec lemme try again

slate swan
tiny ibex
#

How to check user's spotify activity??

maiden fable
unkempt canyonBOT
#

property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activities "discord.Member.activities").
maiden fable
#

!d discord.Spotify

unkempt canyonBOT
#

class discord.Spotify```
Represents a Spotify listening activity from Discord. This is a special case of [`Activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Activity "discord.Activity") that makes it easier to work with the Spotify integration.

x == y Checks if two activities are equal.

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

hash(x) Returns the activity’s hash.

str(x) Returns the string ‘Spotify’.
tiny ibex
maiden fable
#

Why do u even wanna use the direct API bro

tiny ibex
#

It's a good practice

maiden fable
#

Breh I ain't kidding

tiny ibex
maiden fable
#

Lemme see

#

Hmm idrk tbh

#

Try doing source diving

tiny ibex
visual island
visual island
maiden fable
#

Ah, headers. Hmm

slate swan
#

help pls

flint cosmos
#

Hi so I am trying to give somebody a role via my bot and I was wondering, what argument do I put in the add_roles()?

visual island
#

you are defining your bot as nextcord.ext.commands.bot as it should be ``nextcord.ext.commands.Bot()`

visual island
#

you can get it via Guild.get_role()

slate swan
slate swan
#

oh

#

sorry, thx

flint cosmos
slate swan
visual island
#

not directly the class

flint cosmos
visual island
flint cosmos
flint cosmos
#

Whoops

#

I didnt read lol my bad

slate swan
# flint cosmos Im confused lol

you would be using an instance of the class , ie. Not just the actual class
Which you get from any attribute like ctx or message

visual island
visual island
# slate swan

ah I'm guessing that youre using commands.bot import in the cog file and using it in the Cog

visual island
slate swan
visual island
#

yeah

#

use self.bot.user instead

slate swan
flint cosmos
slate swan
#

and this help @visual island

gloomy coral
#

GUYS

flint cosmos
gloomy coral
#

I MESSED UP

flint cosmos
#

DID YOU MESS UP??

#

OH NO THE WORLDS BURNING

visual island
slate swan
gloomy coral
#

i wanted to put a reminder everyday at 8 30 but this ended up happening

visual island
gloomy coral
flint cosmos
visual island
gloomy coral
#

this shld work right?

visual island
#

read it

slate swan
flint cosmos
#

Go you your developer portal and enable intents

flint cosmos
flint cosmos
flint cosmos
gloomy coral
#

!eval py import datetime from datetime now = datetime.now() dt_string = now.strftime("%H %M") print(dt_string)

unkempt canyonBOT
#

@gloomy coral :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     import datetime from datetime
003 |                     ^^^^
004 | SyntaxError: invalid syntax
gloomy coral
#

why?

visual island
#

from datetime import datetime

visual island
gloomy coral
#

aaah

flint cosmos
visual island
#

is that a problem?

flint cosmos
# visual island is that a problem?

My question is, if im not defining my role variable inside of the on_member_join, what do I make the "member" in the member.guild.get_role(...)

gloomy coral
#

help me out wht shld i do

#

#bot-commands message

visual island
#

just use bot.get_guild() for the guild then

visual island
#

you can just do if dt_string == "15 00" or ...:

gloomy coral
#

ok

flint cosmos
gloomy coral
#

ok

gloomy coral
#

@visual island this will work now?

#
    @tasks.loop(seconds=60)  # repeat after every 40 seconds
    async def checkVoteTime(self):
        await self.bot.wait_until_ready()
        channel = self.bot.get_channel(880639248292798465)
        now = datetime.now()
        dt_string = now.strftime("%H %M")
        if dt_string == "15 00" or dt_string == "03 00":
            vote = nextcord.Embed(title="This is your reminder", description="You better vote for me, here and now", color=nextcord.Color.random())
            vote.add_field(name="1", value=f"[top.gg](https://top.gg/bot/864010316424806451/vote)")
            vote.add_field(name="2", value=f"[discordbotlist.com](https://discordbotlist.com/bots/chad-6621/upvote)")
            vote.set_thumbnail(url="https://i.imgur.com/QICgRpf.png")
            await channel.send(embed=vote, content="<@&881209363077943326>")
        else:
            pass



    @tasks.loop(seconds=60)
    async def csv_update(self):
        await self.bot.wait_until_ready()
        now = datetime.now()
        dt_string = now.strftime("%H %M")
        if dt_string == "12 00":
            date1 = datetime.strftime(datetime.now(), "%a, %d/%m/%Y")
            data = [date1, len(self.bot.users)]
            with open("databases/members.csv", 'a+', newline='') as csvfile:
                writer = csv.writer(csvfile)
                writer.writerow(data)

            date2 = datetime.strftime(datetime.now(), "%a, %d/%m/%Y")
            data = [date2, len(self.bot.guilds)]
            with open("databases/servers.csv", 'a+', newline='') as csvfile:
                writer = csv.writer(csvfile)
                writer.writerow(data)```

earlier it was sending msges many times
sick talon
#

pithink how can I paginate the data from an api ?

gloomy coral
#

help

#

@visual island

visual island
visual island
gloomy coral
#

this sent at

#

so shldnt it not sent now

#

cuz i want it exactly at this time

visual island
#

try using utcnow

graceful mulch
shrewd kraken
#

how do i make a text channel with permissions only for a certain user (im using a ticket system and don't want to use roles)

shrewd kraken
graceful mulch
#

Well the basic idea is that that channel need to be private and visible only for the user and thesupport team members

#

Isnt it

shrewd kraken
#

yeop

graceful mulch
#

But there are 2 prob , 1 how wud you add that person only 2 how wud you know the supportteam member as every server has different names

shrewd kraken
#

no its just for my server

#

so the second one isnt a problem

graceful mulch
#

Oh

#

Then I will have to see , btw my space keybarely working

shrewd kraken
#

ic

distant warren
#

I want to use threading with discord

#

how do I do it?

shrewd kraken
#

uhh why?

distant warren
#

because I want to make the bot run faster

shrewd kraken
#

if anything it will make it slower

graceful mulch
#
    ticket_channel = await ctx.guild.create_text_channel("ticket-{}".format(ticket_number))
    await ticket_channel.set_permissions(ctx.guild.get_role(ctx.guild.id), send_messages=False, read_messages=False)

    for role_id in data["valid-roles"]:
        role = ctx.guild.get_role(role_id)

        await ticket_channel.set_permissions(role, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)
    
    await ticket_channel.set_permissions(ctx.author, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)

    em = discord.Embed(title="New ticket from {}#{}".format(ctx.author.name, ctx.author.discriminator), description= "{}".format(message_content), color=0x00a8ff)

    await ticket_channel.send(embed=em)

@shrewd kraken

#

this might work

shrewd kraken
#

seems cool 👍

#

also

#

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

graceful mulch
#

I can send some more code if you cant figure out

shrewd kraken
#

no need

distant warren
graceful mulch
#

I cant send discord's message limittoo

distant warren
#

can anyone help?

shrewd kraken
graceful mulch
distant warren
graceful mulch
#

But I have a bot

shrewd kraken
pliant gulch
#

I don't think threading would make discord.py faster

#

Their ratelimiter uses Lock's thus allowing only one thread in at a time

shrewd kraken
#

^ exactly

pliant gulch
#

So requests would be bound to one thread at a time

#

shameless flex but my api wrapper allows concurrent requests as I use semaphores instead of locks

shrewd kraken
#

although i think using multiprocessing with an eval cmd might work

pliant gulch
shrewd kraken
pliant gulch
#

I haven't tested that but with cogs they should work?

unkempt canyonBOT
#

Hey @dark pawn!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

dark pawn
#

is there a reason why my command isnt working?

#

at the very bottom

distant warren
#
@client.command()
async def say(ctx,*,msgsay):
    async def do():
        await ctx.message.delete()
        await ctx.send(msgsay)
    t = threading.Thread(target=do).start()

for example, threading doesnt work with this because I need an await inside of it

shrewd kraken
#

but i wouldnt recommend it

distant warren
shrewd kraken
#

in eval

distant warren
#

wdym

shrewd kraken
#

idk but its possible but it might be slower

distant warren
#

i dont understand

#

can you show me

shrewd kraken
#

multiprocessing is basically threading but better

flint cosmos
#

Hey, I am getting this error:

2021-11-26T04:04:56.609535+00:00 app[worker.1]: Traceback (most recent call last):
2021-11-26T04:04:56.609556+00:00 app[worker.1]: File "/app/main.py", line 24, in <module>
2021-11-26T04:04:56.609655+00:00 app[worker.1]: defaultRole = guild.get_role(defaultRoleID)
2021-11-26T04:04:56.609679+00:00 app[worker.1]: AttributeError: 'NoneType' object has no attribute 'get_role'
2021-11-26T04:04:56.737460+00:00 heroku[worker.1]: Process exited with status 1

This is what I have:

serverID = config['serverID']
guild = client.get_guild(serverID)

defaultRoleID = config["roleIDs"]["defaultRoleID"]
defaultRole = guild.get_role(defaultRoleID)

Anyone know my issue?

distant warren
flint cosmos
# shrewd kraken what's config
{
    "roleIDs": {
        "defaultRoleID": 912534307443183646
    },
    "channelIDs": {
        "systemMessagesChannelID": 913090699254190110
    },
    "serverID": 911418973118165042
}

Json file

shrewd kraken
#

huhh

flint cosmos
#

Here let me simplify

#
serverID = 911418973118165042
guild = client.get_guild(serverID)

defaultRoleID = 912534307443183646
defaultRole = guild.get_role(defaultRoleID)
#

That is my code essentially ^^

lament mesa
gloomy coral
graceful mulch
gloomy coral
gloomy coral
graceful mulch
#

ok

#

Can anyone helphow to add local time ina embed

#
@commands.Cog.listener()
    async def on_ready(self,):
        print("Suggestion cog loaded successfully")
        em = discord.Embed(title ="Monitor Up",description=f"Antimatter Monitor Up At(GMT) ",color =0x00b300)
        em.add_field(name="Time",value=x.strftime("%X"))
        channel = self.client.get_channel(912594498398326814)
        channeldev = self.client.get_channel(912320086516318288)
        await channel.send(embed=em)
        await channeldev.send(embed=em)
#

This iswhat Imade butI want the time in my local time which is ist(gmt+5.30)

slate swan
#

<t:>

#

and then after : put unix time

#

<t:0>

graceful mulch
#

?

#

Ididnt understand

slate swan
#

<t:number>

#

Number is unix time

dark pawn
#

is there a reason commands arent working for me

slate swan
#

<t:1637900336>

#

Like that

slate swan
sweet geyser
#

Wait what

slate swan
#

<t:1637900336>

graceful mulch
#

<t:1637900336>

#

No

dark pawn
graceful mulch
#

I want in my bot

slate swan
#

Yeah do the same in ur bot

sullen agate
#

BOT , what a stupid thing to have

graceful mulch
#

Whatg

#

It isamazing

visual island
slate swan
supple thorn
sullen agate
slate swan
#

😔 discord bots bad?

sullen agate
#

i ssay a stupid thing for fun and ppl ping me

#

its was not meant to be guys

patent lark
#

for some reason, when trying to get a commands.Context.author it returns NoneType? i dont see how or why? i even tried chunking the guild yet no luck.

dark pawn
#

can anyone figure out why my command is doing literally nothing at the bottom of my code?

slate swan
#

help
not working

#

@patent lark@slate swan@slate swan

#

whats not working

slate swan
patent lark
#

whats your error

slate swan
#

do you get the except part everytime?

slate swan
slate swan
#

Do you have an on_message event?

#

restart the bot

slate swan
#

Check this

slate swan
slate swan
#

There is no command processing either way

patent lark
slate swan
#

There still is no command processing

#

¯_(ツ)_/¯

#

¯\_(ツ)_/¯

#

not working

#

no error now

slate swan
#

worked now

#

nvm

#

There is no command processing... Just look the screenshot sent.....

#

And it's not a @bot.listen so it will never process the command

patent lark
#

right, but if this were to be their issue, it would not raise a CommandNotFound error

#

correct me if im wrong?

slate swan
#

Well I'm surprised it even processes the commands with a normal on_message event overwriting

#

on_message events "may" block the code , its not important that it always does.

#

I'm pretty sure it always does

#

As you overwrite the default one, which contains processing stuff, with your custom code which doesn't.

keen lark
#
import discord
from discord.ext import commands

TOKEN = ''

client = commands.Bot(command_prefix='-')


@client.event
async def on_ready():
    print("Bot is ready")


@client.command()
async def kick(ctx, member: discord.Member, *, reason=None):
    await member.kick(reason=reason)


@client.command()
async def ban(ctx, member: discord.Member, *, reason=None):
    await member.ban(reason=reason)

client.run(TOKEN)```

why this does not work .-.
patent lark
#

whats your error

slate swan
#

(line12 is bot.run)

keen lark
#

but it cannot run

slate swan
slate swan
#

show the on_message event you have now

slate swan
#

how can I check if something is in a message

hollow agate
#
@client.command()
async def mute(ctx, member: discord.Member, time=None, *, reason=None):
    format = datetime.now(tz=pytz.timezone('America/Tijuana'))
    formatted = format.strftime("%I:%M %p")
    b = DT.datetime.now().timestamp()
    modlogs = client.get_channel(872909569196707870)
    db = await aiosqlite.connect('database.db')
    cursor = await db.execute('SELECT * FROM mutes')
    rows = await cursor.fetchall()
    muted = discord.utils.get(ctx.guild.roles, name="Muted")
    farmer = discord.utils.get(ctx.guild.roles, name="Farmers")
    apprentice = discord.utils.get(ctx.guild.roles, id=907127783849861120)
    if ctx.message.author.guild_permissions.administrator:
        if member is None:
            e = await ctx.reply('You must mention someone to mute!')
            await asyncio.sleep(5)
            await e.delete()
            await ctx.message.delete()
            return
        if time is None:
            a = await ctx.reply('Please state a time for a timed mute or a reason for a permanent mute!')
            await asyncio.sleep(5)
            await a.delete()
            await ctx.message.delete()
            return
        if reason is None:
            if time[-1] in ['s', 'm', 'h', 'd']:``` This is quite messy, but is there a way that I can somehow determine if the `s`, `m`, `h`, and `d` are touching another letter, if so it does something?

```py
            if time[-1] in ['s', 'm', 'h', 'd']:``` after this line.
cedar stream
hollow agate
#

Could you explain?

cedar stream
cedar stream
#

It’ s a library which u can use to parse time periods

hollow agate
#

I'm not sure if that'll help me fully xd

#

When I try to do .mute @hollow agate Spam Bot, it determines that as a s so it tries to put seconds- everything else works.

cedar stream
hollow agate
#

Interesting, is there not a better way? I'll need to rewrite my entire command and it's quite a lot in there

cedar stream
#

Can u send a ss of command

abstract kindle
#

hey guys, what would some general code look like for an if statement that checks to see if a user reacted to a message in a DM with a certain reaction?

#

I'm trying some code rn, but it's not working and no errors are coming through

#
@commands.Cog.listener()
            async def on_reaction_add(reaction, user):
                if reaction.emoji == '✅':
                    await ctx.author.send("Adding account to database...")

Is this right?

cedar stream
#

Can u send ss

#

Cus I cant read this on mobile

abstract kindle
#

I'm on a mac and I'm not sure how to do it lol

hot laurel
#

hi

covert igloo
#

Command shift 4

cedar stream
#

It’ s shift + cmd + 4

cedar stream
abstract kindle
covert igloo
#

Shift cmd? Didn't know u could do that

abstract kindle
#

i think its discord.on_reaction_add

#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
keen talon
cedar stream
#

How did u get cyx

#

Ctx

keen talon
#

U can't get it here

cedar stream
#

You dont have context parameter

keen talon
#

It only works on command

cedar stream
#

U have user

abstract kindle
#

Oh i see

#

This is in a DM channel btw

cedar stream
#

Use user.send

abstract kindle
#

AH okay

covert igloo
#

Can u use user without adding user:discord.Member as a parameter

keen talon
unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
slate swan
covert igloo
cedar stream
slate swan
#

unless you're talking about the :discord.Member part

covert igloo
#

Yes

cedar stream
# abstract kindle

If u want this to work with non cached messages too use on_raw_reaction_add

abstract kindle
#

What does non cached messages mean?

slate swan
abstract kindle
#

Also the user.send thing isn't working

#

I hate you @slate swan

slate swan
#

what

slate swan
cedar stream
abstract kindle
#

There is no error

#

In this case then would I use on_raw_reaction_add?

keen talon
#

Maybe try making it a str first

slate swan
abstract kindle
#

Oh okay, thank you for explaining

cedar stream
#

Just use raw version

slate swan
abstract kindle
#

I did, and it didn't lol

slate swan
#

Code?

abstract kindle
#

It probably has something to do with the fact that it's being reacted to in a DM

slate swan
#

send full code

cedar stream
#

Did u read the docs of on_raw_reaction add before doing it?

#

Because if you just changed the name it wont work

abstract kindle
#

This is most of the code for this part

slate swan
abstract kindle
#

It's mostly creating an embed, sending it, adding reactions to it, and then waiting for a reaction

slate swan
#

read the docs

cedar stream
cedar stream
abstract kindle
#

lmao what would i put for payload

cedar stream
abstract kindle
#

Ye i was just there

slate swan
cedar stream
abstract kindle
#

@slate swan I was trying to user wait_for earlier but it was giving me some trouble. Couldn't figure out the try: thing

slate swan
#

the try and except thing?

abstract kindle
#

yeah, I was confused with the whole def check() thing and such

#

So @cedar stream which one of those from that list would go in the parameters??

#

I don't know what to pick

slate swan
cedar stream
abstract kindle
#

so what do i put

#

in the darn parameter

slate swan
#

just payload

cedar stream
#

U put in payload

abstract kindle
#

Das it?

slate swan
#

yes

cedar stream
#

Payload is RawReactionActionEvent

#

So u can do payload.channel_id etc.

abstract kindle
#

ok it still didn't work 😦

slate swan
#

error?

abstract kindle
#

No error bro, idk what is happening

cedar stream
#

Show code

slate swan
#

full code

cedar stream
#

Send ss

slate swan
#

paste it, don't screenshor

cedar stream
#

I cant read pasted

abstract kindle
#

for this ENTIRE cog?

slate swan
cedar stream
#

Cus on mobile

slate swan
#

only the things related to your problem

cedar stream
#

No just event

slate swan
#

e.g. the event and the embed construction etc

cedar stream
#

Just send a ss of event and then paste the code

slate swan
#

yeah

abstract kindle
#

Ok this is most of it

keen talon
#

Not screenshots

cedar stream
abstract kindle
cedar stream
slate swan
keen talon
cedar stream
# abstract kindle

Basically you dont have user parameter anymore so you need to get it from payload

abstract kindle
#
    # REGISTERS THE USER // CREATES ACCOUNT IN masterdbmac.sqlite DATABASE
    @commands.command()
    async def register(self, ctx):
        temp_uid_check = []
        stored_uids = (c.execute("SELECT * from uids WHERE uniqueids = uniqueids").fetchall())      # DATABASE OF CURRENT UIDS
        stored_uids = convert_tuple_multi(stored_uids)
        for x in stored_uids:
            temp_uid_check.append(x)
        # GENERATE NEW UID
        uid = ''.join(random.choice(string.ascii_letters) for i in range(5))
        while uid in temp_uid_check:
            # IF THE UNIQUE ID ALREADY EXISTS, CREATE A NEW ONE
            print("This UID already exists. Generating another one.")
            uid = ''.join(random.choice(string.ascii_letters) for i in range(5))
        # IF THE UNIQUE ID DOESN'T ALREADY EXIST
        else:
            # def acc_creationcheck(m: discord.Message):
            #     return m.author == ctx.message.author and str(reaction.emoji) == '✅'
            check = message_check(channel=ctx.author.dm_channel)
            acc_start_embed = discord.Embed(title="Account Creation Started", description="What will your username be?",
                                  color=discord.Colour.dark_grey())
            await ctx.author.send(embed=acc_start_embed)
            username = await self.bot.wait_for(event = "message", timeout=30.0, check=check)
            acc_confirm_embed = discord.Embed(title=f"Create Account", description="Your account information is below. Please keep these!", color=discord.Colour.green())
            acc_confirm_embed.add_field(name="Username", value=f"{username.content}", inline=True)
            acc_confirm_embed.add_field(name="Unique ID", value=f"{uid}", inline=True)
            acc_confirm_embed.add_field(name="Create account?", value="React with ✅ to confirm your account creation.", inline=False)
            acc_confirm_embed.set_footer(text="Please remember your Unique ID. You will need it in the future.")
            acc_confirm_message = await ctx.author.send(embed=acc_confirm_embed)
            await acc_confirm_message.add_reaction('✅')
            await acc_confirm_message.add_reaction('❌')
            @commands.Cog.listener()
            async def on_raw_reaction_add(payload):
                if payload.emoji == '✅':
                    await user.send("Adding account to database...")
                    await asyncio.sleep(0.2)
                    with conn:
                        c.execute("INSERT INTO uids VALUES (:uniqueid)", {'uniqueid': uid})
                        c.execute("INSERT INTO users VALUES (:username, :id, :level, :experience, :coins)",
                                  {'username': username.content, 'id': uid, 'level': 1, 'experience': 0,
                                   'coins': 0})
                    await user.send("Account created successfully!")
                elif payload.emoji == '❌':
                    await user.send("Account creation terminated.")
cedar stream
#

It’ s underlined red

abstract kindle
#

IE payload.user.send?

slate swan
keen talon
abstract kindle
#

oh payload.member

cedar stream
#

payload.member.send

abstract kindle
#

No. I'm not learning more code. I just learned how to use SQlite and im a beginner to this stuff

abstract kindle
#

Wouldn't I have to learn a bunch of new syntax??

slate swan
#

not really

keen talon
#

It is very easy tbh

slate swan
#

surely there must be python libraries to interact with a mongodb database

cedar stream
abstract kindle
#

wtf man I wish this thing would give me som fuckin errors

cedar stream
slate swan
abstract kindle
#

I run code, do things, get 0 errors

keen talon
cedar stream
abstract kindle
#

Yes. It works up until I react to the message. Then nothing happens

slate swan
abstract kindle
#

Yeah, i wish my app would tell me that

keen talon
slate swan
slate swan
#

len(guild.members)

abstract kindle
#

either way, im probably gonna have to change to the wait_for thing

slate swan
#

or just guild.member_count

#

go through guild.members and only count the bots

abstract kindle
#

where would I put a print???? I already have the payload.member.send, would i just put print above that?

slate swan
#

at the beginning of the ebent