#discord-bots

1 messages · Page 626 of 1

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
#

Enable members intent in developer portal

#

Are you using the poop instance?

slate swan
slate swan
#
int = "string"

Does this make sense?

slate swan
#

No

#

Probably won't

#

Since int is a reserved keyword KEKL

#

True

slate swan
#

But client isnt neither is bot

sullen shoal
#

!e

int = str
print(int("1"))```
unkempt canyonBOT
#

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

1
sullen shoal
#

noobian be like

slate swan
#

It is correct if the code runs

#

The interpreter is the judge

#

Yeah i think im going to stop this conversation

tawdry perch
#

naming is still important that's it, you don' to make code that does not make any sense

slate swan
#

@slate swan read pep8

#

!pep8

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
PEP 8 document
Our PEP 8 song! :notes:

slate swan
#

I dont care about style guide

tawdry perch
#

btw listen to pep8 song

slate swan
#

@tawdry perch accept

slate swan
tawdry perch
slate swan
#

Then why practice python if you dont care about it?

slate swan
tawdry perch
#

shall we drop this topic, it might go outside a bit

slate swan
slate swan
#

I dont care if code is pythonic. Dont wanna know it truly im not marrying it

#

I like to use it to get stuff done

sullen shoal
#

do whatever you want kid

slate swan
#

Your just blocking yourself from learning and thats your fault

slate swan
slate swan
#

Not learning properly will bite you at the end

#

^

slate swan
sullen shoal
#

blocking someone never felt this good

slate swan
#

You can learn everything but in a interview what happens if your code isnt valid with pep8 and you lose your chance?

#

Scripts ive written been used by billion dollar company

#

Thats on YOU

slate swan
#

I dont need interview. I have job

floral fulcrum
#

This discussion is a bit off topic...

tawdry perch
#

Now it's time to possibly drop this

slate swan
#

Just move on, people are stubborn this is life..

tawdry perch
#

I don't want this channel to silenced

slate swan
#

Your just disagreeing with everything i say which is necessary

tawdry perch
#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

slate swan
# slate swan Yeah im done with you

Ok, like i said getting things done is the most important. If the context requires proper naming then yeah, otherwise for these guys discord bots. If its called bot or client is irrelevant

slate swan
tawdry perch
slate swan
#

And i know because ive been programming for 7 months and i know more than others due to the hunger of learning

#

Some ppl just wanna make stuff

tawdry perch
#

Can we not continue this?

slate swan
spring flax
#

@slate swan just stop please

slate swan
#

Will not be speaking anymore period.

spring flax
#

thank you

tawdry perch
#

.topic

lament depotBOT
#
**What feature would you be the most interested in making?**

Suggest more topics here!

slate swan
tawdry perch
floral fulcrum
#

Now stop please guys

spring flax
tawdry perch
#

That as well

spring flax
#

<@&831776746206265384> can someone just end the argument please

tawdry perch
#

Thank you

slate swan
daring olive
#

hello

tawdry perch
#

Welcome to chaos

grim oar
#

Hello

slate swan
#

TL;DR two people don't want to move on

tawdry perch
#

Smh

velvet tinsel
#

I am back

slate swan
#

I do i just wanna keep talking about discord bots

daring olive
#

everyone should respect the channel topic

velvet tinsel
#

There seems to have been an argument

daring olive
#

can that be done?

slate swan
#

It was i was saying it doesnt matter if they call it bot or client

velvet tinsel
#

And someone who followed a freecodecamp tutorial

slate swan
velvet tinsel
velvet tinsel
#

Oh nice a mod

vast gale
unkempt canyonBOT
#

3. Respect staff members and listen to their instructions.

rose shale
#

hey how can i record voice channel audio using bot?

velvet tinsel
velvet tinsel
sullen shoal
grim oar
rose shale
grim oar
rose shale
sullen shoal
velvet tinsel
grim oar
velvet tinsel
#

I mean you shouldn’t record without peoples permissions but I was about to make a bot for scratch and that’s really against the rules so I can’t say much and I love exploiting so I’m here to help you break the rules

#

…to a certain limit

slate swan
#

I mean recording someone without their consent isnt a good thing.

rose shale
rose shale
#

anyways thanks

daring olive
#

you are not here to help anyone break any rules to any limits

velvet tinsel
#

Ok 😞

slate swan
velvet tinsel
#

Is kraots back?

slate swan
#

!rule 5 @velvet tinsel

unkempt canyonBOT
#

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

velvet tinsel
sage otter
velvet tinsel
#

I forgot his name kraots, kroats, idk

slate swan
grim oar
velvet tinsel
slate swan
velvet tinsel
slate swan
#

Atleast you learned

#

It was a reasonable answer to the question i was asked

slate swan
#

No i would do it again tbh

grim oar
velvet tinsel
#

Ok let’s keep on topic

slate swan
velvet tinsel
#

Or I will ping the mod

daring olive
slate swan
#

See^

#

Idc, if you ask me dumb question again and demand an answer. The response will be same, maybe phrased more pc

velvet tinsel
#

She is always watching

sage otter
#

Yoooooo she really was lmao 😂

grim oar
#

He's my pet dw, you can abuse him too

pliant gulch
slate swan
spring flax
#

wth

grim oar
pliant gulch
#

Nah its on his fork but hes doing other stuff rn

slate swan
grim oar
#

O

velvet tinsel
#

What the what?

daring olive
#

!warn 431677941722906625 pls don't speak to community members like that. refer to #rules #code-of-conduct basic courtesy is expected from everyone

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @grim oar.

grim oar
#

what the hell

#

He's my friend lmao

velvet tinsel
#

What’s that anime

velvet tinsel
slate swan
rose turret
#

who will help me with login = 'admin'
password = input (login + ', enter the password to enter your personal account:')
ok = password == '123' I can't figure out how to create a register here so that when the password is incorrect so that the password is incorrect

velvet tinsel
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.

velvet tinsel
daring olive
velvet tinsel
rose turret
#

It has

slate swan
tawdry perch
#

this channel is somewhat a disaster, I'll come back tomorrow. Thanks everyone for helping me today and cya around 👋

velvet tinsel
velvet tinsel
velvet tinsel
#

It’s thanksgiving?

slate swan
daring olive
slate swan
velvet tinsel
grim oar
velvet tinsel
#

😭 but I think I’m thankful for python

slate swan
velvet tinsel
#

It’s my favourite language other than English and mandarin

grim oar
#

Let's not !ot

daring olive
velvet tinsel
#

If I ever had any 😭

slate swan
velvet tinsel
#

👍

#

I mean who doesn’t

slate swan
#

Hey Google, do you love me?

Of course, what would I do without you.

velvet tinsel
slate swan
velvet tinsel
#

Alexa loves me as well

slate swan
#

Ask monkaS

velvet tinsel
#

py_sun I see this above the sky everyday

slate swan
#

Ask if Alexa can be your valentine

velvet tinsel
slate swan
velvet tinsel
#

We have to stay on topic

spring flax
#

!ot

unkempt canyonBOT
velvet tinsel
#

She’s always watching

slate swan
#

Me: pyllow

spring flax
#

why is it so hard :sadge:

velvet tinsel
#

Because grumpchib

rose turret
#

Hello everyone who can me and correct a mistake in the code and fix it pazhalusta I'm just a beginner coder

rose turret
#

YES

slate swan
#

Well send it.

#

Since you're a beginner, don't share the bot token and use code blocks
```py

code here

```

#

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

rose turret
#

help code

daring olive
velvet tinsel
#

If youre a beginner you shouldn’t do dpy

#

Unless you mean you’re a beginner at dpy

slate swan
#

I learned that way wasnt the best way but i corrected myself

velvet tinsel
#

Anyways I wanted to do Game development before learning python but I didnt jump straight into PyGame, I learned the basics first

slate swan
#

Personally I've always learned a language by learning at least the basics and then moved to making a project. Same for Discord bots, although I knew Python kind of before

slate swan
velvet tinsel
#

(Back then I was really into scratch embarrassing) but then I got passionate about python

slate swan
velvet tinsel
#

I had a typo

slate swan
#

Yep

velvet tinsel
#

Sorry

velvet tinsel
slate swan
#

Dont listen to them, you dont need to know python in depth. Learn as you go along

#

U can easily learn using dpy, dpy makes things really simple and got good documentation

#

Can't you leave already?

#

Don't you have a job and work to do?

#

Nah u guys are toxic

velvet tinsel
#

😂

slate swan
#

We RECOMMEND it as its easier and more understandable.

#

U can learn lists using dpy, when u make a command that requires lists

velvet tinsel
#

I mean like you should

velvet tinsel
slate swan
#

Dpy is a nice framework for ppl to learn on, coz it gives them a nice end goal thats motivation

velvet tinsel
#

Copying a YT tutorial is not the way to go (I cant say much I learned dpy off a YT tutorial but at least I understood everything (nearly))

slate swan
#

No we are not, you were the one being toxic. All we said is that if you never touched Python and instantly starting by making a bot will get you confused and miss a lot of things.
Of course you can always learn Python by making a bot, you will just be much much slower as you will face a lot of issues.
You can technically learn Python by doing a YouTube clone.

velvet tinsel
#

true

#

I never did YouTube clones

slate swan
velvet tinsel
#

*cough *

slate swan
velvet tinsel
#

And the variables, json, dicts, arrays, tulles, asyncio, def, etc, etc

#

You need to cover these first

slate swan
#

My friend sent me some code, i made sense of what it doing and within a few hours i was good to go

daring olive
# slate swan Nah u guys are toxic

it's not toxic, it's good advice. that being said, of course with the right resources, people can learn python while learning dpy. however it's not toxic to say that it's recommended not to do so

tawdry perch
#

busy day for minaberry

velvet tinsel
#

^

digital sonnet
#

Hello

slate swan
slate swan
#

Ya so dont put ppl off making bot coz they are beginner

velvet tinsel
#

anyone can understand it easily given that it has a simple syntax

daring olive
#

people that want to start with dpy are fine to do so, they'll just have to climb a steep hill really early on.

velvet tinsel
tawdry perch
#

I feel like this discussion ends up to fight again ;-;

slate swan
#

Guess who started it

velvet tinsel
slate swan
velvet tinsel
#

If okimii is here he’ll do some anime moves

meager chasm
slate swan
#

!topic

unkempt canyonBOT
velvet tinsel
#

In python

tawdry perch
#

I had few questions but I really have to leave them to tomorrow

slate swan
slate swan
slate swan
stone moon
#

who can spoon feed me basic code ill give you a hug

velvet tinsel
slate swan
slate swan
slate swan
velvet tinsel
#

You dont learn like that

slate swan
#

Its very beginner friendly

stone moon
slate swan
stone moon
#

im sorry

velvet tinsel
meager chasm
velvet tinsel
#

And lists?

#

Functions? Client? Import? Variables? Tuples? Lists? JSON? Arguments? Class?

slate swan
maiden fable
meager chasm
velvet tinsel
maiden fable
meager chasm
#

Unless of course, you're encouraging them to glue code together @slate swan?

digital sonnet
#

Does anyone know how to get all guilds members in my python

slate swan
#

@slate swan everybodys point here is learn python first as its hard and complicated learning dpy without knowing the basics of python and as said its recommended not forced on anybody

maiden fable
unkempt canyonBOT
#

property users: List[discord.user.User]```
Returns a list of all the users the bot can see.
slate swan
velvet tinsel
#

I mean like two years ago if I looked at that list I would be like “ayo wtf”

silent ermine
#

Where is the docs for discord.Ctx?

velvet tinsel
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.

silent ermine
maiden fable
unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
velvet tinsel
#

Wrong place

grim oar
slate swan
#

I will come back in a few hours when it's actually some more relevant conversation. Currently looks like an IDE war or a "No x is the best language" war editorwar

velvet tinsel
#

I misled you there a bit sorry

slate swan
maiden fable
grim oar
#

O

velvet tinsel
maiden fable
#

Okay Okay can we calm down here?

velvet tinsel
slate swan
#

Please guys keep it respectful and on topic.

slate swan
velvet tinsel
slate swan
maiden fable
slate swan
#

If you're a beginner start learning django basics first shipit

velvet tinsel
slate swan
#

Im just saying dpy is beginner friendly

digital sonnet
maiden fable
velvet tinsel
slate swan
#

Guys please stop and keep it on topic

maiden fable
slate swan
#

Thats on topic and if u dont believe me. Just read the history of this channel and see how many beginners have half working bots

velvet tinsel
#

fine I’m pinging minaberry

maiden fable
velvet tinsel
#

@daring olive please stop this

slate swan
daring olive
#

i'm already here but i don't think i'm needed honestly

velvet tinsel
#

Ok

grim oar
slate swan
velvet tinsel
#

Help us 😫

slate swan
maiden fable
daring olive
#

!shhh

unkempt canyonBOT
#

✅ silenced current channel for 6 minute(s).

daring olive
#

so, i think the arguments for & against using dpy as a way of learning python being good vs bad have been hashed out enough. i don't see a need for that debate or discussion to continue. if it escalates often, then might be better to just not keep the conversation going.

thanks all

#

!unsilence

unkempt canyonBOT
#

✅ unsilenced current channel.

maiden fable
#

Phew thanks

tawdry perch
#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

grim oar
#

Thanks

velvet tinsel
#

thank god

slate swan
#

Thank you

velvet tinsel
#

Minaberry thank you so much

#

🙏

daring olive
#

i has personal dpy/discord bot question

tawdry perch
rose shale
#

👀 why everyone saying thank you

slate swan
daring olive
#

the one feature i actually liked from dyno was linking perms for viewing text channels with a user's connection to a specific voice channel

maiden fable
#

Yea

daring olive
#

it might have been a premium feature, i don't recall. and i used it way before i started learning python for other reasons

maiden fable
#

Me who never heard about it: pithink

grim oar
#

Same

digital sonnet
#

Anyone help me
Here is my code:

  print({len(guild.members)})```
maiden fable
#

Ah thats why. I never used premium

rose shale
daring olive
#

so say there's a voice channel, and then a text channel

maiden fable
#

Yea

daring olive
#

no one has perms to read the text channel, unless they're currently IN that voice channel

slate swan
#

Just assign role when they join vc and remove when they leave?

#

Ahhhh

daring olive
#

and when they disconnect, they lose perms to read the text channel

rose shale
#

oh

daring olive
#

mhm. is that not a common feature?

tawdry perch
#

is it role controller or no?

sage otter
#

yeah vcroles

daring olive
#

i liked it for personal friend servers. but it seems not to be that common

tawdry perch
#

if it is role controlled, then I have used it on my bot

velvet tinsel
slate swan
#

Yeah

slate swan
daring olive
#

a temporary role, yes

#

i think it's premium iirc

digital sonnet
# grim oar What's the problem

I need to get all guilds members but it doesn’t get all them together it gives every guilds members like this:
[282]
[893]
[293]

slate swan
#

It should be fairly easy to implement if u wanna remake it

slate swan
# daring olive and when they disconnect, they lose perms to read the text channel

Ahh.. You can either set roles for those channels with desired permissions and make the bot give the user the particular role when they join the voice channel... or... Actually discord also allows managing permissions of a channel per user (just like per role), so you can make the bot change the text channel permissions for that user

spring flax
#

yeah that is a premium feature

digital sonnet
velvet tinsel
digital sonnet
velvet tinsel
#

But its not an event so you’ll have to use a command

spring flax
grim oar
#

print([guild.member_count for guild in client.guilds])

velvet tinsel
digital sonnet
velvet tinsel
#

Yes?

#

Fire away

grim oar
#

!d discord.Guild.member_count

unkempt canyonBOT
#

property member_count: int```
Returns the true member count regardless of it being loaded fully or not.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
slate swan
#

@digital sonnet You're printing the len instead of the users of your array

#

Remove the len method from your print statement

grim oar
#

function

slate swan
#

🥲

pliant gulch
grim oar
#

Yes

pliant gulch
#

Its faster as well

slate swan
#

Im leaving see you guys👋

grim oar
#

Yes

#

Bye

maiden fable
pliant gulch
#

How so

maiden fable
#

Idk it did for me some time back, lemme see if I can find the code

meager chasm
#

it's adding numbers

digital sonnet
pliant gulch
#

🤔 I'm unsure where the error for clientuser would come from though, it only adds the member_count for each guild

maiden fable
pliant gulch
#

Doesn't touch ClientUser at all

slate swan
#

Is it possible to get the messageid of original message if a bot command is sent as reply to message?

meager chasm
maiden fable
#

Oh nvm

sage otter
maiden fable
#

Yea, just saw the difference

slate swan
daring olive
grim oar
unkempt canyonBOT
#
I'm sorry Dave, I'm afraid I can't do that.

No documentation found for the requested symbol.

slate swan
grim oar
#

The hell

#

Np

maiden fable
unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

slate swan
digital sonnet
slate swan
#

!d discord.Guild.members

unkempt canyonBOT
#

property members: List[discord.member.Member]```
A list of members that belong to this guild.
grim oar
#

Where did the resolved go

slate swan
#

!d discord.MessageReference.resolved

unkempt canyonBOT
#

The message that this reference resolved to. If this is None then the original message was not fetched either due to the Discord API not attempting to resolve it or it not being available at the time of creation. If the message was resolved at a prior point but has since been deleted then this will be of type DeletedReferencedMessage.

Currently, this is mainly the replied to message when a user replies to a message.

New in version 1.6.

grim oar
#

Oh

slate swan
#

The trouble is real..

grim oar
#

Lmao

slate swan
#

It was missing capital R

slate swan
#

Question: Umm If I fetch a user from the api and if it is not found, what error do api raise?

maiden fable
#

NotFound

grim oar
#

NotFound

maiden fable
#

!d discord.NotFound

unkempt canyonBOT
#

exception discord.NotFound(response, message)```
Exception that’s raised for when status code 404 occurs.

Subclass of [`HTTPException`](https://discordpy.readthedocs.io/en/master/api.html#discord.HTTPException "discord.HTTPException")
slate swan
#

I mean the http error code

grim oar
maiden fable
#

404

slate swan
#

Thanks!

maiden fable
grim oar
#

😩 ok

pliant gulch
#

Nova help me finish docs

digital sonnet
#

Thanks guys I figured it out!

maiden fable
#

lmao

#

Get to work Novia

meager chasm
#

go work novia

pliant gulch
#

I'm tired of writing rst I wanna do something cool

grim oar
#

Bro wai-

maiden fable
#

🤣

#

Writing docs is a real pain ngl

grim oar
#

I freaking wrote all the docs earlier in md, now he switched to rst and rewriting all the mess

pliant gulch
#

Your exams are over as well I think, perfect timing for you to hop on docs

meager chasm
maiden fable
#

🤣

pliant gulch
pliant gulch
#

And I switched docs to Sphinx

meager chasm
pliant gulch
#

I was using Mkdocs before

grim oar
maiden fable
grim oar
grim oar
pliant gulch
maiden fable
#

Ah

pliant gulch
grim oar
#

His http is a mess

#

How many lines it got lol 2k?

pliant gulch
#

5k now

meager chasm
maiden fable
#

🤣

grim oar
#

:kekwait:

pliant gulch
maiden fable
grim oar
pliant gulch
#

sphinx-auto-doc got me tripping

grim oar
#

Hahaha

pliant gulch
#

I cba to fix, its internal anyways

pliant gulch
slate swan
#

How do I make a command not work for only 1 person

grim oar
maiden fable
grim oar
#

😔

wild oak
#

you just gave me

slate swan
#

umm..

wild oak
#

a very good idea

slate swan
#

Lol Nice

grim oar
#

Congratulations aman

slate swan
#

Thanks 👀

meager chasm
#

congrats aman

slate swan
#

uhh

wild oak
#

lmao im talking about like a error code command so i can go like -error 404 and it will use the http cat website as a image so boom

#

brb ima go make it

grim oar
#

Nice 👍

meager chasm
#

hello, does anyone know if snekcord is still maintained? There was quite some chatter about it after discord.py was archived

wild oak
#

Alright im back

#

@slate swanGIve me a error code

#

@grim oaror you

slate swan
#

error code...?

wild oak
#

That like a website would spit out

slate swan
#

404?

grim oar
#

500

wild oak
#

ok

wild oak
meager chasm
#

429

grim oar
#

Good boy

wild oak
grim oar
#

I think that lancebot has that command too

wild oak
grim oar
#

Too many cats

wild oak
#

It might i just need ispiration lmao so ive been lurking

#

inspiration*

meager chasm
#

I'm scared to ask the owner, they are kinda creepy tbh

wild oak
#

lmao

grim oar
#

LMFAOO

pliant gulch
#

LMAO9

wild oak
#

creepy 😂

grim oar
#

I will show that to bozo!

pliant gulch
#

nova ping sleep

wild oak
#

@slate swan

#

im nova now

#

Ok actual question here

pliant gulch
#

Wrong sleep

grim oar
#

@pulsar shell

wild oak
#

damit

grim oar
#

That was hard

wild oak
#

sorry to the random person 😂

wild oak
grim oar
#

Yeah, there's ig a dog api too

meager chasm
#

gtg

wild oak
#

FR?

grim oar
wild oak
#

@pulsar shellLMAO

grim oar
wild oak
#

@grim oarcan you send it to me

#

whats the link for it

grim oar
#

Aaa lemme find

wild oak
#

ok

spring flax
# daring olive and when they disconnect, they lose perms to read the text channel

basically, you check if a user joins a voice channel (!d discord.on_voice_state_update for checking whether it was a join or a leave) then you just set the permissions using !d discord.TextChannel.set_permissions to either enable the permission or disable it.
Examples of TextChannel.set_permissions is

await text_channel_object.set_permissions(target_member, read_messages=False, send_messages=False)
daring olive
#

^ this is without the use of a temporary role right?

wild oak
#

uhhh

spring flax
wild oak
#

i pressed it 😩

pulsar shell
#

Yes snekcord is still maintained but I haven't found the time to work on it. Its actually undergoing a rewrite in another repository.

daring olive
#

yeah i like that implementation more

wild oak
#

whos bot is @lament depot

daring olive
#

made by the python-discord community!

#

.src

lament depotBOT
grim oar
wild oak
#

Does it have this command 😩

leaden jasper
#

how to run a task until complete

grim oar
wild oak
grim oar
wild oak
#

whoops

unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

velvet tinsel
#

How does python use the !e code?

grim oar
#

Yeet

pliant gulch
#

AbstractEventLoop

#

what

grim oar
#

Proactor

meager chasm
#

🤦

pliant gulch
#

Proactor :blobpain:

grim oar
#

Wtf

meager chasm
#

You can do it Novia, I believe in you

pliant gulch
#

Oh right

grim oar
#

Thanks

pliant gulch
#

!d asyncio.loop.run_until_complete

unkempt canyonBOT
#

loop.run_until_complete(future)```
Run until the *future* (an instance of [`Future`](https://docs.python.org/3/library/asyncio-future.html#asyncio.Future "asyncio.Future")) has completed.

If the argument is a [coroutine object](https://docs.python.org/3/library/asyncio-task.html#coroutine) it is implicitly scheduled to run as a [`asyncio.Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task").

Return the Future’s result or raise its exception.
grim oar
#

Wtf

grim oar
leaden jasper
#

how would u do that with a discord.ext.tasks.Loop object

velvet tinsel
#

How does python use !eval?

grim oar
#

It uses that thingy

velvet tinsel
#

Thingy?

pliant gulch
#

Snekbox api

grim oar
#

snekbox or what it's called

pliant gulch
#

!src eval

unkempt canyonBOT
#
Command: eval

Run Python code and get the results.

Source Code
velvet tinsel
#

Ok

grim oar
#

Yes

wild oak
meager chasm
#

It's easier to use piston

pliant gulch
#

Your gonna have to spin up your own uh docker container for it iirc

#

There isn't a online one

grim oar
velvet tinsel
meager chasm
grim oar
#

No it just stops working

meager chasm
#

I haven't faced any bugs yet

velvet tinsel
#

Thanks

grim oar
#

Some featured langs dont even work for me like java

velvet tinsel
#

Did you just say java

grim oar
#

Yes

velvet tinsel
meager chasm
outer violet
#

Is it possible to get the bot to send a message when the bot gets kicked from a server?

grim oar
#

😩

velvet tinsel
grim oar
velvet tinsel
#

It’s kicked

meager chasm
#

Also it's java do you actually expect it to work

grim oar
#

Lmfao

outer violet
#

Oh

wild oak
#

@grim oarsorry it took so long its just i typed it in wrong lmao

velvet tinsel
#

When does it ever work :pepecry:

slate swan
velvet tinsel
#

And they cant reach any users

slate swan
#

If they share any other server with the bot, it is possible

velvet tinsel
#

I mean like if there’s an official server for it ig

#

And they’re in it

#

(Which I doubt)

slate swan
#

Yea... maybe.. I just generalized the answer lol

velvet tinsel
#

Fair enough

meager chasm
velvet tinsel
#

Discord py is discontinued. Doesnt stop us from using it MWAHAHA cough

grim oar
#

just make your own wrapper guys 😳

velvet tinsel
leaden jasper
#

can u return stuff from a task loop

velvet tinsel
#

Working on that

#

Why did I receive this error

from discord import everything
discord.make_own_wrapper(name=“discord py but it is continued”)
make_it_work()

I specifically added a make_it_work() to make it work, what seems to be the problem?

pliant gulch
#

Don't make your own wrapper, add docstrings to mine

velvet tinsel
#

Andy help me with my code 🙏

pliant gulch
#

Have you tried making it work

velvet tinsel
#

I think i did

velvet tinsel
pliant gulch
#

blame discord then ¯_(ツ)_/¯

velvet tinsel
pliant gulch
#

ikr

velvet tinsel
#

😂

grim oar
#

ima go sleep now 😶‍🌫️ gn comrades

velvet tinsel
#

Nighty night

#

Meanwhile…its empty here.

#

There is no questions available.

#

I’m bored

meager chasm
velvet tinsel
#

@pliant gulch what do you want me to do on your github

meager chasm
#

I'll help too andy

pliant gulch
#

I'm like probably uhh 30% done

velvet tinsel
pliant gulch
#

I mean

#

You don't need to write docstrings, I need some reviewers rn

#

You can review the codebase for any issues, quality control basically

pliant gulch
velvet tinsel
meager chasm
#

Absolutely

#

Is this the repo?

pliant gulch
#

Yes, you can ignore all the docs btw

#

As I'm rewriting those rn, and I'll be ensuring the quality for them

#

Some things are half implemented so you might see a few **kwargs but I'll be fixing those while doing docstrings

meager chasm
#

looks like a better snekcord, I love these raw wrappers

velvet tinsel
#

I looked through, nice explanation using ””” but add a bit more comments

pliant gulch
#

Comments where?

pliant gulch
velvet tinsel
pliant gulch
#

Well state is internal

#

Its documented in the internal API-Reference

velvet tinsel
#

So you’re making some kind of listener?

pliant gulch
#

Holdon, do you want to move this convo into the lefi discord? Instead of flooding this channel

velvet tinsel
#

Yes, I think we got a bit ot

pliant gulch
#

The discord invite is in the documentation website, at the very top of the page

velvet tinsel
#

Ok

haughty path
#

hey does annyone know cuz i am new to coding and this stuff if is possible to make discord bot as your acc and normaly operate and ownership servers?

slate swan
#

help?

slate swan
#

Dont know much about because ive never done it before.

velvet tinsel
#

@slate swan you can use single backticks they look better

#

like this

slate swan
#

What do you mean?

#

Seems like user is None -> looks kind of more readable

velvet tinsel
#

this
VS this

velvet tinsel
#

screw english Im a programmer

slate swan
forest spear
#

Quick question does discord.User return with user's ID?

#

And if so is it in str?

velvet tinsel
#

Seems like user is None

#

seems like user is None

#

Which one would you prefer?

slate swan
#

This is how i see in mobile

velvet tinsel
#

oh

#

youre on mobile

slate swan
#

KEKL discord being discord

velvet tinsel
#

sorry 😦

slate swan
#

._.

#

Always different mobile and web app

velvet tinsel
#

:kek:

slate swan
#

Desktop

#

aka web app

velvet tinsel
#

Im planning on getting a new laptop

slate swan
#

It looks different

velvet tinsel
#

My computer crap

slate swan
#

Welp then nvm

velvet tinsel
#

I need a linux so I may get a linux because screw gaming I'm a programmer

slate swan
#

Im going to get my new desktop maybe monday or fridaypithink

#

Niceeee

#

So i can code without vsc crashingyert

velvet tinsel
#

Windows crap linux 👍

slate swan
#

Im getting it monday cuz its cyber monday

slate swan
velvet tinsel
#

I need an actual coding laptop

tawdry perch
slate swan
slate swan
velvet tinsel
velvet tinsel
tawdry perch
slate swan
velvet tinsel
#

guys tell me your dream day

slate swan
#

Mines a old hp so thats why im upgrading to a r5 with a 3060

slate swan
slate swan
velvet tinsel
#

Dell XPS 15 (2020) is this ok?

tawdry perch
slate swan
#

Dont know specs by just the name

velvet tinsel
#

I need a good computer guy

slate swan
#

cough cough

#

Maybeeee me......pithink

velvet tinsel
#

its too expensive

tawdry perch
manic wing
#

!ot

unkempt canyonBOT
slate swan
velvet tinsel
#

Acer Aspire 5 Slim Laptop maybe this

slate swan
#

Budget?

velvet tinsel
#

lets move to ot or lets go to DMs

dusk dust
#

how can i add role to ctx.author? (give me a example pls)

twin moon
#

 
@client.command()
@commands.cooldown(1,864000,commands.BucketType.user)
async def create_account(ctx):
    with open("users.json","r") as f:
        users = json.load(f)
    await ctx.send(f"{ctx.author.mention} check your DM's.")
    user = ctx.author
    try:
        await user.send("What should your username be?")
        username = msg = await client.wait_for('message', check=lambda message: message.author == guild.owner and isinstance(message.channel, discord.DMChannel))
    except asyncio.TimeoutError:
        await ctx.send("Please react in the given time.")
    else:
        if str(username) in users:
            await user.send("Username already taken.")
        else:
            try:
                await user.send("What should your password be?")
                password = await bot.wait_for('message', check = lambda x: x.channel == member.dm_channel and x.author == member, timeout=120)
            except asyncio.TimeoutError:
                await ctx.send("Please react in the given time.")
            else:
                await create_account(username,password,ctx.author)

async def create_account(username,password,user):
    with open("users.json","r") as f:
        users = json.load(f)
    if username in users:
        return None
    if not str(username) in users:
        users[str(username)] = {}
        users[str(username)]["username"] = str(username)
        users[str(username)]["password"] = str(password)
        users[str(username)]["creator"] = str(user.id)
        users[str(username)]["level"] = {}
        users[str(username)]["level"]["experience"] = 0
        users[str(username)]["level"]["level"] = 0
        users[str(username)]["economy"] = {}
        users[str(username)]["economy"]["money"] = 0
        users[str(username)]["economy"]["bank"] = 0
        users[str(username)]["economy"]["inventory"] = {}
        with open("users.json","w") as f:
            json.dump(users,f,indent=2)```
#

Json decode error 1 line 1 column

wild oak
#

@slate swan Can you give me that link for buttons again I can't find it

velvet tinsel
#

disnake > pycord tho

velvet tinsel
wild oak
#

what sorry

twin moon
# velvet tinsel send full error

nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)

wild oak
#

idk how or what to even do to start using them

dusk dust
velvet tinsel
velvet tinsel
wild oak
#

I'm slow gimme a break 😩

velvet tinsel
velvet tinsel
#

search it up

velvet tinsel
twin moon
# sullen shoal send entire trace back

Traceback (most recent call last):
File "C:\Users\Kinder\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Kinder\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Kinder\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)

sullen shoal
#

oh

velvet tinsel
sullen shoal
velvet tinsel
velvet tinsel
sullen shoal
#

it will return an error if the file is really empty

twin moon
#

and its json

sullen shoal
#

whats the content of it

twin moon
#

{

}

sullen shoal
#

that's it?

twin moon
#

yes

velvet tinsel
twin moon
velvet tinsel
#

or maybe not

sullen shoal
velvet tinsel
#

By really empty do you mean there's only {} or just blank?

velvet tinsel
#

like what myxi said

twin moon
placid escarp
#

Hey I'm making command that register the user by their discord ID(mongodb). So now I want to add if User already registered the bot return that you are already in.

I tried this:

    @commands.command()
    async def register(self, ctx):
      mongo_url = ""
      cluster = MongoClient(
        mongo_url
      )
      db = cluster["DNFT-registered-users(DISCORDBOT)"]
      collection = db["registered"]
      register = {
        "User": ctx.author.id,
      }
      if ctx.author.id in collection:
        return await ctx.send("You are in already")
      else:
        collection.insert_one(register)
        return await ctx.send("worked")
velvet tinsel
#

and?

velvet tinsel
twin moon
velvet tinsel
#

send full code

twin moon
# velvet tinsel to what?
@client.command()
@commands.cooldown(1,864000,commands.BucketType.user)
async def create_account(ctx):
    with open("users.json","r") as f:
        users = json.load(f)
    await ctx.send(f"{ctx.author.mention} check your DM's.")
    user = ctx.author
    try:
        await user.send("What should your username be?")
        username = msg = await client.wait_for('message', check=lambda message: message.author == guild.owner and isinstance(message.channel, discord.DMChannel))
    except asyncio.TimeoutError:
        await ctx.send("Please react in the given time.")
    else:
        if str(username) in users:
            await user.send("Username already taken.")
        else:
            try:
                await user.send("What should your password be?")
                password = await bot.wait_for('message', check = lambda x: x.channel == member.dm_channel and x.author == member, timeout=120)
            except asyncio.TimeoutError:
                await ctx.send("Please react in the given time.")
            else:
                await account_create(username,password,ctx.author)

async def account_create(username,password,user):
    with open("users.json","r") as f:
        users = json.load(f)
    if username in users:
        return None
    if not str(username) in users:
        users[str(username)] = {}
        users[str(username)]["username"] = str(username)
        users[str(username)]["password"] = str(password)
        users[str(username)]["creator"] = str(user.id)
        users[str(username)]["level"] = {}
        users[str(username)]["level"]["experience"] = 0
        users[str(username)]["level"]["level"] = 0
        users[str(username)]["economy"] = {}
        users[str(username)]["economy"]["money"] = 0
        users[str(username)]["economy"]["bank"] = 0
        users[str(username)]["economy"]["inventory"] = {}
        with open("users.json","w") as f:
            json.dump(users,f,indent=2)```
sullen shoal
#

db

placid escarp
#

database

#

yeah lol

twin moon
#

huh?

placid escarp
#

🥲

dusk dust
velvet tinsel
twin moon
#

huh?

dusk dust
#

i use this

velvet tinsel
sullen shoal
twin moon
#

for example...?

#

and how does it work?

sullen shoal
#

aiosqlite3 and stuff

dusk dust
sullen shoal
#

learn about databases online, you will get it

velvet tinsel
#

possibly

dusk dust
#

ok

placid escarp
#

use mongo

twin moon
#

I feel stalked

placid escarp
#

lol

sullen shoal
#

hoping you dont waste time fixing that shitty code which isnt even asynchronous

#

meaning the script will be blocked until it loads and saves the json

velvet tinsel
#

ok

pliant gulch
#

Just smack it in executor

#

to_thread can also work

slate swan
#

Even worse than spaghetti code imo

velvet tinsel
#

smack

twin moon
#

NOOOOO

slate swan
#

how can i check if a user is a bot?

twin moon
#

THE PROBLEM WAS IT CREATED A JSON

#

yea

#

now Ill stop using json

#

its "shit"

velvet tinsel
velvet tinsel
velvet tinsel
slate swan
#

lmao

velvet tinsel
#

use recaptcha

slate swan
#

Im back ladies and gentlemen pithink

velvet tinsel
#

or send a distorted text

#

and ask for user input

slate swan
velvet tinsel
slate swan
#

Havent checked docs

velvet tinsel
#

I mean like its busy sometimes but we can use this as ot

#

(mods, please excuse me)

slate swan
velvet tinsel
arctic python
velvet tinsel
#

Im in danger

slate swan
velvet tinsel
slate swan
velvet tinsel
#

we'll always seek

#

we'll always find

tawdry perch
#

Is this still off topic here ;-;

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

Please someone ask a question 😭

velvet tinsel
#

ask a question

tawdry perch
#

I have like 3 but I will wait till tomorrow

velvet tinsel
#

🔫

#

if you don't ask your question...

slate swan
#

I entered vsc and it immediately crashed😐

velvet tinsel
#

I will find where you live

slate swan
#

I want my pc already 😔

velvet tinsel
#

woah

slate swan
#

Programming discord bots isnt good with a bad laptop

#

my bot keeps trying to dm itself, how can i prevent that?

#
if discord.User.id == bot.user.id:
  pass
``` is what i have right now
slate swan
#

Does it work?

velvet tinsel
#

to check if True?

slate swan
velvet tinsel
slate swan
#

He wants to prevent the bot from dming itself

slate swan
# slate swan Make a check
botid = [913528283281358948]
def nobot(ctx): 
    pass ctx.member.id in botid

@bot.command()
@commands.check(nobot)
...``` this can work right?
velvet tinsel
velvet tinsel
#

this is beyond my experience

slate swan
#

oh wait, its for @bot.event

#

can u use checks in bot.event?

velvet tinsel
slate swan
slate swan
#

@events.check? pepeugh

slate swan
velvet tinsel
#

Idk

slate swan
#

Idrk hows your code so idk

velvet tinsel
#

never had an issue like this

#

so I have no idea how to fix

slate swan
#
@bot.event
async def on_guild_join(ctx):
    pass ctx.discord.Member.id in botid
    for member in bot.get_all_members():
...```
slate swan
manic wing
#

nah

#

subclass ctx

slate swan
#

Yes

velvet tinsel
#

I'm gonna watch this

manic wing
#

or subclass discord.abc.Messageable

velvet tinsel
#

my maths answer was incorrect

slate swan
velvet tinsel
slate swan
velvet tinsel
velvet tinsel
# slate swan Hm

have I told you the time when I tried to use try/except on a dpy command?

#

didn't work out too well

#

lets not delve into the details

velvet tinsel
sage otter
#

what’s wrong with that? I use that plenty in my commands.

#

I use all three actually for my color command. try/except/finally

slate swan
#

I think he ment a bare except

arctic python
velvet tinsel
velvet tinsel
velvet tinsel
velvet tinsel
#

I used it for a discord error in which it ignores

sage otter
#

Elaborate.

velvet tinsel
#

*to specify I used a cooldown()

slate swan
velvet tinsel
#

and then did except

velvet tinsel
arctic python
slate swan