#discord-bots
1 messages · Page 742 of 1
nvm its client = commands.Bot
client = commands.Bot(command_prefix = 'v!', case_insensitive=True, intents=intents)
It's like doing
my_int = "hello"
Oh
welp I thought you meant
bot = commands.Bot(command_prefix = 'v!', case_insensitive=True, intents=intents)
it was an example
Well, that's a better variable naming :p
greenapple = redapple()
doesnt make sense does it
Holy............
It's so easy
client actually does makes sense
ikr
not really
how to mention the discord user tho
You just saw it, When you work with it, it will be a LOT easier
yes bot is the subclass of Client but the whole framework is called bot
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the member’s hash.
str(x) Returns the member’s name with the discriminator.
{member.mention} ctx.author.mention
it has the .mention attr
I thought it was {0.user}.format(discord.Client)
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
and no
That is A LOT complicated and unnecessary if that is even a thing
I want to say like
not complicated more like outdated
Hello @tender estuary, time to grow your army?
Uhm what
that's what I want the bot to say
then just use a member arg
Welp a few questions. A command or event?
it depends actually.
member: discord.Member
and use the .mention attr
doesnt
nevermind
Oh i meant its a command
so you say ;hunt
You want to mention the person who wrote the command right
and the bot responds
yes
ctx.author.mention
put it in a f string if you wanted it in a str
full command
how to make string
im not giving you a full command?
await ctx.send(f'{ctx.author.mention} your-text-here')
finally
thank you
😄
I'm stoobid ok?
how is that hard
well it was hard for me a week ago
I have never used python
You probably should not be doing discord.py then
dont recommend it if you dont know basic py
Learn python first, it will be hard to understand discord.py
don't know it
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
got it
also, why does my bot.get_emoji(id) not embed an emoji? it just shows :checmark: instead
i understand now
<:emoji_name:emoji_id> or smth is the correct way right?
No, I used bot.get_emoji
can you give the code here
await message.channel.send(f'{message.author.mention} Don\'t send gifs here! :monkaStab:')
``` This is what I used.
it sends the emoji.
he got the emoji from cache but it is not displaying it in a embed that is his problem
ouh
@bot.event
async def on_ready():
bot.emoji = bot.get_emoji(id)```
go on
Its a custom
wdym string command
wut🚶
oh sh- ok.
wdym?
var = "text"
like this one have snake
File "main.py", line 11, in <module>
from discord import has_permissions
ImportError: cannot import name 'has_permissions' from 'discord' (/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/__init__.py)```
i want a rabbit
How to fix this
and more animals
@commands.has_permissions()
``` is the correct way ig
I've got quite a big problem with my bot, if anyone has like 5-10min dm me
this man beeg brain
i see no reason why
that is basic python
not u
I'm basic stoopid
allot of people can say im smort 
HOw to import it correctly
@tender estuary
tbh if you can't assign a string to a variable, you CAN'T do discord.py
why import it
You don't have to import it
you dont need to import it
decorate the command with that
Ok
its a decorator smh
but wait
that's not it, has_permissions takes arguments
ban_members=True or whatever
it takes a kwarg
Ok
and its the permission you want
thanks
exshplain
that is basically like first I named you rabbit then deer
has anyone used postgres for discord bots?
so var2
yes, failed spectacularly
your spacing and why are you setting a value after you already have?
ye
I guess you use heroku?
!e
a = "first value"
def function():
a = "second value"
print(a)
print(a)
function()
makes sense
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | first value
002 | second value
Oh no just learnt it cuz heard its good for discord bots
me smart
1 brain cell
I was recently making discord bot for someone and was thinking if I should create different username for him?
Uhm VERY big discord bots..
hey now its showing
should i be impressed?
Traceback (most recent call last):
File "main.py", line 60, in <module>
@command.has_permissions(administrator=True)
NameError: name 'command' is not defined
commands
@commands
not command
Ok

you can just do ctx not ctx : commands.Context
doesnt matter
why to type that
wont affect it in anyway and context is a positional argument

I meant its not necessary
async def hunt would work just fine
dont seem why not use it
like I was wondering how does pg admin has same user for every1
thank you
tbh I'd avoid postgreSQL and all.. just stick to aiosqlite...
if my bot go famous, this man deserves at least 90% credit
Don't expect to make multi server bots
you mean sqlite
aiosqlite
aiosqlite is the async instance of sqlite
yea ik
really no difference
and pg isnt bad you just have to know how to use it popular bots use it as it uses a server
yeah that's what popular bots which need server based SQL...
postgreSQL for a single server is a poor choice
in the default help command (subclassed), is there a way to get required roles/checks, e.g. eval wjll show "Requires bot owner", role will show "Manage Roles/@somerole", etc
you mean !help?
no
I still don't know my way around default help command...
he ment he subclassed the default help command
Is it a good choice to create a different table for a warn command or just put it in json?
another table
!d discord.ext.commands.HelpCommand.add_check
add_check(func)```
Adds a check to the help command.
New in version 1.4.
how to send custom emojis
or do you mean getting roles required to run the command?
get the emoji
get_emoji or use the elasped name of the emoji
you can get elasped name by doing \:emoji: and use it
but how to sent
I am mkaing a command
dice roll
I want to sent one of the six dices
how to do that
use .send() ...
like this
use .choice with random and send the random emoji
ok
just add it to a list
await ctx.send(emoji) #Define the emoji
its a custom emoji
Won't work
await ctx.send("")
» string-formatting
» f-strings
You could also get it by id and call str method on Emoji object
!string-formatting
String Formatting Mini-Language
The String Formatting Language in Python is a powerful way to tailor the display of strings and other data structures. This string formatting mini language works for f-strings and .format().
Take a look at some of these examples!
>>> my_num = 2134234523
>>> print(f"{my_num:,}")
2,134,234,523
>>> my_smaller_num = -30.0532234
>>> print(f"{my_smaller_num:=09.2f}")
-00030.05
>>> my_str = "Center me!"
>>> print(f"{my_str:-^20}")
-----Center me!-----
>>> repr_str = "Spam \t Ham"
>>> print(f"{repr_str!r}")
'Spam \t Ham'
Full Specification & Resources
String Formatting Mini Language Specification
pyformat.info
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
!d discord.ext.commands.Bot.get_emoji <- this
get_emoji(id, /)```
Returns an emoji with the given ID.
#bot-commands
yes that to
If you are doing many commands for personal purpose, better go to that channel
I'm helping myself
That counts as personal purpose :)
sir how to make a variable string
then use #bot-commands
f-string

with variables
not numbers
user_id = 69
print(f'This user has ID {user_id}')```
!e
a = "red"
print(f"{a} apple")
!e
user_id = 69
print(f'This user has ID {user_id}')```
@slate swan :white_check_mark: Your eval job has completed with return code 0.
red apple
@vale wing :white_check_mark: Your eval job has completed with return code 0.
This user has ID 69
exenifix bro🧍♂️
At the same time 
mine was first
Yeah

Um
tanks
Really lol
yw
check🧍♂️
Yeah I just did
can i replace a with 1
🧍♂️
@vale wing :white_check_mark: Your eval job has completed with return code 0.
20 number
even functions
Yeah those are code expressions as well
yeah
The thing you put inside {} will be called str method on and inserted into the string
can anyone suggest any app commands to do? User/message
!e
import random
print(f"okimii is {random.randint(1, 101)} % cool")
@slate swan
@slate swan :white_check_mark: Your eval job has completed with return code 0.
okimii is 85 % cool

!e
import random
print(f"okimii is {random.randint(1, 101)} % cool")
@manic wing :white_check_mark: Your eval job has completed with return code 0.
okimii is 55 % cool
what's this for
funny arent you caeden🧍♂️
!e
import random
print(f"okimii is {random.randint(1, 2)} % cool")
@slate swan
@manic wing :white_check_mark: Your eval job has completed with return code 0.
okimii is 1 % cool
Good message command is Purge All Below, it would purge all the messages below the selected one in the channel, easy to implement and useful (but dangerous)
just a example
truly meticulous banter
#bot-commands 
uhh that would be a bit dangerous and not something i want to put yeah
no pinging me unless I need help
Ok could you specify what you want?
yeah^
i assume you need help so @slate swan
okimii already helped
what do you need help with? ❤️

i wouldnt trust what okimii says
so technically i don't need help anm
then you also have 1 braincell
🧍♂️
because
you said the same thing she/he said

its a she
@spring flax you want like fun command?
big brain play from caeden init

did u guess bc of the pfp
maybe moderation but not something like the purge one
Btw is inviting people to collaborate on closed source projects (no paid work) against the rules?
Channel mute command is also good mod command
my import random causes an unused import statement
use it
happens when you dont use the module
I found le problem
well I can't use a database, so I can't log mutes so that would be a bit of a problem
the random in {random.randint(1, 2)} is the one you import
no
you do
import random
that was a example of me using randint
@slate swan smh I couldn't help but read your about me and notice that career is an unused variable
same with love too
yes i know
you probably already know-- lol
why does my variable 1 can't be assign to literal
cant add more😔
ahhh, right
.topic
can take any amount of submissions from any subreddit 🚶
nothing
formats code with black, overall helpful development bot
definitely not heavily inspired by @unkempt canyon :)
well? what did you expect?
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'os' is not defined
fuck
you can't assign to 2
!e
import os
os.system('shutdown')
@slate swan :warning: Your eval job has completed with return code 0.
[No output]
then how to make a string for variables
ez
like dank memer
name your variables with letters
!e
import os
os.system('reboot')
@slate swan :warning: Your eval job has completed with return code 0.
[No output]
that wont work + use #bot-commands
bro hello
stop trying it wont work
❤️
cringe bro
lovely dog
okay and
❤️
.topic
Suggest more topics here!
now what
streaming status button or some custom rpc thing
you can't assign a constant
hmmm this is partially a bad question given forks
I understand now
and like, no features will be added
whats a and b assigned to
What's a feature that you wish was in all forks or really like about a fork you use?
defined as*
rabbit and deer
random.randint(a,b) won't work if they are assigned to a string...
well wont work
use random.sample
int for integers only
so randstr
a, b needs to be int if u wanna use randint
no that not a thibg
thing
randint gives a random int from a range of ints
^^^
you use .choice for a random element from a tuple or list
then what do I do
@slate swan
i hate when i get ignored

random.choice
anime pfp doesnt help
Ok @slate swan tell me what are you actually trying to do
making a hunt command
not about the pfp im giving good info
we agree on something at last.
lol
so you can hunt a rabbit, deer, or bear
while having anime pfp
ok and?
animals = ('rabbit', 'deer', 'bear')
chance = random.choice(animals)
await ctx.send(f'You hunted {chance}')
your pfp isnt great anyways but are we judging no
This is what you need @slate swan
same
just do
await ctx.send(f'You hunted {random.choice(['rabbit', 'deer', 'bear'])}')
ez
I hate golfing.
oh that's where I know you from
he still gets credit
Just type whatever comes in your mind who cares about the size for a single server discord bot tbh
.topic
none. Everything I thought of someone has done already
staff application & suggestions
sorry i dont spoonfeed
who?
u got it wrong
how?
you lol
where
disnake server from a few days back in help channel
rabbit, deer and bear aren't variables
animals is
they r strings
''
you mean the dpy server orrrr
no need for them?
uhm... its a tuple
No it's not wrong though.
the disnake server lol
Yeah it isnt.
Its more efficient... given its size.
!e
import random
print(f"You huntet {random.choice(['x', 'y'])}")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
You huntet x
My typing is perfect
!e
import random
print(f'You hunted {random.choice(['rabbit', 'deer', 'bear'])}')
@slate swan
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | print(f'You hunted {random.choice(['rabbit', 'deer', 'bear'])}')
003 | ^^^^^^
004 | SyntaxError: f-string: unmatched '['
@client.command(aliases=["rockpaperscissors"])
async def rps(ctx):
rpsGame = ['Rock', 'Paper', 'Scissors']
await ctx.send(f"Rock, paper, or scissors? Choose wisely... Remember to start your answer with a Capital letter!")
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and msg.content.lower() in rpsGame
user_choice = (await client.wait_for('message', check=check)).content
comp_choice = random.choice(rpsGame)
if user_choice == 'Rock':
if comp_choice == 'Rock':
await ctx.send(f'Well, that was weird. We tied.\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Paper':
await ctx.send(f'Nice try, but I won that time!!\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Scissors':
await ctx.send(f"Aw, you beat me. It won't happen again!\nYour choice: {user_choice}\nMy choice: {comp_choice}")
elif user_choice == 'Paper':
if comp_choice == 'Rock':
await ctx.send(f'The pen beats the sword? More like the paper beats the rock!!\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Paper':
await ctx.send(f'Oh, wacky. We just tied. I call a rematch!!\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Scissors':
await ctx.send(f"Aw man, you actually managed to beat me.\nYour choice: {user_choice}\nMy choice: {comp_choice}")
elif user_choice == 'Scissors':
if comp_choice == 'Rock':
await ctx.send(f'HAHA!! I JUST CRUSHED YOU!! I rock!!\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Paper':
await ctx.send(f'Bruh. >: |\nYour choice: {user_choice}\nMy choice: {comp_choice}')
elif comp_choice == 'Scissors':
await ctx.send(f"Oh well, we tied.\nYour choice: {user_choice}\nMy choice: {comp_choice}")
HIS ONE WORKED
you are perfect you pay for WinRAR
oops
It’s not showing an error, but the bot doesn’t respond once i put rock, paper or scissors
I am working on something similar too
ok theirs better ways?
It just doesnt answer
make it .lower so u aint gotta use capital
where
message.content = message.content.lower()
Ok
What do i change in this
and make the comp choise or whatever 'rock' etc
hidden smarter than u
weird this is wrong
Use a dict man
def trial_moderator_only():
def predicate(ctx):
list_of_ids = ['751814647346102303', '246412496678682635']
if (disnake.utils.find(lambda r: r.id == 897292885509148674, ctx.author.roles)):
return True
if ctx.author.id in list_of_ids:
return True
else:
return None
return commands.check(predicate)
Why does the if ctx.author.id in list_of_ids not work and raise checkfailure?
you mean his methods are for basic py users
bruh xD
.topic
Suggest more topics here!
tbh I could golf too but teaching a toddler quantum mechanics isn't really cool.
yes
gambling
@slate swan could u help fix this?
It’s just everyone is confusing me
thy complicated asf one
yeah i get you
lmao
Is that an insult
I feel you bruddah
Like idk what to change
Depends on how you take it. it isn't from my side
well i only give good answers
Its just a metaphor
that don't work
if you dont get it its not my problem
ok at this point ima just delete the cmd cuz idk what to do

I'm in math class rn, dm me later if u still need help
Oof ok
can someone else help?
dropdown menus or subclassing the help command

@client.command()
async def coinflip(ctx, guess : str):
guesses=("Heads", "Tails")
chance = random.choice(guesses)
if guess != chance:
cursor.execute(f"SELECT wallet_amt FROM account_table WHERE user_id = {ctx.author.id};")
db.commit()
result = cursor.fetchall()
result = str(result).strip("[](),")
result = int(result)
result = result - 200
await ctx.send(f"You lost, The bet and 200 coins. {ctx.author.mention}")
cursor.execute(f"UPDATE account_table SET wallet_amt = {result} WHERE user_id = {ctx.author.id};")
db.commit()
elif guess == chance:
cursor.execute(f"SELECT wallet_amt FROM account_table WHERE user_id = {ctx.author.id};")
db.commit()
result = cursor.fetchall()
result = str(result).strip("[](),")
result = int(result)
result = result + 200
await ctx.send(f"You won, The bet and 200 coins. {ctx.author.mention}")
cursor.execute(f"UPDATE account_table SET wallet_amt = {result} WHERE user_id = {ctx.author.id};")
db.commit()
Anything wrong with this? Don't golf.
dont copy my emoji
why me
You pro

thank you but no

im not a pro

guesses=("Heads", "Tails")
chance = random.choice(guesses)
make it shorter 
chance = random.choice(["Heads", "Tails"])
these little things are the ones that make you better

I am stupid but thanks
||Never gonna give you up, never gonna let you down||
thats just cruel bro, cant have 3000 lines if I gotta shorten everything
f-
yw
you got played by your own about me
I think the same way xD
longer = better
seems about right
No man , I knew but still clicked
😭
only if you see the source code of discordheximals
...

i dont code discord bots that much
mhm
you think 🤔 too much
instead of importing dpy just paste the source code in
use c instead of python
^^^ @keen talon
py super dead
Cause this lol
rust good
omfg
And python is written in c so yea
so genius
yeah man
no

You can just paste the complete discord.py code cause is overall like 30 different files
Atleast a person like me who stackoverflow's things can't
you guys dont do that?
using a dead language to make even more dead language 
😬
nah , I'm good with storing modules in the local lib

and using a dead language to make a dead bot
Literally me^
i want to jump to rust but im not sure
dead bot in a dead server
in a dead app
if you learned oop , sure
rust is worth learning
in a dead operating system
you think i havent learned oop
Used by a dead person 
on a dead planet
If you be consistent
I haven't
on a dead galaxy

!ot 
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
.topic
guys lets go to #ot0-psvm’s-eternal-disapproval before we get captured
how to give a random number in fstrings
BUTTONS😠
Custom commands
👍
I am so cruel I made a command for myself that gives me 999999999 coins.
almost every famous bot i know has buttons
No one else cna use it.
which currency
.topic
😬 😬
!e
import random
print(f"random number is {random.randint(1, 10)}")
.topic
@slate swan :white_check_mark: Your eval job has completed with return code 0.
random number is 4
Yes like carl-bot and dyno
@client.command(aliases=["cf"])
async def coinflip(message: discord.Message):
coin = ["heads", "tails"]
flipchoice = random.choice(coin)
while 'Wait 1 seconds':
await message.channel.send(f"**`Heads`** or **`Tails`**?")
msg = await client.wait_for('message', check=lambda message: not message.author.bot)
if msg == "heads" or msg == "Heads":
if flipchoice == "heads":
await msg.send("You got it! The answer was heads!")
if flipchoice == "tails":
await msg.send("Oh no! Try again next time")
if msg == "tails" or msg == "Tails":
if flipchoice == "heads":
await msg.send("You got it! The answer was tails!")
if flipchoice == "tails":
await msg.send("Oh no! Try again next time")
this isnt working for some reason
just use vsc
Pls help
my eyes hurt
a command takes context
did u debug
now my eyes is better
There’s no error
i get ignored again
oh
what is while 'Wait 1 seconds':
Uhh
every value is true in python except for falsy ones so technically that'd loop it???/
I just got the code online im not good at coding im just trying to make a simple bot for my server thats it
not all
!e
print(bool('wait 1 seconds'))```
@vale wing :white_check_mark: Your eval job has completed with return code 0.
True
Always true condition done in a weird way
i was right, see that'd loop it infinitely???
!e
print(bool(""))
that's false
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
Can someone help me fix it pls

Idk what to do
Empty string returns false, non empty true
mhm
so technically your just infinitely looping it
its just like a while True
i haven't use disnake is a whiel
since a str is always true
but it isn't when it's empty
Im just tryna get a coin flip cmd that’s it
yeah
oh yeah and use elif after an if statement
I would done it in a different way lmao
it's nice practice
did you do pip3 install discord (because you're not meant to)
.help
@slate swan
wait
.Pythòn
@quanganh.command()
async def svinfo(ctx):
guild = ctx.guild
name = guild.name
rolenum = len(ctx.guild.roles) - 1
create_server = guild.created_at.strftime("%d-%m-%Y")
owner_server = guild.owner.mention
membercount = guild.member_count
boostnum = guild.premium_subscription_count
embed = discord.Embed(title=name, color=discord.Colour.random())
embed.add_field(name="Created at:", value=create_server, inline=True)
embed.add_field(name="Owner:", value=owner_server, inline=True)
embed.add_field(name="Member count:", value=membercount, inline=True)
embed.add_field(name="Number of Boost:", value=boostnum, inline=True)
embed.add_field(name="Roles Count:", value=rolenum, inline = True)
embed.set_image(url=ctx.guild.icon_url)
await ctx.channel.send(embed=embed)
what is happening
Pythòn
whats happening
ghê v
@slate swan how did we have the same answers wtf???
!e
import random
result = random.choice(['heads', 'tails'])
for i in range(5):
print(result)```
same error showing@shadow wraith
lol
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "e:\python\new\bot.py", line 494, in svinfo
owner_server = guild.owner.mention
AttributeError: 'NoneType' object has no attribute 'mention'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'mention'```
WTF IS HAPPENINGGG
@vale wing :white_check_mark: Your eval job has completed with return code 0.
001 | tails
002 | tails
003 | tails
004 | tails
005 | tails
Nice random
the owner is None
thôi như cặc vậy
i have run it on my computer, and it work, but when he run it, in return nonetype
pp
Hell
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
only english server
im mồm
can you not
#discord-bots is better than #python-discussion
can someone help me pls ?
how can i solve it
i think you have to do pip3 install git+https://github.com/Rapptz/discord.py
we could if people stop spamming smh
wait doing this
no need to import it
they're folders i think
i haven't used disnake in a while
same error
arent they classes smh
again
@slate swan so how can i solve it
im right here
why the ping
sr
sad, can't host for free without interruptions then...
@slate swan update your python
cmd
I mean update the interpreter
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "e:\python\new\bot.py", line 494, in svinfo
owner_server = guild.owner.mention
AttributeError: 'NoneType' object has no attribute 'mention'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'mention'```
The code please.
It requires >= 3.8 and you have 3.7.2
there is no guild owner :troll:
@quanganh.command()
async def svinfo(ctx):
guild = ctx.guild
name = guild.name
rolenum = len(ctx.guild.roles) - 1
create_server = guild.created_at.strftime("%d-%m-%Y")
owner_server = guild.owner.mention
membercount = guild.member_count
boostnum = guild.premium_subscription_count
embed = discord.Embed(title=name, color=discord.Colour.random())
embed.add_field(name="Created at:", value=create_server, inline=True)
embed.add_field(name="Owner:", value=owner_server, inline=True)
embed.add_field(name="Member count:", value=membercount, inline=True)
embed.add_field(name="Number of Boost:", value=boostnum, inline=True)
embed.add_field(name="Roles Count:", value=rolenum, inline = True)
embed.set_image(url=ctx.guild.icon_url)
await ctx.channel.send(embed=embed)```
stop spam @slate swan
@snow hare
They didn't enable members intent 
@slate swan in case you didn't see
oh
hmm, ok
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
oke
would you agree that iterating through a NoneType is looking for a teddy bear in an empty toy store
!d discord.Guild.owner needs members intent haha
property owner: Optional[discord.member.Member]```
The member that owns the guild.
!intents
you can't just guild.owner.mention like that
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.
U can, actually
yes you can
owner is a member obj
we can??????
Yea...
and member obj has .mention attr
he enable the Member intenes
Mhm
but it still return nonetype
in dev portal and the code?
yeah
drop python learn erlang work for whatsapp 🙂
both of them
seems like you have something wrong
...
for it to return none
🚪🚶
no im keeping python with me ❤️
ple
i dont know, i have run it on my computer, and it work, but @slate swan run, it doesnt work
seems like hes doing something wrong
it return none
!e print(0.2+0.7) # very reliable calculator
@slate swan :white_check_mark: Your eval job has completed with return code 0.
0.8999999999999999
done bro
can't i just say 0.8
ok
then float(0.8)
Well , in general 0.2+0.7 is 0.9
enter whatever that error was called
its a nonetype error
Python good at math
ive seen around 3-5 people new to python and try coding a discord bot immediately
ikr
I've seen way more lol
And currently one guy is annoying me in DMs
ive seen one that copied the github source code
ive seen to many
of what
a discord bot
sue
he got an indent and syntax error
i get dms and friend requests on a daily lol
and he didn't know wtf it meant
!e print(@slate swan)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
<@637458038915203127>
Yeah lucky people ig
fs
why the ping
not really
yes really
wont call it lucky
I would
imo
!e
for i in range(len(len(len([1, 2, 3])))):
print("what")
@shadow wraith :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: object of type 'int' has no len()
no.. not that
oh sorry
floating point error or rounding error
I had a stroke reading that
ah that
yes
just esoteric code
brackets on brackets on brackets
what really is esoteric python
ill post something esoteric here before i go to #esoteric-python
if you think that's esoteric don't look at my bot's source /hj
i got that joke
was very lovely

I do that a minute
and with each bug fix, comes 200 more bugs
!e
i = 49
if i == 49:
if i < 50:
if isinstance(i, int):
if i != 50:
if float(i) == 49.0:
print("💀")
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
💀
nice
that's how to print hello world
very!
😎
i never fix errors cuz my codes are well thought of
I feel you
anyone could've guessed that
runs on syntaxs errors: 🏃💨
ah, so you keep the bugs around
bold
I just type whatever comes in my mind... then fix it.
no i dont get any

what if i run a bot with !e
try it
people who have ZeroDivisionError: 🕴️
xD
!e
import discord
@shadow wraith :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'discord'
TBF had I written the entire bot from scratch I probably would have less problems
gotta leak my token bro
custom modules don't work in eval
mine is in .env
Anyways I regenerate my token 4-5 times a day.
as it stands, my bot started as a fork of @lament depot and @unkempt canyon melded into one bot with features of my own added
how would you guys rate discord bot's code if they oftenly had zerodivisionerror
overtime I'll fully rewrite my bot into my own source
!e
m = True
while m:
print('infinite loop crash')
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | print('infinite loop crash')
003 | ^
004 | IndentationError: expected an indented block after 'while' statement on line 2
so now its sir python?
the bot gets glitchy when I test it for a long time and starts sending 2-3 duplicate messages at the same time.

monty python
!e
m = True
while m:
print('infinite loop crash')
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | infinite loop crash
002 | infinite loop crash
003 | infinite loop crash
004 | infinite loop crash
005 | infinite loop crash
006 | infinite loop crash
007 | infinite loop crash
008 | infinite loop crash
009 | infinite loop crash
010 | infinite loop crash
011 | infinite loop crash
... (truncated - too many lines)
Full output: too long to upload
d-d-d-did you just try to flood chat?
WHY THE VARIABLES THEYRE USELESS
!e
while True:
print("huihui")
@tender estuary :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print("huihui")
003 | ^
004 | IndentationError: expected an indented block after 'while' statement on line 1
I AGREE THAT LAST ONE WAS BETTER
just do
while True:
😠
yea ofc.. no auto indent...
this isnt replit
VSC does the same mam
any IDE or editor I used...
there is a difference between while False: and while <avarwhichhasafalsyvalue>: i think
i thought you used replit 
I did, from yesterday.
I want to code/find a command where its like a giveaway drop, the first person to react to the message wins
Would this be hard?

I initially made it because features from lance and python I really really wanted when writing my own bots
Before that VSC. Before that studio, before that pycharm.
or just general python programming
ic nice
!e
while False:
print("???")
@shadow wraith :warning: Your eval job has completed with return code 0.
[No output]
no wait for a reaction lol
!e
while True:
print("huihui")
@tender estuary :x: Your eval job has completed with return code 143 (SIGTERM).
001 | huihui
002 | huihui
003 | huihui
004 | huihui
005 | huihui
006 | huihui
007 | huihui
008 | huihui
009 | huihui
010 | huihui
011 | huihui
... (truncated - too many lines)
Full output: too long to upload
!e
h = False
while h:
print("huihui")
@shadow wraith :warning: Your eval job has completed with return code 0.
[No output]
but since I wanted features from both python and lance.... why would I want to host two & they're coupled to all of the features, so I just combined them into one and took out all of the fun features
who would do that lmfao
Huh
and no you get a daily stroke
Wdym no wait
wdym
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
like you get many errors
!e
omamii = 'cuz why not'
okamii = okamii.split()
a = okamii[0]
b = okamii[1]
c = okamii[2]
prnt = f'{a} {b} {c}'
m = 'okamii'
while len(m) >= 6:
print(f'prnt')
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | NameError: name 'okamii' is not defined. Did you mean: 'omamii'?
FUCk
!e
while True:
chance = random.randint(1,34343434453)
print(chance)
okamii
@tender estuary :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | NameError: name 'random' is not defined
oh ofc not 💀
!e
import random
while True:
chance = random.randint(1,34343434453)
print(chance)
@client.command()
async def stat(ctx, player_uuid):
r = requests.get(f"https://api.hypixel.net/player?uuid={player_uuid}&key=a", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])
@tender estuary :x: Your eval job has completed with return code 143 (SIGTERM).
001 | 8473178990
002 | 32538215294
003 | 33566977677
004 | 7133613355
005 | 29514869072
006 | 16275754766
007 | 239594124
008 | 4338175846
009 | 22591317393
010 | 19790230607
011 | 27613002645
... (truncated - too many lines)
Full output: too long to upload
🚶
@client.command()
async def stat(ctx, player_uuid):
r = requests.get(f"https://api.hypixel.net/player?uuid={player_uuid}&key=a", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])
why doesnt this work
!e
okamii = 'cuz why not'
okamii = okamii.split()
a = okamii[0]
b = okamii[1]
c = okamii[2]
prnt = f'{a} {b} {c}'
m = 'okamii'
while len(m) >= 6:
print(f'prnt')
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | prnt
002 | prnt
003 | prnt
004 | prnt
005 | prnt
006 | prnt
007 | prnt
008 | prnt
009 | prnt
010 | prnt
011 | prnt
... (truncated - too many lines)
Full output: too long to upload
!e
import random
while True:
print(random.randint(1,34343434453))
@tender estuary :x: Your eval job has completed with return code 143 (SIGTERM).
001 | 11919006997
002 | 21883672407
003 | 28203714443
004 | 9774762786
005 | 1152922010
006 | 17987628190
007 | 19453202220
008 | 12026612427
009 | 24947163732
010 | 10026345569
011 | 15397071891
... (truncated - too many lines)
Full output: too long to upload
@client.command()
async def stat(ctx, player_uuid):
r = requests.get(f"https://api.hypixel.net/player?uuid={player_uuid}&key=a", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])
funny thing
pls help
How is computer so random.
!e
okamii = 'cuz why not'
okamii = okamii.split()
a = okamii[0]
b = okamii[1]
c = okamii[2]
prnt = f'{a} {b} {c}'
m = 'okamii'
while len(m) >= 6:
print(f'{prnt}')
@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).
001 | cuz why not
002 | cuz why not
003 | cuz why not
004 | cuz why not
005 | cuz why not
006 | cuz why not
007 | cuz why not
008 | cuz why not
009 | cuz why not
010 | cuz why not
011 | cuz why not
... (truncated - too many lines)
Full output: too long to upload
BRUH
wrote this shit on phone
Like humans can't be random there always is a pattern.. How are computers so randomly random.
took a long ass time
okamii
can someone help in #help-chocolate
my bot only has a snekbox and docs command after I made it public and then realised I should have it
cant believe I misread ur name

I kept telling myself to add a snekbox and docs command like @unkempt canyon but muh DB and hosting! @slate swan
anyways it now has a docs and eval command.
nice
cant say tbh
hardest topic
wydm
if you dont know them all you cant say
like hardest to learn or what
learn
definitely printing hello world is the hardest topic
data science hardest brotha
#esoteric-python is pretty confusing
I mean... the topic that ppl probably struggle with the most is this channel
yea you got it wrong again its Hello, World!
no
yes
remove the comma
taking into account the rough starter knowledge of users in each channel
networking + security aint really that complicated
data scientists dont get paid 100k/yr for nothing
arl your lil' wrong because mostly people struggle because they don't know basics of python
!e
print("Hello World!")
pov: you started learning python
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Hello World!
which is this channel IMO
Hey I just started learning python today I am gonna make a machine learning abled search engine
your opinion is my opinion
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'ctx' is not defined
seriously bro xD
that gaved me a stroke
your arl
gaved bro
your previous opinion was my opinion on that too, not every opinion you have is also my opinion on that.
@slate swan this u?
@slate swan for the 15 hundredth time, snekbox does not run on @unkempt canyon!!!
guys wanna hear something tongue twisty
github copilot is:
a program programmed by a programmer to program programs
how you know?
If I were to guess her doing this, This wouldn't be that messing. All sticky notes and neat and shit
!e ```py
import sys
print(sys.orig_argv)
@vast gale :white_check_mark: Your eval job has completed with return code 0.
['/usr/local/bin/python', '-Squ', '-c', 'import sys\nprint(sys.orig_argv)']
!e
import sys; sys.exit()
@shadow wraith :warning: Your eval job has completed with return code 0.
[No output]
welp im going to go to sleep its 5am already so Gn guys
good morning
true programmer trait
it's 4am not 5
its literally morning in my country rn

nO
Can i ask ppl to help me code a command here? Because i dont know how to do it
yea ofc
I stay up until 9am :)
let me talk in 4 more minutes arl and youll be wrong
have you attempted to code the command
Idk what variables and stuff to use so
!remind 4M
Sorry, you can't do that here!
🛏️
darn
.topic
@client.command()
async def stat(ctx, reason):
r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=whatiswrong", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])
Im trying to code a drop command, where the bot sends a message and the first person to react wins the drop
plshelp
!code

is !