#discord-bots

1 messages ยท Page 846 of 1

supple crescent
#

that pops up

slim ibex
#

does it tell you in the trace back which specific line raises the rrror

#

Error*

supple crescent
#

wait im gonan restart it

#

ok now theres a new paert

#

File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\NAME\Documents\Python\discordbot.py", line 25, in contact
admin_role = guild.get_role.int(945326991526219848)# Replace with id of admin role
AttributeError: 'function' object has no attribute 'int'

#

admin_role = guild.get_role(945326991526219848)

#

thats the line ^

honest vessel
#

AttributeError: 'function' object has no attribute 'int'

#

thats the error ^

supple crescent
#

alr

#

so thats weird

#

i dont know discord.py very well how would i fix this?

placid skiff
honest vessel
#

admin_role = guild.get_role(945326991526219848)

#

not the line ^

#

admin_role = guild.get_role.int(945326991526219848)

#

the line ^

slim ibex
#

!d discord.Guild.get_role

unkempt canyonBOT
honest vessel
#

guild.get_role**.int**

quaint epoch
slim ibex
#

?

honest vessel
#

omg

quaint epoch
placid skiff
slim ibex
#

^

quaint epoch
#

oh yeah, i forgor

slim ibex
#

๐Ÿ’€๐Ÿ’€

honest vessel
#

that looks shit tbh

supple crescent
honest vessel
#

lol

#

dode remove the .int

placid skiff
#

Bro don't tell him directly hahaha

slim ibex
#

the method is get_role()

quaint epoch
honest vessel
supple crescent
#

but thats what i put before?

honest vessel
#

thats whats wrong

quaint epoch
#

why did you want to add the .int?

supple crescent
placid skiff
#

what is the error?

quaint epoch
honest vessel
#

that its an int

slim ibex
#

the id you passed is already an intlemon_raised_eyebrow

supple crescent
#

AttributeError: 'function' object has no attribute 'int'

quaint epoch
slim ibex
#

^

placid skiff
#

that's because you are adding an .int that is not an attribute of that class/method

supple crescent
#

oh.

honest vessel
#

@placid skiffits not moai

slim ibex
#

I wish people actually learned Python before doing dpy

#

?

placid skiff
honest vessel
#

i like how this guy had easiest error, and all seems confused

quaint epoch
#

either do role = discord.utils.get(await ctx.guild.fetch_roles(), id=945326991526219848) or role = ctx.guild.get_role(945326991526219848) pick one

honest vessel
#

he is doing the last one

quaint epoch
honest vessel
#

but he types get_role.int() for a reason

#

guild.get_role(int(945326991526219848)) ? but very unncesary

slim ibex
#

idk bro Iโ€™m gettin off for a bit. Such a simple problem with a simple fix but my brain blew up

quaint epoch
#

cya

slim ibex
#

some dude is bringing up discord.utils.get ๐Ÿ—ฟ

quaint epoch
honest vessel
#

@slim ibexyoung folks wanna do cool-bots but not learn to code ๐Ÿคท๐Ÿปโ€โ™‚๏ธ

quaint epoch
#

deep down we all know we prefer api calls

silent ermine
slim ibex
silent ermine
honest vessel
#

..channel?

slim ibex
sage otter
#

Thatโ€™s an internal error

#

With the library

silent ermine
honest vessel
#

@silent erminewhat is ur goal even?

sage otter
#

Omfg dude

#

Itโ€™s literally a library error

quaint epoch
#

message and channel id, hmmm, like a DM message?

sage otter
#

Look at the origin of the traceback

slim ibex
#

mhmm

honest vessel
#

@sage otterhaha ur right

#

@silent erminecan u show ur code tho? for fun

sage otter
#

He needs to update. Or re-install the lib.

pliant gulch
#

What do you know, pycord sharing the same namespace as discord.py has fucked up already!

honest vessel
#

or just give up discord.py cause its outdated soon big time

pliant gulch
#

This error is due to you having pycord and discord installed at the same time, I assume

honest vessel
#

its only gonna last 1 more year

pliant gulch
#

As you were using pycord earlier, and also using discord.py

quaint epoch
honest vessel
#

200IQ andy

final iron
#

Pycord ๐Ÿ˜”

honest vessel
#

disnake > all

placid skiff
#

disnake is the final boss, only few can afford to face it

kindred epoch
#

no one can anymore

cold sonnet
quaint epoch
#

people here be codin' bots, but THEY be the bots, not reading the documentation, using pycord, and immediately sending tracebacks to this channel when they get them.

cold sonnet
#

tracebacks not even coming from the discord lib

placid skiff
cold sonnet
#

cogs dogs
docs โŒ

placid skiff
#

HAHAHAHAHAHA

#

i'm workin' and writin' in this channel right know, my multitasking is not that good

silent ermine
silent ermine
placid skiff
#

do you know python?

silent ermine
#

yes

placid skiff
#

then you should know what you have to do D_D

silent ermine
#

o-o

honest vessel
#

@placid skiffbe carefull mods muted me for a week for not helping

#

and tell em to learn python

placid skiff
#

it's one of the simplest error of python D_D

placid skiff
honest vessel
#

cause he didnt know how to declare a variable

placid skiff
#

BRUH

honest vessel
#

๐Ÿ˜ฆ was my fault telling him

placid skiff
#

i will never tell someone who's creating a bot how to declare a variable .-.

honest vessel
#

@placid skiffur banned!

silent ermine
#

wait hold on, if im using pycord why does discord need the dependency discord.py

placid skiff
honest vessel
#

๐Ÿ˜„

silent ermine
#

cuz im confused

slate swan
#

first thing first, it used discord namespace and poetry is treating it as the discord.py package

placid skiff
#

pycord is a fork of discord.py, so yes, you have to replace all discord namespace into pycord

slate swan
#

they dont use the pycord namespace~

#

they're like, ok "we are the new discord.py" :bruh:

honest vessel
#

but basicly i guess u can

#

i dont know when they forked discord.py and when they took their own path in the code

#

i would suggest ditch both and move to disnake

silent ermine
slate swan
#

what?

honest vessel
#

lol why?

placid skiff
#

PUHAHHAHAHAHAHAHHAHAรน

honest vessel
#

it took me 5min to convert my old discord.py bot to disnake xD and it runs nice

slate swan
#

if you just "not" used replit, all pycord, discord.py and disnake would work perectly

placid skiff
honest vessel
#

ah

placid skiff
#

well yeah i wanted to do something more professional

honest vessel
#

my new bot i workon on the side is from scratch with disnake

placid skiff
#

my old code was a shit in terms of enviroment

honest vessel
#

old codes always sucks ๐Ÿ˜„

#

thats fun when u make new ones u see big diffrences

placid skiff
#

that's true

honest vessel
#

first bot are always like psudeo code

#

then when it grows u realise u should have done it prooperly first

#

like my new bot that is subclassed n uses disnake will be my template

placid skiff
#

Now i'm not codin' a lot on my project cuz first i'm searchin' for some API that no-one can't find and i'm workin for another bot xD

honest vessel
#

for future bots

#

api that dosnt use api-keys

#

REEEEE ๐Ÿ˜„

#

like twitch want u tomake account connect phone and all diffrent steps to get a shitty api-key

#

i rather just find a way to get the data i want without api

placid skiff
honest vessel
#

same with youtube with api i could check page like once 10min ........ i figured out a way without api and can check page in 2 seconds instead

#

not banned

honest vessel
#

^

#

just memic a browser

placid skiff
#

Yeah, web scrapin' is good

#

When you have a page to scrape ๐Ÿ˜‚

honest vessel
#

if am not misstaken google was first coded in python

#

or partly

placid skiff
#

I thought that google was older then python xD

honest vessel
#

when they started their garage-web-search

hoary cargo
#

it may be even now for some parts

honest vessel
hoary cargo
honest vessel
#

python came 91' google 96

placid skiff
#

Oh cool

honest vessel
#

It used nearly half of Stanford's entire network bandwidth. LOL!

placid skiff
#

Btw a lot of company are using python now

hoary cargo
#

why wouldn't they artistic_hmm it's a good language

honest vessel
#

ye python has grown alot

#

usally at "jobs" they try recruits here it was like c++ mostly or perl

#

now its python alot

placid skiff
#

But not in Italy, where I live
In Italy they only search for java and react ๐Ÿ˜‚ ๐Ÿ˜‚

honest vessel
#

haha

hoary cargo
#

there are still js fanboys be like "**b-but python is slow **cryge"

honest vessel
#

so slow ๐Ÿ˜„

#

if want speed dont even do js

#

go to c/c++ and partly asm

#

for speed

placid skiff
#

I learned asm when i studied uC

hoary cargo
#

MR_canny_meh_stage tbh now i learn python as a hobby, maybe in the future i'll be able to get a job in this zamn

maiden fable
#

!ot thanks

unkempt canyonBOT
hoary cargo
rare saddle
#

What causes the bot to throw an error when using this command? The bot has default rights

hoary cargo
#

you can't just randomly come in here and throw an ot stuff

honest vessel
#

i learned little asm not to code but to understand little when doing C/c++ Bufferoverflows etc and learn cracking

rare saddle
unkempt canyonBOT
kindred epoch
placid skiff
jagged root
#
async def mute(ctx,
               member: disnake.Member,
               *,
               time: TimeConverter = None,
               reason = None):

    embed = disnake.Embed(
        description=f"{ctx.author.mention} muted {member.mention} for {reason}",
        colour=0x020000)
    channel = bot.get_channel(928776378105614376)
    await channel.send(embed=embed)

    role = ctx.guild.get_role(874708561178034186)
    if role not in ctx.author.roles:
        return
    await member.timeout(duration=time)
    await ctx.send((
        ":BeFunkyphoto20220219T204302: Muted {} for {} seconds."
        if time else "").format(member, time, reason))

    if time == "s":
        time = 1 * time
    elif time == "m":
        time = 60 * time
    elif time == "h":
        time = 3600 * time```

**Reason is always None** but time works ** can someone help me please**
hoary cargo
maiden fable
#

it will always be None

#

since u can only pass in one kwarg in the command

jagged root
#

how could i fix it

honest vessel
#

*,

#

this is ur issue

maiden fable
honest vessel
#

^

jagged root
#

let me try, thanks

hoary cargo
placid skiff
rare saddle
honest vessel
jagged root
#
               member: disnake.Member,
               *,
               time: TimeConverter = None,* ,
               reason = None):``` invalid syntax
honest vessel
#

lol

#

remove first *,

#

u can only have 1 *

jagged root
#

hope itll still work

honest vessel
#

and dont use spaces in ur time ๐Ÿ™‚

drowsy condor
#

How to make it show how many people and bots are on the server?

jagged root
placid skiff
drowsy condor
#

How

slim ibex
jagged root
slim ibex
#

@bot.command() or something like that

jagged root
#

mb

placid skiff
# drowsy condor How

guild.members returns a list of member object, iterate through that list and check if the member you are iterating returns true with member.bot

hoary cargo
#

!d disnake.AutoShardedClient

unkempt canyonBOT
#

class disnake.AutoShardedClient(*args, loop=None, **kwargs)```
A client similar to [`Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") except it handles the complications of sharding for the user into a more manageable and transparent single process bot.

When using this client, you will be able to use it as-if it was a regular [`Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") with a single shard when implementation wise internally it is split up into multiple shards. This allows you to not have to deal with IPC or other complicated infrastructure.

It is recommended to use this client only if you have surpassed at least 1000 guilds.

If no [`shard_count`](https://docs.disnake.dev/en/latest/api.html#disnake.ShardInfo.shard_count "disnake.ShardInfo.shard_count") is provided, then the library will use the Bot Gateway endpoint call to figure out how many shards to use.
hoary cargo
placid skiff
#

One day i found something like a debuggin' mode which let you don't rerun the code to apply changes, was i drunk or it really exists?

supple crescent
#

it doesnt say whats causing it but wtf is this:DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternative from distutils import errors

slate swan
#

so you wont need to run the bot again and again

#

just make a command which reloads the cogs

placid skiff
hoary cargo
#

PopcornPepe load reload unload, basic 3 commands for cog users

placid skiff
#

My bot is subclassed so sometimes i made changes on the bot too, and my checks and other stuff are set outside of cogs

supple crescent
final iron
#

Bro

#

๐Ÿ—ฟ

hoary cargo
#

DeprecationWarning

final iron
supple crescent
final iron
#

Bruh

final iron
supple crescent
hoary cargo
#

MR_uncanny_1 ok slab of meat

supple crescent
honest vessel
honest vessel
#

ah good

#

damn weather is not nice today

#

yall got stormy weathers today?

final iron
#

I got a shit ton of snow a couple of days ago

honest vessel
#

ah we got shit ton of snow now

#

(sweden)

dull terrace
#

Hey can I ask a newbie question. What's best practice according to pep8 while coding a class, drinking whiskey or vodka?

honest vessel
#

the answer is not included in options but beers, if not coke n rom, but i guess whiskey works vodka too vine too,

dull terrace
#

Oh, I didn't even realise I could use beer in a class

honest vessel
#

now am confused ๐Ÿ˜„

dull terrace
#

๐Ÿป

honest vessel
#

you mean python class or class in general?

#

distance-class?

honest vessel
dull terrace
#

I may be breaking standards by drinking whiskey but old habits are hard to break

honest vessel
#

haha ๐Ÿ˜„

#

well i also have hard to break old habits so i run beers

rare saddle
#

Please tell me what I need to add to the code to avoid this error?

honest vessel
#

(i think they should allow OT here when there is no help needed)

#

@rare saddlethat is 99% u forgot await

slim ibex
#

^

honest vessel
#

oh wiat it even sait it

slim ibex
#

๐Ÿ’€

rare saddle
#

thanks

slim ibex
#

Read your tracebacks kids

honest vessel
#

first time i saw that error i was like malloc (RAM, memmory) WTF? ๐Ÿ˜„

slim ibex
#

memory allocation

honest vessel
#

yea

#

the other error is more explainable "its a courotine"

slim ibex
#

mhmm

honest vessel
#

but for a first time it can be confusing with malloc

#

google, and its about memory ๐Ÿ˜„

slim ibex
#

c# actually has a stackalloc keyword to allocate memory on the stack. Kinda cool

slate swan
#

!ot

unkempt canyonBOT
slim ibex
#

wow

honest vessel
slim ibex
#

Ashley was lurking for the perfect moment

honest vessel
#

we help if need and can

maiden fable
#

Lmao

#

She is always waiting for the time to use the ot command

slate swan
slim ibex
#

๐Ÿ—ฟ

honest vessel
#

she just wanna look good -> chasing roles

dull terrace
#

who was off topic

slate swan
honest vessel
#

๐Ÿ–๐Ÿป i was

slim ibex
#

lemon

rare saddle
slate swan
#

lmao

dull terrace
rare saddle
#

If this condition

dull terrace
#

if await managechannel(self)

honest vessel
dull terrace
#

i would guess

maiden fable
slim ibex
#

The fuck

slate swan
slim ibex
#

never seen if โ€ฆ(self) before

rare saddle
maiden fable
#

Yea, it was Eevee

honest vessel
#

so many wrongs

slim ibex
#

^

dull terrace
#

you lost the : at the end

slate swan
slim ibex
#

This code is so weird

#

what is this return not doing

honest vessel
#

@nimble plumenot my code lol

maiden fable
honest vessel
#

indentation is wrong

#

and uses self randomly

nimble plume
dull terrace
#

i saw the worst indentation ever on a newbies help channel

#

it was like 3 spaces then 3 then 1

honest vessel
#

๐Ÿ˜„

slim ibex
rare saddle
honest vessel
#

4 spaces* btw

nimble plume
#

im in vc )

slate swan
#

return not is a thing?

slim ibex
#

do you not know what not does)

honest vessel
#

return return

nimble plume
dull terrace
slate swan
honest vessel
#

return False*

maiden fable
slim ibex
upbeat otter
maiden fable
#

Oh u ๐Ÿ‘€

nimble plume
#

return True

maiden fable
#

Long time

upbeat otter
honest vessel
#

return 1

slim ibex
#

return not True returns False

upbeat otter
slate swan
maiden fable
honest vessel
#

return sys.exit()

nimble plume
dull terrace
#

!e

def func():
  return not

print(str(func()))```
unkempt canyonBOT
#

@dull terrace :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     return not
003 |               ^
004 | SyntaxError: invalid syntax
dull terrace
#

no it's not a thing

dull terrace
#

its not not a thing

#

not

maiden fable
nimble plume
#

huh?

slim ibex
#

!e

def return_bool(x: int) -> bool:
    if x > 10:
        return not True
    else:
        return not False

print(return_bool(5))
unkempt canyonBOT
#

@slim ibex :white_check_mark: Your eval job has completed with return code 0.

True
nimble plume
#

ok?

slate swan
slim ibex
#

It exists @dull terrace, you just didnโ€™t specify something to return

pliant gulch
#

!e print(True + True)

unkempt canyonBOT
#

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

2
nimble plume
#

woah

slim ibex
#

but makes sense

pliant gulch
#

True and False are really just ints

dull terrace
nimble plume
#

woah

slim ibex
#

0 is false
1 is true

nimble plume
honest vessel
#

no

nimble plume
#

!e print(True + False)

unkempt canyonBOT
#

@nimble plume :white_check_mark: Your eval job has completed with return code 0.

1
nimble plume
#

woah

maiden fable
#

andy do be flexing ๐Ÿ‘€

honest vessel
#

0 is 0, 1 is 1, True is True, False is False

nimble plume
#

!e print(False + False)

unkempt canyonBOT
#

@nimble plume :white_check_mark: Your eval job has completed with return code 0.

0
pliant gulch
honest vessel
#

!e print(1+0+True+False)

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

2
maiden fable
nimble plume
#

epic fail

slate swan
slim ibex
#

!e print ((True == True) == True)

unkempt canyonBOT
#

@slim ibex :white_check_mark: Your eval job has completed with return code 0.

True
maiden fable
dull terrace
#

!e print("print")

unkempt canyonBOT
#

@dull terrace :white_check_mark: Your eval job has completed with return code 0.

print
honest vessel
#

!e if 1 == True or False == 0:
print(True)

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

True
maiden fable
#

U all do know that #bot-commands exists, right?

slim ibex
#

yeah

slate swan
maiden fable
#

Then why not use it

nimble plume
#

!e

unkempt canyonBOT
#
Command Help

!eval [code]
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

nimble plume
#

!e

a = False + False
b = False + True
if a != b:
    return not True
else:
    return not False
unkempt canyonBOT
#

@nimble plume :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 4
002 | SyntaxError: 'return' outside function
nimble plume
#

ah wait

maiden fable
honest vessel
#

SyntaxError: 'return' outside function

#

๐Ÿ˜

slim ibex
#

๐Ÿ—ฟ

slate swan
dull terrace
#

everyone knows what github is, i just dont know how to use it because im newbie coder ๐Ÿฅบ

maiden fable
#

why tho

dull terrace
#

i just manually back up everything to google drive

nimble plume
#

!e

a = False + False
b = False + True
if a != b:
     print(not True)
else:
    print(not False)
unkempt canyonBOT
#

@nimble plume :white_check_mark: Your eval job has completed with return code 0.

False
maiden fable
slate swan
maiden fable
#

Sure

slim ibex
#

!e print((True == True) ^ False)

honest vessel
#

ok chill down chat ๐Ÿ˜›

nimble plume
#

woah

dull terrace
#

why are we doing 1 + 1 in eval

nimble plume
dull terrace
#

do maff in head

slim ibex
#

XOR ๐Ÿ—ฟ

nimble plume
#

huh?

slim ibex
#

!e print((True & True) | (True ^ False) ^ False)

unkempt canyonBOT
#

@slim ibex :white_check_mark: Your eval job has completed with return code 0.

True
honest vessel
#

yeye

dull terrace
#

wait wtf does the and symbol do

slim ibex
#

Bit wise and

#

both conditions on each side have to be true for the statement to evaluate to true

cobalt jacinth
#

is it possible to integrate website with discord bot on server side..like...i use discord command to generate website page and both website and discord bot share same database

slim ibex
dull terrace
#

!e

coding_skill = "shit"
cows_make = "shit"

if cows_make & coding_skill:
  print("shit")
unkempt canyonBOT
#

@dull terrace :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | TypeError: unsupported operand type(s) for &: 'str' and 'str'
honest vessel
#

KEK WTF?

cobalt jacinth
dull terrace
slim ibex
#

you would use and there @dull terrace

nimble plume
#

moai u know who am i/????/

honest vessel
#

pip install os

unkempt canyonBOT
#

@nimble plume :white_check_mark: Your eval job has completed with return code 0.

Hello World!
dull terrace
#

then why would you use &

nimble plume
#

๐Ÿ˜Ž

honest vessel
#

obfuscated code ๐Ÿคค

slim ibex
#

and and & are different

dull terrace
#

yeah i asked what & is for

slim ibex
#

!e

coding_skill = "shit"
cows_make = "shit"

if cows_make and coding_skill:
  print("shit")
dull terrace
#

ive never seen it

honest vessel
#

@nimble plumethats what u give noobs here copy pasta this

nimble plume
dull terrace
#

!e

val = 1
print(str(val & val))```
unkempt canyonBOT
#

@dull terrace :white_check_mark: Your eval job has completed with return code 0.

1
dull terrace
#

๐Ÿค”

slim ibex
#

&, |, ^, ~, <<, >> are all bitwise operators

honest vessel
#

@nimble plumekinda fun tho, just takes time figure out without run it ๐Ÿ˜„

dull terrace
#

!e

val = 2
print(str(val & val))```
unkempt canyonBOT
#

@dull terrace :white_check_mark: Your eval job has completed with return code 0.

2
slim ibex
#

They are for comparing binary numbers

dull terrace
#

idk what bitwise means

slim ibex
#

and, or, not are logical operators

honest vessel
#

it means your wise with bits

dull terrace
#

so only 0,9 and comparing them

nimble plume
#

,import('collections').defaultdict(int),0,0,0,import("sys").st

#
,__import__('collections').defaultdict(int),0,0,0,__import__("sys").st
``` main worker
slim ibex
#

In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic operations and directly supported by the processor. Most bitwise operations are presented as two-operand inst...

nimble plume
#

~e

slim ibex
#

We should prolly move to ot at this point

#

!ot

unkempt canyonBOT
nimble plume
#

ok no ot now

nimble plume
honest vessel
#

i will run it not

nimble plume
#

it only looks sense

#

smh

honest vessel
#

back to busniess now yall had 5min break

dull terrace
#

holy crap, when would that ever be practical to use

nimble plume
#

!e

__import__('collections').defaultdict(int),0,0,0,__import__("sys").stdin.read
unkempt canyonBOT
#

@nimble plume :warning: Your eval job has completed with return code 0.

[No output]
nimble plume
#

hmm

honest vessel
#

no output cause no print

nimble plume
#

yes

honest vessel
#

duh

nimble plume
#

i didnt see any print smh there

honest vessel
#

!e
a = import('collections').defaultdict(int),0,0,0,import("sys").stdin.read
print(a)

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

(defaultdict(<class 'int'>, {}), 0, 0, 0, <built-in method read of _io.TextIOWrapper object at 0x7f058aeccc70>)
nimble plume
#

come on ot ok?

#

come #bot-commands

honest vessel
#

!e
print("Keep it ON TOPIC NOW PLOX")

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

Keep it ON TOPIC NOW PLOX
nimble plume
#

lol

#

i thought it worked

quick gust
#

!ot

unkempt canyonBOT
nimble plume
unkempt canyonBOT
#

The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.

quick gust
#

go to #bot-commands

nimble plume
nimble plume
cold sonnet
#

yeah, please stop

maiden fable
#

Good thing I was not here

rare saddle
#

How to draw conclusion for this error? Occurs in on_ready

quick gust
#

your bot doesnt have access to edit guild command permissions

#

i guess

slim ibex
#

whatโ€™s the on_ready

#

Show code

rare saddle
rare saddle
sick birch
#

I wouldn't do that on_ready

slim ibex
#

^

sick birch
#

If you're sending API requests on_ready there's a decent chance you're going to get disconnected, and also on_ready can happen multiple times and behave in unexpected ways

rare saddle
maiden fable
#

Oh Robin ๐Ÿ‘‹

final iron
unkempt canyonBOT
#

@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.

This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").

This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
final iron
#

Just use the check

slim ibex
#

That doesnโ€™t check if they are the owner of the guild

final iron
#

Oh

#

!d discord.Guild.owner

unkempt canyonBOT
#

property owner: Optional[discord.member.Member]```
The member that owns the guild.
rare saddle
final iron
slim ibex
cold needle
#

how to ping a role in a embed

slim ibex
#

or in the command do,

if member not ctx.guild.owner:
    return
cold needle
slim ibex
#

!d discord.Role.mention

unkempt canyonBOT
cold needle
#

?

#
                           color=11177686)```
#

this not working

slim ibex
#

yeah thatโ€™s not how it works

#

^

cold needle
#

how

unkempt canyonBOT
cold needle
#

how in my embed

slim ibex
#

you get the role in a variable and do variable.mention in the embed

cold needle
#
                           color=11177686)```
quick gust
#

no...

cold needle
#

i dont use ctx

#

async def on_message(message):

slim ibex
#

If you are pinging s different role for the command, the role could be a param for the function

#

oh fuck not on_message commands

cold needle
#

ok will try

slim ibex
#

^

quick gust
slim ibex
#

^

#

as I said

cold needle
#

idk why but i dont get pingt

#
       
        em = discord.Embed(description=f"Keyword match detected.{role_obj.mention}",
                           color=11177686)```
#

but i didnt got pingt and i have the role

slim ibex
#

It doesnโ€™t actually ping you

bold surge
#

you did not get pinged because its in an embed

cold needle
#

bruh

bold surge
#

ยฏ_(ใƒ„)_/ยฏ

cold needle
#

then i need to send in a normal message

slim ibex
#

โ”ฌโ”€โ”ฌ ใƒŽ( ใ‚œ-ใ‚œใƒŽ)

quick gust
#

you can send the embed, and the ping in the same message. .send() has a content and embed kwarg

bold surge
#

^

cold needle
#

ah ok it thx

final iron
#

!d discord.abc.Messageable.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**.
quick gust
#

there you go

#

first kwarg

cold sonnet
#

it's before the star

final iron
#

content is before the star, therefore, not a kwarg

quick gust
#

oh right

#

mb, i keep confusing kwargs and args lol

pliant gulch
#

content here can be either a kwarg or a pos-arg

#

* makes all args after it a kwarg ONLY argument

slim ibex
#

Andy has arrived

pliant gulch
#

But, of course content still can be a kwarg

quick gust
#

it's usually a kwarg when u are giving it another kwarg. Otherwise throws an error I think

pliant gulch
slim ibex
#

I never understood with / is in a function signature

#

pass_context is old

pliant gulch
pliant gulch
#

!e ```py
def foo(bar, /, baz) -> None:
...

foo(bar=1, baz=2)

unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | TypeError: foo() got some positional-only arguments passed as keyword arguments: 'bar'
slim ibex
#

by not using it

frigid pendant
#

how would i loop through all the users in the server? could i do

for i in range(ctx.author.guild):
  print(i)
slim ibex
#

It wasnโ€™t going to fix the issue

slim ibex
#

you arenโ€™t using range correctly

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.

rigid peak
#

ok so im struggling rn

maiden fable
#

with?

rigid peak
#

im getting a ss one sec

final iron
rigid peak
maiden fable
#

?

rigid peak
maiden fable
#

import os at the top of the file

slim ibex
slim ibex
maiden fable
#

ยฏ_(ใƒ„)_/ยฏ

rigid peak
#

but I-

#

then it does this

#

๐Ÿ†˜

maiden fable
#

the token is None

#
from dotenv import load_dotenv
load_dotenv()
#

at the top of the file

naive spoke
#

what do async def mean

maiden fable
#

!d async

unkempt canyonBOT
#

8.9. Coroutines

New in version 3.5.

maiden fable
#

!d def

unkempt canyonBOT
maiden fable
#

it defines a coroutine function

rigid peak
naive spoke
#

what does Coroutines mean

rigid peak
#

pain and suffering

slim ibex
#

It is a subroutine @naive spoke

rigid peak
#

moai can you help me ๐Ÿฅบ

slim ibex
#

the token is none

naive spoke
#

mean

slim ibex
final iron
slim ibex
#

!async-await

slim ibex
rigid peak
#

its the one hes using

slim ibex
#

oh no

rigid peak
final iron
slim ibex
#

add the token ๐Ÿ—ฟ

naive spoke
rigid peak
#

the token is the blurred out thing

rigid peak
slim ibex
slim ibex
unkempt canyonBOT
#

Concurrency in Python

Python provides the ability to run multiple tasks and coroutines simultaneously with the use of the asyncio library, which is included in the Python standard library.

This works by running these coroutines in an event loop, where the context of the running coroutine switches periodically to allow all other coroutines to run, thus giving the appearance of running at the same time. This is different to using threads or processes in that all code runs in the main process and thread, although it is possible to run coroutines in other threads.

To call an async function we can either await it, or run it in an event loop which we get from asyncio.

To create a coroutine that can be used with asyncio we need to define a function using the async keyword:

async def main():
    await something_awaitable()

Which means we can call await something_awaitable() directly from within the function. If this were a non-async function, it would raise the exception SyntaxError: 'await' outside async function

To run the top level async function from outside the event loop we need to use asyncio.run(), like this:

import asyncio

async def main():
    await something_awaitable()

asyncio.run(main())

Note that in the asyncio.run(), where we appear to be calling main(), this does not execute the code in main. Rather, it creates and returns a new coroutine object (i.e main() is not main()) which is then handled and run by the event loop via asyncio.run().

To learn more about asyncio and its use, see the asyncio documentation.

slim ibex
#

read asyncio docs for more info

rigid peak
naive spoke
#

is there a way to keep my discord bot open the whole time

slim ibex
rigid peak
slim ibex
rigid peak
#

I did the webucator tutorial

#

the lesson thing

#

clearly it didnt work

#

trel

slim ibex
#

it is obvious that you are just a beginner in Python. Learn more and do the bot again when you have a good grasp over things like OOP and asyncio

rigid peak
#

Thank you for your advice

#

Where do you suggest I go after taking the beginner tutorial

slim ibex
#

realpython is very good

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.

rigid peak
#

very nice

#

thank you all

slim ibex
#

decorators are an advanced topic imo

rigid peak
#

like I literally started this week

final iron
#

I still don't understand decorators

rigid peak
#

I will read the boring stuff book

slim ibex
final iron
#

๐Ÿ˜”

rigid peak
pliant gulch
slim ibex
#

Not really, creating decorators isnโ€™t the easiest

final iron
#

Oh I know what that means

#

๐Ÿšช ๐Ÿƒ

slim ibex
#

if itโ€™s something complicated

slim ibex
rigid peak
#

Good to know

#

thanks again Mr/Mrs Moai.

slate swan
#

while me who uses conditionals

unkempt canyonBOT
#

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

001 | hello
002 | world
003 | !
004 | hello
005 | world
006 | !
pliant gulch
#

nonlocal is also useful for decorators in some areas

slim ibex
#

!d nonlocal

unkempt canyonBOT
#

7.13. The nonlocal statement


nonlocal_stmt ::=  "nonlocal" identifier ("," identifier)*
``` The [`nonlocal`](https://docs.python.org/3/reference/simple_stmts.html#nonlocal) statement causes the listed identifiers to refer to previously bound variables in the nearest enclosing scope excluding globals. This is important because the default behavior for binding is to search the local namespace first. The statement allows encapsulated code to rebind variables outside of the local scope besides the global (module) scope.

Names listed in a [`nonlocal`](https://docs.python.org/3/reference/simple_stmts.html#nonlocal) statement, unlike those listed in a [`global`](https://docs.python.org/3/reference/simple_stmts.html#global) statement, must refer to pre-existing bindings in an enclosing scope (the scope in which a new binding should be created cannot be determined unambiguously).
slim ibex
#

^

#

You should be doing that for most decorators

slate swan
#

discord bots

#

!ot

unkempt canyonBOT
slim ibex
#

bro

slate swan
#

I never want to be the bad human being

slim ibex
#

well you are being it๐Ÿ—ฟ๐Ÿ˜ข

slate swan
#

This channel is gonna be dead for 8-9 hours frow now on, respect it

slate swan
naive spoke
#
await ctx.send('hi')
await ctx.send("yo")
await ctx.send("talk")

when i do this the bot sends the message at the same time how can i make it so it waits 1 second before sending

stone beacon
#
import asyncio

asyncio.sleep(1)
#

Just sleep for 1 second after each message

naive spoke
stone beacon
#

wym

slate swan
stone beacon
#

oh riri

#

๐Ÿคฃ

#

In your command make sure to await asyncio.sleep()

naive spoke
#

ok

#

do i need to put inport asyncio

slim ibex
#

await

#

yes

slate swan
stone beacon
#

I am weirded out

#

I shall be leaving now

slate swan
slim ibex
#

stop Ashley holy ๐Ÿ’€

slate swan
wicked flicker
slate swan
wicked flicker
#

ops

#

sory

slate swan
#

Sory for?

wicked flicker
#

Changing the title of the image posted with discord.py

wicked flicker
#

image title

slate swan
#

How?

naive spoke
#
@client.command()
async def test(ctx):
  message =  await ctx.send('click here to talk with bot')
  await message.add_reaction('โœ…')
  await client.wait_for("reaction_add")
  await ctx.send('hello {ctx.author.name} ')
  await ctx.send("yo")
  await ctx.send("talk")

when i add anything in here it just breaks

slate swan
wicked flicker
naive spoke
outer parcel
#

hey everyone does anyone have a cool idea i can add to a currency discord bot

wicked flicker
slate swan
slate swan
wicked flicker
hoary cargo
wicked flicker
#

nope

slate swan
naive spoke
wicked flicker
#

The text that appears when we hover over the picture posted in "discord"

cerulean olive
#

how do i uninstall all my imports and stuff

slate swan
outer parcel
vale blaze
#

What is the best practice if I have multiple aiocron.crontab task in my bot? Should I separate all of the cron jobs into one cog or into multiple separated cogs? Or it doesnt really matter just dont care about the fact that these are cron jobs in my bot?

hoary cargo
outer parcel
#

as well as vc grinding and more

wicked flicker
slate swan
outer parcel
#

alr got that lol

outer parcel
#

are you guys trying to check for player input

wicked flicker
#

but they did

slate swan
slate swan
naive spoke
#

then i deleted it because it was not working properly

slate swan
#

Rip

slate swan
outer parcel
#
def check(reaction, user):
    return user == ctx.author and str(reaction.emoji) in ["{emoji}"] and reaction.message == message
#

emoji is basically the emoji that you want to be reacted

wicked flicker
slate swan
wicked flicker
#

yeap

outer parcel
#
confirmation = await bot.wait_for("reaction_add", check=check)
#

and something like dis for checking

#

then you would do if confirmation:

slate swan
#

Imagine not having a custom timeout

outer parcel
#

rest of code

#

??

naive spoke
wicked flicker
slate swan
outer parcel
#

i showed you that

naive spoke
#

ah

outer parcel
naive spoke
outer parcel
#

i mean works for me but i use lambda check

naive spoke
outer parcel
#

you have to define ctx as a parameter

cold sonnet
#

naming โŒ

outer parcel
#

?

cold sonnet
#

bot

outer parcel
#

i use client

cold sonnet
#

bad

outer parcel
#

its just a variable name .... it can be anything

cold sonnet
#

I could name my int to myString

outer parcel
#

ye ? ok

#

its just a var

wicked flicker
#

where are u

cold sonnet
#

I almost said it

wicked flicker
#

@slate swan

outer parcel
#

if your trying to make a system for a player reaction just use wait_for(and blah blah

slate swan
wicked flicker
#

i did

slate swan
wicked flicker
#

ok

slate swan
wicked flicker
feral prairie
#
@bot.command()
async def csk(ctx,*,arg):
 
 delim = "," 
 
 res = {idx: ele for idx, ele in
enumerate(arg.split(delim))}

 
 CSK = []
 CSKBAL = 9000 
 print(res[0])
 CSK.append(res[0])
 print(CSK)
 embed = discord.Embed(title = "Sold!", description = arg, color = 0XFFFF00 )
 embed.add_field(name="CSK Squad" , value = CSK , inline = False )
 embed.add_field(name = "CSK Balance", value = CSKBAL,inline = False)
 await ctx.send(embed= embed)โ€Š```
โ€Šโ€Š

What this ends up doing is
Instead of showing CSK squad as 

["Faf","Jadeja"] it should just show the most recent one
slate swan
#
    @commands.command(aliases = ["server", "serverinfo"])
    async def ัะตั€ะฒะตั€(self, ctx):
        date_format = "%A, %I:%M %p"
        members = len(list(filter(lambda m: not m.bot, ctx.guild.members)))
        bots = len(list(filter(lambda m: m.bot, ctx.guild.members)))
        mbrs = ctx.guild.members
        online = len(list(filter(lambda x: x.status == discord.Status.online, mbrs)))                        
        idle = len(list(filter(lambda x: x.status == discord.Status.idle, mbrs)))
        offline = len(list(filter(lambda x: x.status == discord.Status.offline, mbrs))) 
        dnd = len(list(filter(lambda x: x.status == discord.Status.dnd, mbrs))) 
        
        emb=discord.Embed(title=f"ะ˜ะฝั„ะพั€ะผะฐั†ะธั ะพ ัะตั€ะฒะตั€ะต **{ctx.guild.name}**", description="**__ะžัะฝะพะฒะฝะฐั ะธะฝั„ะพั€ะผะฐั†ะธั:__**", color=discord.Color.from_rgb(128, 0, 255), timestamp=ctx.message.created_at)
        emb.set_footer(text=f"ะ—ะฐะฟั€ะพัะธะป: {ctx.author.name}", icon_url=ctx.author.avatar_url)
        emb.set_thumbnail(url = ctx.guild.icon_url)
        emb.add_field(name="**ะะฐะทะฒะฐะฝะธะต:**", value=f"**{ctx.guild.name}**", inline=False)
        emb.add_field(name="**ะกะพะทะดะฐั‚ะตะปัŒ:**", value=f"**{ctx.guild.owner}**", inline=False)
        emb.add_field(name="**ะฃั‡ะฐัั‚ะฝะธะบะธ:**", value=f"ะ’ัะตะณะพ: **{ctx.guild.member_count}**\nะ›ัŽะดะตะน: **{members}**\nะ‘ะพั‚ะพะฒ: **{bots}**", inline=False)
        emb.add_field(name="**ะŸะพ ัั‚ะฐั‚ัƒัะฐะผ:**", value=f"ะ’ ัะตั‚ะธ: **{online}**\nะะต ะฐะบั‚ะธะฒะตะฝ: **{idle}**\nะะต ะฒ ัะตั‚ะธ: **{offline}**\nะะต ะฑะตัะฟะพะบะพะธั‚ัŒ: **{dnd}**", inline=False)
        emb.add_field(name="**ะšะฐะฝะฐะปั‹:**", value=f"ะ’ัะตะณะพ: **ัะบะพั€ะพ**\nะขะตะบัั‚ะพะฒั‹ั…: **{len(ctx.guild.text_channels)}**\nะ“ะพะปะพัะพะฒั‹ั…: **{len(ctx.guild.voice_channels)}**", inline=False)
        emb.add_field(name="**ะฃั€ะพะฒะตะฝัŒ ะ’ะตั€ะตั„ะธะบะฐั†ะธะธ:**", value=f"**{ctx.guild.verification_level}**", inline=False)
        emb.add_field(name="**ะ”ะฐั‚ะฐ ัะพะทะดะฐะฝะธั:**", value=f"**{ctx.guild.created_at.strftime(date_format)}**", inline=False)
        await ctx.reply(embed=emb)โ€Š
#

shows the wrong status of people, who is online and who is not, how to fix?

supple crescent
#

how would i check if a person has a certan role? I want to do something like:

admin_role =  guild.get_role(945325312533729311) 
@bot.command
if USER has admin_role:
  exicute comand 
other:
  await ctx.send("no perms to do this!")

how would i do that?

slate swan
slim ibex
#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
slate swan
#

Rip my slow typing on phone

supple crescent
slim ibex
#

Iโ€™m on phone too

slate swan
pallid mango
#

File "/home/runner/Clan-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/home/runner/Clan-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/home/runner/Clan-Bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'message'

#

help ! pls

#
@client.command(help = 'Ban a member!')
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member = None, reason=None):
  await ctx.message.delete()
  await member.ban(reason = reason)
  embed = discord.Embed(description= f"โœ… **{member.display_name}#{member.discriminator} banned!**", color=discord.Color.green())
  await ctx.send(embed=embed)```
elfin pagoda
#

hello friends, i was looking over the discord documentation trying to find if it's possible to grab the custom status of a user, my intention is to make a custom bot that checks what users custom statuses are to then assign a role. so if the status is what my server invite is, it awards a role. just wondering if its possible and i've missed it in the docs, thanks ๐Ÿ˜„

slate swan
#

!d discord.Member.activity

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").
slate swan
elfin pagoda
#

so im dumb, thank you

slate swan
#

please send the full traceback, there's more

slim ibex
#

!d discord.ext.commands.has_permissions

unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
frigid pendant
#
for member in ctx.guild.members:
    print(member)

this isnt working!

oblique laurel
frigid pendant
#
@bot.command(pass_context=True)
async def Blacklist(ctx, user: discord.User):
  print(ctx.guild.members)
  for member in ctx.guild.members:
    print(member)
#

this is the command

oblique laurel
#

What does it print?

frigid pendant
#

the loops doesnt print anything

#

the first print works

#

and prints this

[<Member id=942927877173825597 name='BaconHub Utilities' discriminator='5858' bot=True nick=None guild=<Guild id=852498873247203348 name='Bacon' shard_id=None chunked=False member_count=525>>]
BaconHub Utilities#5858
south jetty
#

does anyone know roblox and can help me with what I am working on

frigid pendant
#

i know roblox

oblique laurel
frigid pendant
#

dm me @south jetty

south jetty
south jetty
oblique laurel
#

โ€ฆ?

frigid pendant
#

BUT ANONYMOUAS, U KNOW WHATS WRONG

oblique laurel
#

Caps lol

frigid pendant
#

srry caps lok

oblique laurel
#

So what is ctx?

#

Shouldnt it be user.guild.members maybe?

frigid pendant
#

the context of the command

#

no, ctx.send("yest") works

oblique laurel
#

So its a channel when you call it?

#

Or is that a dm

oblique laurel
frigid pendant
#

it sends the text in the quotes

oblique laurel
#

In dms or to a channel tho?

frigid pendant
#

the channel

oblique laurel
#

Alr one sec

frigid pendant
#

theres no error

cold sonnet
#

did it reach that part of the code?

#

show us the command

frigid pendant
#

yje loop doesn't even run

slim ibex
#

what is your black list command supposed to do, and whatโ€™s the issue? You can get the members in the guild with len(ctx.guild.members)

frigid pendant
#
@bot.command(pass_context=True)
async def Blacklist(ctx, user: discord.User):
  print(ctx.guild.members)
  for member in ctx.guild.members:
    print(member)
cold sonnet
#

oh you have already

#

pass_context doesn't exist

#

since years

slim ibex
#

^ itโ€™s legacy

frigid pendant
#

im passing context

slim ibex
#

I said that earlier

cold sonnet
#

dunno what you need user for

frigid pendant
#

a user that is mentiopned

cold sonnet
#

the decorator does it for you

stone beacon
#

Smells like an ancient YouTube tutorial to me

stone beacon
frigid pendant
#

!blacklist @semxy guy

#

thats an example of the command

pliant gulch
#

Your command is capped, you need to run !Blacklist

cold sonnet
#

!intents

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.

cold sonnet
#

you need these

slim ibex
#

change Blacklist to blacklist. Capital blacklist doesnโ€™t follow PEP 8

cold sonnet
#

enable members in code and in the dev portal

cold sonnet
frigid pendant
#

still doesnt loop

cold sonnet
#

no command named blacklist

cold sonnet
pliant gulch
frigid pendant
#

see, no errors

cold sonnet
#

oh no

slim ibex
#

you have to specify intents when you instantiate the bot

#

wait what the fuck is this

frigid pendant
cold sonnet
#

idk, it seems to have printed your name

slim ibex
#

^ so youโ€™re the only one on the server?

frigid pendant
#

no, theres 500+ members in there

hoary cargo
slim ibex
#

if you want it to send to discord use ctx.send

cold sonnet
frigid pendant
#

im tryna make it loop through all the users in the server

oblique laurel
#

Why you tryna print 500+ things to the window lol

slim ibex
#

lmao

frigid pendant
#

for reasons

slim ibex
#

there is a lot wrong with this code besides that

cold sonnet
oblique laurel
#

And the fact that its in replit lol

slim ibex
frigid pendant
#

but its usin g barley any ram and all so its not lagging at all

oblique laurel
#

Replit is just bad in general

frigid pendant
#

not really

cold sonnet
frigid pendant
#

just help me with this command plz

slim ibex
slim ibex
frigid pendant
#

just help me wit hthe code. its not replit cauting the issue

oblique laurel
#

Honestly its prob a replit thing lol. If it doesnt give a list in ctx.guild.members

cold sonnet
#

Replit

While this may seem like a nice and free service, it has a lot more caveats than you might think, such as:

- The machines are super underpowered.
- - This means your bot will lag a lot as it gets bigger.
- You need to run a webserver alongside your bot to prevent it from being shut off.
- - This isn't a trivial task, and eats more of the machines power.
- Repl.it uses an ephemeral file system.
- - This means any file you saved via your bot will be overwritten when you next launch.

- They use a shared IP for everything running on the service.
This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
slim ibex
#

yeah it should be printing all the users

#

works for me

cold sonnet
slim ibex
#

but could be intents as I always put all intents on for my bots

frigid pendant
#

yes i did

cold sonnet
#

where

frigid pendant
cold sonnet
#
  1. pass it to your bot
slim ibex
#

You also have to enable them in discord dev portal, no?

cold sonnet
frigid pendant
#

i did in dev portal

cold sonnet
#

then pass it to your bot

frigid pendant
#

IN DEV PORTAL?

#

srry caps

cold sonnet
#

no, in code

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

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

how would i do that?

slim ibex
#

in your bot instantiation, intents = Intents.all() (if you want to enable them all)

cold sonnet
#

intents kwarg

slim ibex
#

thatโ€™s if he has a separate intents variable

#

I was gonna get to that

hoary cargo
#

MR_uncanny_1 the time has finally come, i need help
is there any downside to switch to commands.AutoShardedClient or any difference to .Bot besides sharding?

slim ibex
#

use AutoSharded if your bot is in 1000+ servers

cold sonnet
#

rookie nums

slim ibex
#

!d discord.ext.commands.AutoShardedBot

unkempt canyonBOT
#

class discord.ext.commands.AutoShardedBot(command_prefix, help_command=<default-help-command>, description=None, **options)```
This is similar to [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") except that it is inherited from [`discord.AutoShardedClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.AutoShardedClient "discord.AutoShardedClient") instead.
cold sonnet
#

all my bots are private, it cooler

slim ibex
#

!d discord.AutoShardedClient

unkempt canyonBOT
#

class discord.AutoShardedClient(*args, loop=None, **kwargs)```
A client similar to [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") except it handles the complications of sharding for the user into a more manageable and transparent single process bot.

When using this client, you will be able to use it as-if it was a regular [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") with a single shard when implementation wise internally it is split up into multiple shards. This allows you to not have to deal with IPC or other complicated infrastructure.

It is recommended to use this client only if you have surpassed at least 1000 guilds.

If no [`shard_count`](https://discordpy.readthedocs.io/en/master/api.html#discord.ShardInfo.shard_count "discord.ShardInfo.shard_count") is provided, then the library will use the Bot Gateway endpoint call to figure out how many shards to use.
frigid pendant
#

how do i just enable the server members intent in code?

final iron
#

!intents

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.

hoary cargo
frigid pendant
#

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

bot = Bot(command_prefix='!', case_insensitive=True, intents = intents)

this code gives this error:

#

raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
pliant gulch
#

Did you read this part at all

#

Or the error data?

frigid pendant
#

it is on in dev portal

pliant gulch
#

If it was on, it wouldn't error

#

You probably did not save or something

frigid pendant
hoary cargo
slim ibex
#

Not that I know of

#

But I havenโ€™t used it before so

pliant gulch
#

Sharding in discord.py doesn't really make sense to me, as they are handled all on the same process

#

But, that's just discord.py, other languages do it right, such as djs with their shard manager

pliant gulch
echo wasp
#

How to make my bot tell me who it is connected as on startup

final iron
unkempt canyonBOT
final iron
#

!d discord.ext.commands.Bot.user

unkempt canyonBOT
final iron
#

This returns a ClientUser object

echo wasp
#

Ok so an example? Because I have this big block but no tell who it is that is connected as

final iron
#

It's basic oop

#

๐Ÿ—ฟ

echo wasp
#

Well have this rn

#

But I think i have it

slim ibex
#

donโ€™t use client, use bot

echo wasp
#

@slim ibex I am in a cog

hoary cargo
slim ibex
#

subclass commands.Bot not discord.Client