#discord-bots
1 messages · Page 716 of 1
pinging everyone wont get you banned
im sure the staff members have enough common sense to block your ability to mass ping.
LOL
wait... i can
it turned blue in my typing box
do you know how discord works?
u try
it does . everytime
:/
type and send it. it turns blue always. but it doesn’t ping anyone
nothings gonna happen lol
exactly
:D
seccd = round(name.get_cooldown_retry_after(ctx))
mincd = 0
hrcd = 0
rseccd = 0
rmincd = 0
if seccd > 59:
rseccd = seccd % 60
mincd = (seccd - rseccd) / 60
if mincd > 59:
rmincd = mincd % 60
hrcd = (mincd - rmincd) / 60
if rseccd == 0 and rmincd == 0 and hrcd == 0:
res += f':white_check_mark: {name}\n'
else:
res += f':spinning_clock: {name}: **{hrcd}h {rmincd}m {rseccd}s**\n'
Na. i changed a few things.
Your indent might be set to 1 or 2 spaces while mines set to like 4 spaces
don’t spoonfeed.
I'm trying to code my discord bot and doing a if statement which should be simple 😕
if errorcode != '1':
print("does not equal")
return
else:
print("does equal")
return```
It always said it didn't equal so I figured I'd try the print the errorcode and it says the same thing (does not equal) whether error code is 0 or 1 😦
any help?
why return
oh because I was trying to kill it if it went down that way
oo ok
return is the same as saying 'ignore everything else, yeet stuff back'
Just start yeeting
Yes it's all it does
there is other commands that I'll be putting in there, I just made this simple to try to get it right to make sure
yeet whatever you tell it to yeet.
any ideas?
!d return
7.6. The return statement
return_stmt ::= "return" [expression_list]
``` [`return`](https://docs.python.org/3/reference/simple_stmts.html#return) may only occur syntactically nested in a function definition, not within a nested class definition.
If an expression list is present, it is evaluated, else `None` is substituted.
[`return`](https://docs.python.org/3/reference/simple_stmts.html#return) leaves the current function call with the expression list (or `None`) as return value...
thats what it does
it's what I said. stops the function and yeets stuff back.
okay. return is not my question though? Unless that is breaking it?
It's how I remember it.
return is breaking it.
using 'return' is the same as saying 'Hey, Can you please stop doing whatever you're doing and return this to whoever called you? kthnxbai'
good example, but not always
Well im still beginner and thats how I view it at the moment.
I've always used it as end this script at this point
I am yet to find a use for the return other than returning values to whatever called the function.
me literally put return statement whenever the statement isnt working
Use break instead
it can be used for more than throwing a value , it could be used to return to the function call after a certain condition if you
break will jump out of loops
but it shouldn't see any of that return if it is not equal to 1 right?
it should go to the else statement
According to stackoverflow you can just specify return as a way of just stopping stuff 😮 so there is more than 1 use for return
not really sometimes it can return something
def function(name: str) -> str:
return "hello my name is" + name
I've always just used break /shrug
if it’s not one it will execute whatever’s in the if scope
Wow
told you. beginner 😎
oof
eevee is back :/ after longgggg time
How is this related to discord bots tho ;-;
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
smh
but it is executing it even if it is 1?
that is the issue
Hmm, yeah I was on my alt
Case closed
which is ur alt =.=
What
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Try printing the errorcode before the if statements
I did. I'm going to try getting rid of the quotes
oh
why indent
?
don’t ask me . that’s not my code
you can save 2 lines of code there tho, why use return in another line
getting rid of the quotes fixed it 
that’s. not. my. code. that. is. a. screenshot.
I'm new to coding lol, I'm sure you'll find lots of things like that 🙂
Lol
Mhm mhm, good luck
lets wait for another 10 days and see someone regretting this decision like me
lol
Can someone help me make a discord music bot?
we cant help without an error
actually, the return statement in the if and else scope could be necessary. say there was more code below, but wanted to stop the function execution depending on which one returned Truethy.
the code would have kept running otherwise.
ok
just ask here
those pro will help u
i don’t think putting them in both scopes was necessary, but only one could come with purpose.
huh, I meant you could just do
if whateveryourconditionwas:
return print("smh")
else:
return print("Smhh")
ah, i thought you meant “saving lines” as in completely removing the return statement
huh
i don’t think the moderate members permission is a thing in discord.py as it isn’t being maintained anymore thus missing updates from discord.
assuming that’s new , i haven’t been keeping tabs on that recently
it’s a troll. give it no attention.
nice , what’s your project?
you know about discord.Color.blue() right
mhm
well my package is an extension of 1k colors no jk
made a discord instance as well
hope it goes well
its called heximals and the discord one returns a int which would be 0xhex so i made another one that returns a str version of a bare hex code pretty nice
anyone wanna see a sexy help command
caeden really
indeed
dm it
jesterbot is a discord-bot coded in discord.py with over 230 commands and 27 cogs. - JesterBot/helpcommand.py at main · CaedenPH/JesterBot
i think you’ve dm’d me your help command before
new and improved
bro that gif you sent just wasn’t it 😭
remade it a couple days ago
what gif? looks away
kinda misclicked ngl
lmao
i looked up sexy
wasn’t the smartest idea to send it xd
async def help(self, ctx: Context, command=None) -> None:
if not command:
embed = await self.utils.main_help_embed(ctx)
return await ctx.send(embed=embed, view=DropdownView(self.data, ctx, self.utils))
cmd = self.bot.get_command(command)
if cmd:
embed = await self.utils.specific_command(cmd, ctx)
return await ctx.send(embed=embed)
cog = await self.utils.get_cog_from_str(command)
if cog:
embed = await self.utils.specific_cog(cog, ctx)
return await ctx.send(embed=embed)
embed = await self.utils.no_command(ctx)
return await ctx.send(embed=embed)
doesnt this return a embed?
does what return an embed
the botton
what
return await ctx.send(embed=embed)
async def help(self, ctx: Context, command=None) -> None:
what about that
doesnt the coro return an embed?
no, returns Message
typehints dont have to be exactly what it returns im just returning none because its not being used anywhere. and no, it returns an instance of disnake.Message not an embed 
my bad
understandable
typehints are for the person to read the code - if i return none its because its a standalone function and wont be called anywhere
ok
sure
@bot.command()
async def giveaway(ctx):
j = input("giveaway reward/title:\n")
u = input("whats the hosts name:\n")
r = input("any more info like contacting info:\n")
h = input("how much seconds for the giveaway to end(options:0s 1m 5m 30m 1h 24h ):\n")
if h == "1m":
await asyncio.sleep(60)
print("1 m delay has been set")
elif h == "5m":
await asyncio.sleep(300)
print("5m delay has been set")
elif h == "30m":
await asyncio.sleep(1800)
print("30m delay has been set")
elif h == "1h":
await asyncio.sleep(3600)
print("1h delay has been set")
elif h == "24h":
await asyncio.sleep(86400)
print("24h delay has been set")
else:
print("0s delay has been set")
embed = disnake.Embed(title=f"🎉{j}🎉",
description=f"the winner is:{random.choice(ctx.guild.members).mention}\nhosted by {u}\n {r}",
colour=0x3498db)
g = await bot.get_channel(905616933905387531).send(embed=embed)
print(f"{j} giveaway has been made")
this hurts my eyes now
😂
input is very asynchronous, i might start recommending it
LOL
ikr
its horrible
ive learned allot ngl
makes me wanna cry how much i have😮💨🥲
not enough
oof
oops
😭
Really, ask the moderaors to make an announce for your unnaturally "sexy" help command
you’re *
only been 9months smh
you mean this? <3
you really needed to?
"discord" is not accessedPylance Import "discord" could not be resolvedPylancereportMissingImports
yes
Yeah
someone pls help
smh
restart ide
Sad
what was tha
i read that
😳
kinda weird
idk
weird fucker
And dont use dpy if you are starting on a new project, I'd recommend some other fork @blazing lynx
wasnt me wtf?
How can you make ur text like that
okok apologies
~~text here~~
2 ~ in the end and start of a msg
hellp
~~Your text~~
smh
🚶
@slate swan coughs, hey idiot
i didnt know the tag commands were a bunch of .mds
your not funny
i added them in a secon
smh🚶
You're*, And who said I was trying to make a joke
you looked at the source code?
i went to resources
o
so technically
i cba to read the python bot code because its so fucking long and ott it gives you airborne cancer
You're, And who said I was trying to make a joke.*
coughs, your messages completely dont make sense now ;-;
is there a good public fork?
DISNAKE
!pypi disnake
period at the end.
imagine copying my example lmao
you have a problen jeez
im not the one who spends 7 hours coding in a row 
😐 phone I am on, typing speed slow mine is
damn why yall exposing me😔
i want my pull request
chill tomorrow smh
discord.py, all forks are bad
I suppose I will use discord.py until it will stop functioning…. Or one or two specific forks become the prominent one or two
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
im trying to publish my project in pypi smh
use twindle
for what

to upload to pypi?
aint no way you’re gonna justify all the ot shit you said
im just following their tutorial🚶
Lmao
sad
¯_(ツ)_/¯
no
wut

You did not just use that emoji
ill do it their way since its their site
it isnt wrong?

The easiest way would to just use poetry
I literally package my whole wrapper to pypi via poetry build
I need help with my discord bot I get this error message when I try to run it Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
@bot.slash_command()
async def ping(inter):
await inter.process.send_message("Pong!")
i used the example on docs
Do I have to install/generate/download new certificate inside my system or is it possible for me somehow to disable certificates inside the python? (ubuntu 18, python 3.7, discord.py latest)
[INFO...
What library?
python but using disnake
man said python
pieton
I don't understand the answer
can someone plz explain
inter.response.send_message
Traceback (most recent call last):
File "/home/fazeexotic224/ZeroOne/bot.py", line 12, in <module>
import exceptions
ModuleNotFoundError: No module named 'exceptions'
i tried using pip to install it and it said
fazeexotic224@penguin:~/ZeroOne$ sudo pip3 install exceptions
ERROR: Could not find a version that satisfies the requirement exceptions
ERROR: No matching distribution found for exceptions
anyone know?
Why import exceptions?
Go to your python path folder and you'll see a file named Install Certificates.command or something similar
@bot.event
async def on_slash_command_error(interaction: ApplicationCommandInteraction, error: Exception):
if isinstance(error, exceptions.UserBlacklisted):
You don't import it
Exception is an internal class
Oh you mean the isinstance
is exceptions.py a file or something?
how can i add a timer
like a countdown timer that shows the countdown as s message.
Yeah you can have only one , use listeners if you want to have many
is it client.listen()?
Idk why but when i changed my client.event to client.listen() every single command and event started happening twice
Because you don't need to add client.process_commands in listeners
It's only for commands
edym
wdym
!d discord.ext.commands.Command.get_cooldowm_retry_after
No documentation found for the requested symbol.
*events
can you give me an example?
You probably have process_commands inside the listener
That causes your commands to run twice
anyone know fix?
I'm sorry whats process_commands?
theres code
Do you have an on_message event?
if yes , see there you might have added it there
even the commands happening twice
🏃♀️
yep, as soon as I change from .event to .listen() everything in the code, including the commands start happening twice
If you change it to listen
Remove client.process_commands(message) from your on_message event
kk 1 sec
how do i make it so once they join it also sends a welcome card just like mee6?
worked thanks
Use pillow
!PyPi pillow
Worked, but my other event still isnt working for some reason.
Here's the code:
@client.listen()
async def on_member_join(member):
dm = await member.create.dm()
await dm.send('Hello! Welcome to Jay\'s Server!')
how to make a help command simular to dank memer? like "zo!help <category>"
using disnake
anyone?
how do I connect a postgresql with my discord bot hosted in heroku
@client.listen()
async def on_member_join(member):
dm = await member.create.dm()
await dm.send('Hello! Welcome to Jay\'s Server!')
@slate swan
not working for some reason
Member intents?
Subclass the default help command
could u not directly do member.send?
not working either
.
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.
@commands.command()
async def help(self, ctx):
if ctx.message.content == "fun":
embed = disnake.Embed(title="Fun Commands", description="`randomfact`, `coinflip`, `rps`")
await ctx.send(embed = embed)
its not sending the message?
Your if statement can never be true
wym
why do you think you will send a message !help and it's content will be equal to fun
!e print("!help"=="fun") # is what u r doing
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
just do "!help fun" instead of "fun"
How would that fix the issue
The command name is help, and thus ctx.message.content has to be <prefix>help
It wouldn't pass the first if statement
How to press button using discord.py
you click on it
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
Bot's cannot press buttons
I thought they wanted to make buttons but mis-phrased it
so
if ctx.message.context == "zo!help fun":
code here
?
it's content not context
ye
No how to make discord bot click on it
thanks
Oof
well andy just said u cannot
Haa kk
how to make it so if someone mentions my bot the bot sends a message?
how to add delay in message
Not sure what you mean by that but
!d asyncio.sleep
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
like if I run a bot command I don't want the reply to be sent instantly
Use what I displayed above then
kk
dont remove help command
subclass it
how to make it so if someone mentions my bot the bot sends a message?
use on_message, check if the content == the bot's ping or not
kk
There's something called mentioned_in
Search for it in the docs
@bot.command(name='mine')
@commands.cooldown(1, 60, commands.BucketType.user)
async def mine(ctx):
num1 = random.randint(0, 100)
num2 = random.randint(0, 100)
lootcount = 101
loottype = None
await emoji(ctx)
if area in [1, 2]:
if num1 <= 40:
loottype = 'coal'
emoji = ecoal
elif num1 <= 100:
loottype = 'cobble'
emoji = ecobble
UnboundLocalError
would anyone know why my
async def hello(ctx, arg1=None, arg2=None):
await ctx.send(f'Hi! arg1={arg1} arg2={arg2}')```
is not working, the console is saying
bot is not defined
I cannot use any @bot commands
he probably used client instead of bot
oooh no its does not
...
possible
yes
import os
bot = commands.Bot(command_prefix=['rpm ', 'Rpm ', 'RPM '])
@client.event
async def on_ready():
print('JB Bot Is Logged In {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return```
client.event change to bot.event
Does that mean I have to change the client.event too
yes
ahhh, so what is the difference there
change all client.blahblah to bot.blahblah
is there any advantage to having client over bot or vise versa
the tutorial I used had client - guess im switching to bots then😁
Any good links to discord.py tutorials bc YouTube tutorials are dogshit?
bot = commands.Bot(command_prefix=['rpm ', 'Rpm ', 'RPM '])
so how does that work
whats ur bot prefix
Freecodecamp has a discord.py tutorial?
command_prefix = ur prefix
like for commands, im using "-"
how to make it so if someone mentions my bot the bot sends a message? simple example
^^^^
@visual island im done with my project lol
like lets say my bot is @novel apex right? if someone pings @novel apex it should send a message.
oo
import os
bot = commands.Bot(command_prefix= '-')
@bot.event
async def on_ready():
print('JB Bot Is Logged In {0.user}'.format(client))
@bot.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('-test'):
await message.channel.send('**B Economy Is Fully Operational**')
if message.content.startswith('-where'):
channel = client.get_channel(925571626609819678)
await channel.send('Here')
@bot.command()
async def hello(ctx):
await ctx.send(ctx.author.mention + " hello!")
client.run(os.getenv('TOKEN'))```
so im getting a bit of errors, what else should I change here regarding changing the client -> bot
do you know how?
@bot.event
async def on_message(message):
mention = f'<@!{bot.user.id}>'
if mention in message.content:
await message.channel.send("You mentioned me")
```i get this from stackoverflow
looks like it should work
but maybe there is a better way
@blazing lynx
try if it works
second if statement should be an elif
kk
it worked tysm!
lmao
lol
i finally finished my project that i was working on for 7h straight lol
nice
kinda happy
I have zero clue how prefix's work here..
u know what is prefix?
not really
now i will go to sleep gn probably wont go to sleep
im guessing the symbol to call a command
yup
like !
it can be letters also
can it be
strs as well
anything literally
anything to start a command
but try not to make it to hard to type
so does this work
bot = commands.Bot(command_prefix= -)
like !@#$#@
should be in a str
bot = commands.Bot(command_prefix= '-')
correct
quotes and they can be single and double
ahh, but then it becomes an area
sure
i prefer ' '
but most of the human out there prefer " "
from discord.ext import commands
THERE WE GO
your using the bot framework so you need to import it
!d discord.ext.commands.Bot
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.
Traceback (most recent call last):
File "main.py", line 30, in <module>
bot.run(os.getenv('TOKEN'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 665, in start
await self.login(*args, bot=bot)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 216, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
KeyboardInterrupt
KeyboardInterrupt
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
:/
I just got that error now 🔪
ya
you got ratelimited
u spammed the start stop button too much
are u using the 247 thing?
247 thing? whats that
happens when you do to many request in this case as your using replit someone with the ip your sharing is requesting to much and everyone on it got ratelimited
ofc since it shares ip
@shadow wraith wanna see my new project
!pypi discordheximals
returns hexcode by name for discord.py and its forks

im using config.json for my prefix. how can i make a changeable prefix?
who?
keref
should I use Visual Studio Code instead then
using disnake
yes
why tf are you using a config.json, you can just add a prefix in commands.Bot(command_prefix=...)
Imagine no source on GitHub 😬
ik.
If I say "!search Whiteflame362", how can I separate the "!search" from "Whiteflame362" so I can use it in my code
when i do (prefix) then ban @amber beacon it doesnt ban them
await channel.history(limit = 10).flatten()
does this give last 10 messages ? how to get first 10 messages
and they are lower than my role and i have perms (im owner)
wdym?
manage messages deco for ban command? Sus 
There's only three files on your GitHub, no source of the module
i mean kind of yea LMAO
sorry guys... how do I run the code on Visual Studio Code, like what do I type in the terminal
should i upload it its just 1000functions
To GitHub? Yes
python file.py
If I say "!search Whiteflame362", how can I separate the "!search" from "Whiteflame362" so I can use it in my code
look for that play buttonm
Use commands
!d discord.ext.commands.command
@discord.ext.commands.command(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or if called with [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.group "discord.ext.commands.group"), [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").
By default the `help` attribute is received automatically from the docstring of the function and is cleaned up with the use of `inspect.cleandoc`. If the docstring is `bytes`, then it is decoded into [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") using utf-8 encoding.
All checks added using the [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") & co. decorators are added into the function. There is no way to supply your own checks through this decorator.
🙏
is it possible to make a marry command system simular to ZeroTwo's MArry Command in python?
Sure
@maiden fable done
Thanks
what would i have to use
Oh cool
A db?
yeah
ware is the github 🚎
nah where is the github for discordheximals
@slate swan btw another thing
?
nvmnvm
Don't title it as discordheximals. Since it can also be used as a general color code module. That title makes it look like u can only use it with discord modules
woah oh fuck wtf is this
it cant
Why?
it returns
0xhexcode as a int
Sooo?
i did made a instance for a general one which i will publish tomorrow that returns a str
also @slate swan, make a class which has a method to convert to hex, binary, rgb, etc. Then return that class in every static method
Many modules use that sorta codes too
ok thanks i will install discordheximals now :]
all the colors
This too
there are 10 million colors but okay
you want a class converter?
😉
Class converter?
no sorry i ment
fu-
pip install it when
i pip3 installed it
a class that converts hex code to rgb?
since pip is always undefined according to my terminal :[
its just a import couldn't be resolvd
and you just need to do
import discordheximals
O
still the same error
!e
class A:
@staticmethod
def b():
return 1
print(getattr(A, "b")())
@maiden fable :white_check_mark: Your eval job has completed with return code 0.
1
Oh, hmm
it happened to me as well but i resolved it
im thinking cause i forgot
🔪
Did u pip install it? @shadow wraith
no like
class ColorType:
def __init__(self, value):
self.value = value
def to_rgb(self): ...
def to_binary(self): ...
def __repr__(self): return self.value
class Color:
@staticmethod
def color() -> ColorType:
return ColorType(0xSomething)
weird
because my error wasnt really like that
thats to complicated for me
bro im gonna kms rn
color=discordheximals.Color.colorname()
thats how it should be
Ik that feeling dw
your making a bad impression of my module🚶
how if you want to make a command which returns the rgb of a given color name? It should be something like
@bot.command()
async def color(ctx, color: str) -> None:
await ctx.send(str(getattr(discordheximals, color).to_rgb()))
its for embed colors smh

should state that

have to update its example as well since its wrong
im dying rn
Imagine making a module specially for embed colors even when people don't know half the color names in your module 😐
it has over 1k colors just learn them all smh
Me who doesn't use embeds: 

@shadow wraith i had the same error but it was because the file name was the same as the directories so pycharm had a stroke
742*
weird, my file name is lounge.py and discordheximals is not the same name unless your trolling ofc
smh you counting them now
nah im not
🤣 dude I never knew u were so free
still allot
actually I'll just go rn and do some work, so, uhhh
nahh, cntrl + f to the rescue
Oh hmm better
btw i ment the folder lol but it wont happen to you
import discordheximals
@bot.command()
async def example(ctx):
embed = discord.Embed(title="title",color=discordheximals.Color.colorname())
await ctx.send(embed=embed)
thays how it should look like
Use hexcodes
no
why not
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
smh
that's seriously not required and you should stop spamming ot ot ot ot ot ot for the questions you cant answer
why use color hex codes if you can search it by the name?
A random method to select a random color code 
make a pr
why install a library when you can use inbuilt methods
you make no sense
Just make a clear point of yours
ahem ahem can we stop here
no
lol
alright, delete your essay @slate swan
742colors
Okay then imma go to some other chat. Have fun
oof
be honest, did u copy it?
did the command got triggered?
There can be many reasons
- your error handler avoids the error
- you have an on_message event which doesn't let the command process
add a print statment to check if the command gets triggered
Understand the power of debug prints :D
do you have on_message event?
why the snakeCasing lol
msg = await bot.wait_for("message")
if msg == "open":
there is no interaction. why?
says it
msg.content ==
ohh, thanks!
you cannot compare a string to a discord.Message object
thisIsSnakeCasing first letter is lowercase, then every new word after the first word is capitalized
error
RuntimeWarning: coroutine 'send_override' was never awaited ctx.send(file=discord.File('assets/abe.png')) RuntimeWarning: Enable tracemalloc to get the object allocation traceback
snakeCasing
send is a coroutine, await it
!d discord.abc.Messageable.send
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**.
channel = await ctx.guild.create_text_channel(f'')
how do i assign this to a specific category?
!d discord.Guild.create_text_channel has a category kwarg, use it
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
thanks!
👍
You awaited it?
Then ik
It is cuz it doesn't know in ctx.channel
There is something like send
If u do channel: discord.TextChannel = ctx.channel
It will come
what's the need? if u are passing Context can u not just do ctx.send()
@slate swan
Exactly
also I didn't understand what that meant
Lul
"why is this not colored in"
He wants that in colored
colored in what
Ofc it will
because ctx is just a parameter passed in the function and all the work takes place when the code is run
Exactly
it's just color
A room?
Like ctx: commands.Context
!d discord.CategoryChannel ? maybe
class discord.CategoryChannel```
Represents a Discord channel category.
These are useful to group channels to logical compartments.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the category’s hash.
str(x) Returns the category’s name.
yeah a channel sorry
i said room because in my country its the same thing like channel and room
and i totally forgot
😆
check if the category of the channel is a certain category ```py
channel = ...
category = ...
if channel.category == category:
...
ok, thx
or , channel in category.channels 📚

@slate swan https://github.com/Okimii/discordheximals/pull/1
yeah idk
🏃♀️ the readme
I'll guess okimii just did dir(file)
how you know
i approaved it
i need to update the pypi file tho
ill do it tomorrow
I do that often when I'm lazy to open a browser tab and I need to find a property of some Object
try msg.content == ...
yeah
🥴
why y'all hating the read me smh 
same
U know... the readme should be a bit more creative
You could have done something like ```py
print(f"{' , '.join(dir(Color))}")
Lmfao
contribute to it then
😮💨
U know... I haven't opened my lappy since 1 week
then why opinion on it
jk
I forgor how to make a pull req

🚶
Cz why not
lol
give me command ideas
@slate swan i fixed the issue by copying all the discordheximals.py code into a file in my bot's directory to locally import x]
XD
utilities my module
pypi command like how you can do with !pypi <proj>
https://github.com/Okimii/discordheximals tl;dr, red, green, blue, brown, purple, pink, white, black
i already have that
oh fuck you do 💀
😭
i should make an img with all the names with sorts as a blue zone with all the blues and stuff but ill do thag another time
it the meanwhile watch the read me
import json
import disnake
from disnake.ext import commands
class Cookies(commands.Cog, name="cookies"):
def __init__(self, bot):
self.bot = bot
async def get_bank_data():
with open("bank.json", "r") as f:
users = json.load(f)
return users
async def open_account(user, message: disnake.Message):
users = await get_bank_data()
if str(message.author.id) in users:
return False
with open("bank.json","r") as f:
users = json.load(f)
if str(user.id) in users:
return False
else:
users[str(user.id)]["cookies"] = 0
with open("bank.json", "w") as f:
json.dump(users,f)
return true
@commands.command()
async def cookies(self, ctx):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
cookies_amt = users[str(user.id)]["cookies"]
#this will get the data from the .json file
em = discord.Embed(title = f"{ctx.author.name}'s balance", color =random.randint(0, 16777215) )
em.add_field(name = "Cookies ",value = cookies_amt + "🍪")
await ctx.send(embed = em)
@commands.command()
async def beg(self, ctx):
await open_account(ctx.author)
users = await get_bank_data()
#fetches the data for the author
user = ctx.author
earnings = random.randrange(101)
await ctx.send(f"Someone gave you {earnings} coins!!")
#randomizes the earnings and tells you
users[str(user.id)]["cookies"] += earnings
with open("bank.json", "w") as f:
json.dump(users, f)
def setup(bot):
bot.add_cog(Cookies(bot))
ExtensionFailed: Extension 'cogs.cookies' raised an error: NameError: name 'message' is not defined
Sure
!d discord.TextChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
Indent
where
!indent
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
@slate swan mind if i create a pull req? ( just a better readme and code format )
get_bank_data and open_account are inside _init_
bro don't lie is that copied?
ive seen that before
yes
oh 😭
tutorial on yt
do you even know what the code does?
i am new in discord.py
from where i can get the best tutorial? 🥺
yes. im not a dumbass
yes but im using it in cogs
reading the documentation
ok we cool then we cool
Umm. Ok
lol
Are you new to python or not?
Nope
move the helper functions outside init and use self.function_name to call them
There are some examples in discord.py repo you can use them to get started also
Ok. Thnx
Hi everyone! Recently I started writing a small Python bot for Discord. I found Permissions.voice() in the documentation, which in theory should automatically enable all voice permissions, but I ran into the problem of how to pass it to set_permissions method. Can someone explain?
channel.set_permissions(Role/User , overwrite = new_overwrite)```
If you pass Permissions.voice as overwrite, then an error will occur
discord.errors.InvalidArgument: Invalid overwrite type provided.
any way to set a file on my PC in
embed.set_image
Hello, I need member to enter a number e.g. "!test 100" how I can get that number?
or it only runs with URL
I also decided to do this at first, but it didn't work
await channel.set_permissions(member, overwrite=Permissions.voice())
ot but flex 😎
!d discord.File
class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
@leaden hollow
ty
how do you even check this ? 
Hmm, but how?
read the docs link i sent above , if you can still not figure it out lemme know
owh thanks !
try this
await channel.set_permissions(member_or_role, **dict(discord.Permissions.voice())
It works, thanks!
👍
how to send random gifs inside a embed?
!d random.choice
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
give a list of urls
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.image.url: Scheme "e" is not supported. Scheme must be one of ('http', 'https').
it was a "https"
it was a "e"
Code?
thats only for 2 options i want more than 2
what
!e
import random
a = ["one", "two", "three"]
print(random.choice(a))
@visual island :white_check_mark: Your eval job has completed with return code 0.
one
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: choice() takes 2 positional arguments but 4 were given
give a list of urls
anyone have a stupid command idea where the bot posts 2 sentences which rhyme
without a list, tuple or something. just randomness
Anyone knows any good button paginators?
How do i disable a select menu
Ah ty
!d disnake.ui.Select.disabled
property disabled: bool```
Whether the select is disabled or not.
thanks
how do i make it timeout tho
like on_timeout
what is the name for TypeError: 'NoneType' object is not subscriptable?
i mean if command not found error's name is CommandNotFound, then what is the name of TypeError: 'NoneType' object is not subscriptable
name?
i mean like CommandNotFound :v ||i bet u don't understand||
TypeError
just that?
!e
if 1 == 1:
raise TypeError('yep just that')
@boreal ravine :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: yep just that
ok, mark dissapear and kayle appear
who is mark?
ok, ur memory wiped
TypeErrorNoneType
is this
NoneType is subscriptable part?
It's part of error message afaik
so command not found type is different from TypeError?
oh, NoneType is subscriptable part is not traceback?
thats the error message
.
so i wanna make a system to send message when NoneType is not subscriptable error is shows up, how to do that
- you make an error handler
- make a command error
- you handle/send the message in your command
nah what is the command error ;-;
wait, can i just:
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, TypeError):
yes
yay thanks
i came here for cool command ideas people are attempting to do
@bot.command()
async def command(ctx):
...
@command.error
async def command_error(ctx):
...
what bot do you have?
basically , just View.children[menu's index here].disabled=True
examples/views/disable_view.py lines 7 to 18
class MyView(disnake.ui.View):
message: disnake.Message
def __init__(self):
super().__init__(timeout=30.0)
async def on_timeout(self):
# Once the view times out we disable the first button and remove the second button
self.children[0].disabled = True # type: ignore
self.remove_item(self.children[1])
# make sure to update the message with the new buttons
await self.message.edit(view=self)```
will that work for a select menu class?
for sure , yes im using it
doesn't exist? or should i put the on_timeout method somewhere else
How can I get a role's ID by pinging it? discord.Role does not seem to work
!d discord.Role.id ig
The ID for the role.
:0
on_timeout is a method of View
tysm
I should put it in my view class then?
yea , just pass a timeout= in it
class View(discord.ui.Select):
...
class MyView(discord.ui.View):
def __init__(self):
super().__init__(timeout=10)
self.add_item(View())
async def on_timeout(self):
... # what index is it gonna be?
depends on the order you added the VIew, assuming its first , self.children[0] would be the thing
thanks
@client.command()
async def modrole(ctx, ping = discord.Role.id): #the error happens here
guild_id = ctx.guild.id
role_id = ping
if ctx.author.id == ctx.guild.owner_id:
dbc.execute('update guild set modrole_id = ? where guild_id = ?', (role_id, guild_id))
db.commit
print(f'<@&{role_id} is now the `modrole` on this server!')
else:
await ctx.send("Only server owner can do this!")```
Are you type hinting ping parameter?
Or setting it as the default ;-;
Ikr
and the = :meh:
That's what i meant
Where’s the PEP8
what do you guys prefer for formatting your code? 
give command ideas
black
always
does anyone know how to code a discord bot to send teext
mhm i started using black now , makes the code look better
do you already have something ?
or you just want to start with it
i just ahve a bot
no
i just watched some python tutorials, and now want to learn to make discord bot, how to start that
you might begin with installing the discord.py library , how experienced are you with python?
o-o
a bit
!d discord.ctx.send || maybe this command works
No documentation found for the requested symbol.
but i only know competitive python
Shoot. Well it’s ctx.send()
imagine
!d discord.ext.commands.Context.send
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**.
install a discord api wrapper and continue with it
^^ @velvet tinsel
i just searched a tutorial online and i followed it
I hate you kayle
great , so install the python package first
🐟
wdym
should i replace with :?
and like add =None or whatever?
def function(value : int):``` is typehinting
```py
def function(value = 1) :``` is giving a default value
```py
def function( value = str(int)):``` is what u r doing
iirc it should be :
I understand
Good 👍
i added an on_message code and after adding that code to my file, my commands dont work
then i would ping_id = ping.id right?
yes
right ty
Did you try listen()?
Oh it says there
imagine them using .listen() and adding process_commands too
Also I think the docs are misleading
🤯
why?
You don’t really need a listen(“on_message”) if you are using an on_message
You can just leave it blank and use on_message()
Works for me
And my bot
yea , but what if you want to have multiple on_message events
only one of them would work then
If statements I guess?
"what if"
why not just ```py
@listener("on_message")
async def event_1(self , msg):
@listener("on_message")
async def event_2(self , msg):
yea
Yeah
But you can…I can’t write code
i did what the docs said but they told me to put message in the brackets, that came in an error so i changed it to msg the code i have that includes on_message is
@bot.event
async def on_message(msg):
for word in filtered_words:
if word in msg.content:
await msg.delete()
await bot.process_commands(msg)```
what if i have two codes containing on_message
Then do what @slate swan said
so i change @bot.event to @bot.listen()?
Something like this
Yep
okkk
is there any way to have multiple inputs possible for one command? ex: !help and !commands
how would i use that ?
where can i declare the arguments *
you add it as a parameter for your command
@bot.command()
async def say(ctx,word):
await ctx.send(word)```
example
what could be the cause of this problem ? when I tested on my server i dont c any error. on_raw_reaction_add
ah alright
do you know how i can have multiple args tho?
add another , and arg py async def command(ctx , arg1 , arg2):
okay
@oblique adder seems like u can't access the channel