#discord-bots
1 messages · Page 717 of 1
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
Lemme see
@slate swan it doesnt work when im trying to use !help or !commands
@bot.command()
async def say(ctx, help, commands):
await ctx.send("help list")
change help to something else as help is a built in thing in python
bot.remove_command('help') i have this
what are u trying to do
im trying to have multiple inputs for the same answer
like a random choice?
give command ideass
suggest
ex: both !cat and !kitten send the same thing without having the command twice
of the same cat?
yeah
ok ig
A command to suggest command ideas
in discord js it works with the or operator but that doesnt seem to work here too
@bot.command()
async def cat(ctx):
await ctx.send("cat")```
```py
@bot.command()
async def kitten(ctx):
await ctx.send("cat")```
is this what u mean
A command which will accept an ebook file as the argument, parse it, and find the difficult words used in it, and getting the meaning and examples and other stuff about the words @boreal ravine
whats an ebook lol
Epub file
use aliases
so u dont want to type in 2 commands?
yes
how?
Had an exception last night - how do I troubleshoot something like this? I tried searching the error and was unsuccessful in finding it
AttributeError: '_ProactorSocketTransport' object has no attribute '_sock'
Unclosed connection
full error:
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001E2F7D02560>
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 114, in __del__
if self._sock is not None:
AttributeError: '_ProactorSocketTransport' object has no attribute '_sock'
Unclosed connection
client_connection: Connection<ConnectionKey(host='discord.com', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
Any ideas?
@bot.command(aliases=[])
i only know how to do it with js
@bot.command(aliases=['cat'])
async def kitten(ctx):
Show the whole traceback
thanks @maiden fable @fervent shard @oblique adder
And what's your Python version?
👍
np
idk how to fix mine 
Which
if I can't access the channel how come the bot know that someone have add an reaction ?
thank yall so much i was in such a desperate need of these aliases lol
aww
That is the whole traceback that appeared in my terminal this morning
My inclination is to assume it was caused by my attempt at an error handler for the message_sender method, simply resending after 2*n seconds per failed attempt
but even that I'm not sure about, that would just send another message so it doesn't seem like it'd break anything necessarily
just send a duplicate at worst
The message_sender retry loop was the feature I was testing last night and this is likewise my first time seeing that error as well
hey, it works but when i use commands, it replies 2 times
Remove await bot.process_commands(message)
Hello, I need member to enter a number e.g. "!test 100" how I can get that number in variable?
What do you mean hunter?
@bot.command(...)
async def cmd(ctx, num: int):
. . .
In the if statement
Thank you
Why u doing isinstance(message, discord.Embed)
Why am I using the isinstance to check for embed? I guess it might not be necessary if it recognizes the message is an embed without being told it is an embed via kwarg, I did so assuming it needed to be a kwarg'd "embed=embed" type keyword if it were an embed
!d discord.Message.embeds
A list of embeds the message has.
I did type(message) and determined the type was the one I included the discord.embeds.Embed
Uhhh?
I am trying to import information from another python file, why does it say module not found...
from weatherinfo import *
sec I will demonstrate
what's an API which looks for a rhyming word with the word given (and changes everytime reloaded)
class 'discord.embeds.Embed'
my help command is an embed and since it hit that print statement it is being seen as isinstance == True
is there a way to have only one command not using the prefix
Why
you could use an on_message event
Why are you using isinstance
if I don't use the isintance and separate loop it sends embed like this:
ill check that out
you could do:
@bot.event
async def on_message(message):
if message.content == ...:
...
aight
this will check if the message content IS the content and can't be seperated by spaces and shit, exact or no output
I think there is a string method like startswith
you could maybe use that here?
if message.content.startswith('yourcommand'):
celebrate_party_time()
Just an idea, seems like it would do the job
No
For that, ull have to edit the source code of discord.py, so, uhhh
Why you wanna work with on_message?
Because they don’t want a prefix
im trying to think of an api which uses json and finds a random rhyming word with the word given
that shit is messy asf
all of the objs are the same "word"
if i could get an example of using the api with aiohttp, that would be appreciated.
you'd just make a get request with the params you want
so in the case of just a word that rhymes you'd do
https://api.datamuse.com/words?rel_rhy={word}
ok but the json thing
how will the bot choose a random "word" property from the json
How come I receive a module not found error?
from weatherinfo import parse_data,weather_message,error_message
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.weather' raised an error: ModuleNotFoundError: No module named 'weatherinfo'
@shadow wraith :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print(len(test)))
003 | ^
004 | SyntaxError: unmatched ')'
and if you wanted to use a random choice you could have choice(num) where num = len(result) as an example
@commands.command()
async def help(self, ctx):
culoare = "{:06x}".format(random.randint(0, 0xFFFFFF))
embed = discord.Embed(title="Commands for this bot!", description="**Prefixul acestui bot este ´.´ **", color=culoare)
embed.add_field(name="kick", value="Foloseste .kick pentru a dat kick unui membru.", inline=True)
embed.set_footer(text="La Plesneala")
await ctx.reply(embed=embed)
how to make the embed color random thats what i did
!e
test = {1: "one", 2: "two"}
print(len(test))
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
2
no not a dict
discord.Colour.random()
len on the list itself
!e
test = [{1: "one", 2: "two"}]
print(len(test))
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
1
thats all?
yup, set it as the color property in ur embed
look at the api result, it'd be like this
ok
!e
test = [{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]
print(len(test))
@ebon island :white_check_mark: Your eval job has completed with return code 0.
7
i counted and that's.... 7 "word" "objects" in the dict
yeah
cool cool
hence why len of the list == 7
it's not in the dict
I have to correct your phrasing
i was thinking of the minimum but i could do 0 as the minimum x]
there are 7 dicts in the list
yeah, returning [0] will always return a result if there was one
0 and len(test) would make up for the random number word value generation? am i right?
@shadow wraith u can always do dict[(len(dict) -1)] haha
why would it make up for a random number?
0 = 0 and len = 7 there won't be anything random
random rhyme x] like [random.randint(0, len(test)]['word']
so this would get a random word property, right???
!e
test =[{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]
import random
e = random.choice(test['word'])
print(e)
@shadow wraith :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | TypeError: list indices must be integers or slices, not str
fuck im stupid
!e
test =[{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]
import random
e = random.choice(test)
print(e)
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
{'word': 'netful', 'score': 28, 'numSyllables': 2}
!e
import random
test = [{"word":"fretful","score":398,"numSyllables":2},{"word":"regretful","score":302,"numSyllables":3},{"word":"threatful","score":129,"numSyllables":2},{"word":"netful","score":28,"numSyllables":2},{"word":"let phil","numSyllables":2},{"word":"met phil","numSyllables":2},{"word":"set fill","numSyllables":2}]
output = random.choice(test)['word']
print(output)
@ebon island :white_check_mark: Your eval job has completed with return code 0.
netful
oh alright that makes sense
well, i can handle some stuff like receiving the json
and reading it ig
!e
test = [{1: "one", 2: "two",3:"three"}]
print(test)
@grim dove :white_check_mark: Your eval job has completed with return code 0.
[{1: 'one', 2: 'two', 3: 'three'}]
btw, just as a note
better to use .get('word') instead of ['word'], I just used it as an example so it was easier to follow
!e doc set
@grim dove :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | doc set
003 | ^^^
004 | SyntaxError: invalid syntax
!e doc sets
@grim dove :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | doc sets
003 | ^^^^
004 | SyntaxError: invalid syntax
.get('word') won't throw an exception if the key is not present
@grim dove #bot-commands bruh
you could even have your error handling via that property
you could do it either via exception handling or via the return being None
https://api.datamuse.com/words?rel_rhy=frdsfs
returns
result = []
therefore if we use the same selection
result[0]['word']
it would throw an exception
but you could handle that via
try:
result[0]['word']
except IndexError:
do_something()
else:
do_something_else()
or alternatively
if result[0].get('word):
do_something_else()
else:
do_something()
as some examples of handling
the second case works because if there is nothing in the 'word' key in the 0th dict in the result it will return None therefore False on the if statement so it will hit the else
Any help here?
.has_permissions(...)
The error is pretty descriptive, you tried accessing an attribute that doesn't exist, be careful to be exact when accessing attributes of packages
Ok thanks for the help
You should use f strings by the way
there are other ~~problems ~~ imperfections in his code
like a hardcoded guild name etc
yeah
well
thats the neat part see my username first
how to?
as an example
await member.send(f'You are kicked from {ctx.guild} because {reason}')
!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.
Oh thta's why it wasnt working
assuming you have ctx passed into your method which you should
guild.name, otherwise you'd get the object
true, good point sniper makes
I always use the objects in my code haha but I have a special use case
with the correction it would be
await member.send(f'You are kicked from {ctx.guild.name} because {reason}')
member gets converted automatically iirc
like str(member)
would become Baron X#8210
OH
show us the data.json
maybe repr?
he was talking to someone else Zero
wasn't to you lol
:p
await member.send(f'You are banned from {no name no shame}, because:{reason}')
if you put something in the data, does it still error?
then what to put?
like I had
oki
because it will automatically fill it with your guild's name
Ok i ci c
and it will do the same if it happens on another server
{token}
get out of the habit of hard coding names and things
dont mind the name tho 
your code should aim to be reusable
discord/guild.py lines 335 to 336
def __str__(self) -> str:
return self.name or ''```
As I imagine you are not familiar with f strings, the {} actually opens a codeblock in your string
!e
test = 'this is a test string, 5+2 = {5+2}'
print(test)
@ebon island :white_check_mark: Your eval job has completed with return code 0.
this is a test string, 5+2 = {5+2}
aight, true, then it's alright
ah shit
I didn't make it an f string I am an idiot
!e
test = f'this is a test string, 5+2 = {5+2}'
print(test)
ye
@ebon island :white_check_mark: Your eval job has completed with return code 0.
this is a test string, 5+2 = 7
but I guess that is a good demonstration of the difference, fstrings can handle code right inside the string so you can call variables or do calculations right inside your string
whereas a normal string can only do text
can someone help me code my discord bot to send text?
there are lots of great YT tutorials to get started with YK, that'd be a better option than requiring someone to one on one with you for something basic like that
ok ill try to search, but i havent found good videos for now
it will give you a baseline of understanding so you can get the basics down and ask better questions in here
they are out there, just make sure to look for more recent videos since code and best practices change
any discord.py beginners tutorial will do though, sending a message is very simple
i am also struggling to download discord.py
don't base knowledge on YT vids for this kinds of libraries
the guides are too specific and only explain what they need, also some implementation is rather bad
yeah, that is true, and they are generally poorly explained but if he doesn't know how to send a message I'm assuming a basic tutorial will give him more than he currently has in his bot, and will help with installing python and discord.py 😛
i dont have anything in my bot lol
I like example bots and quickstarters in the docs more, but yeah, you do you
so i wanna make my bot send message when the sender is not in database, i try use if isinstance(error, TypeError) but not work, any idea how?
you just use a select statement query, if the fetchone() returns None, he's not in the db...
haha I know 🙂
Yeah, as Sniper said, there are any number of ways to find the basics you're after
reading documentation is the best option but is also the most difficult since as a total newbie it might be overwhelming, documentation can be intimidating and difficult to follow
Beyond that, tutorials either video or text are a good option, the important part is to play around with what they suggest and try to research how to improve it, eventually you will want to get your feet wet on the documentation but as I am assuming you are totally new to Python in general it is best to start small. Discord is a cool project but it's going to be messy if you don't know basic Python first, so that might be something to learn first to save yourself a good deal of frustration, walk before you run and all that 😛
yeet TypeError lesgoo
i am actually not totally new in python
stop typing italic lol
but i only did competitive python and i wanted to do something differnet with python
well, grasping what OOP is and having knowledge of async programming (asyncio as well) will get you through the docs in no-time
I assumed you were totally new since you didn't know how to install the dpy package :p
i actually dont know hwo to install it
yeet
Can someone help me with adding emoji on my bot? (I wanted to figure out adding an emoji before I actually started work on a command)
My code:-
@bot.command()
async def timer(ctx):
print("sending emoji")
emoji = bot.get_emoji(925736476904407071)
#timer = "<a:aclock:925736476904407071:>"
if emoji is None:
await ctx.send("Didn't get the emoji.")
else:
await ctx.send(emoji)
print("sent emojis")
My Output:-
the docs are your friend
lmao
The emoji is animated and the bot is in the same server as it.
your emoji is a custom animated one?
Ye
Typehint the args to int
I don't even see your code but I am assuming you didn't convert the 10s to integers and tried adding them so you ended up concatenating strings instead of addition
import discord
from discord import client
from discord.ext import commands
bot = commands.Bot(command_prefix='>')
@bot.event
async def on_ready():
print("Encendido !")
#comandos
@bot.command(name="sumar")
async def sum(ctx,n1,n2):
await ctx.send(n1 + n2)
there is
confirmed
you forgot to convert to an int
oh ok, i gonna to try it
sum(ctx, n1 : int , n2: int)
^^
@potent spear
all messages that come from discord are strings by default
that is important to know and account for
How did you get the emoji Id?
copy id?
I just right clicked and selected copy id
how do i upgrade my discord.py?
ye
why don't you just ctx.send(timer)? what does that give you?
gonna = going to
gonna to = going to to
upgrade
That's the message id bro , use \:emoji: and copy the id from there
his english is superior, let him be

I copied that mate
I didn't right click at the message.
The emoji?
Yessir, the emoji.
I never saw an option to copy the emoji Id
It shows for me.
it doesnt
It does.
tips: if u use custom emoji just use <:emoji_name:emoji_id>
to get emoji id, right click at the emoji's image, inspecc, and copy numbers from link
Send ss?
that's the message id as I said earlier
This one is for Message id
is it fine if my discord.py is an older version
u can get emoji id with put a backslash infront of it
Noo that's the message id 🤦
well yes, you have to get the actual response out of it Mini
It is mate
Send me the link of the emoji
The other one is the emoji id
I was just making my example for once you had the response :p
^^ that's how you get emoji id
wait, not auto converted? wow
woah animated
924936806644989972 this is the id
put backslash n it shows that
I speak spanish jejeje, i learning english
@small igloo
k
Hey thanks
same with nicks
( it still pings them lmao)
the heck what how
and how u can get my id?
@small igloo
The int is the id
get the json attribute from your resp I'd assume
.
@slate swan yes n post it
It is the same one I got by just right clicking and selecting "Copy ID"
If ever you encounter an error like that, you're dealing with data you need to manipulate, so you received a response but it isn't in the form you want it so you have to manipulate it further to get the output you are looking for
No, you got 925736476904407071
u can check roles id too if roles mentionalable etc
.
Am not dumb.
it's the message id you got by copy id
O-o
And the emoji I'd is the one you got using \:emoji:
why can't u just send <:aclock:925736476904407071|||||>
Tried but doesn't work.
if he changes the name of the emoji , it won't work
BRUH WHERE "<>" and ID
cause u can have same names on multi emojis
No worries
👍
^
do u run windows 98 too?
?
idk how to make it updated
throu pip
i alr got the json
wdym
python.exe -m pip install --upgrade pip' command?
yeah
paste your code if you wouldn't mind Mini
both for making the request and processing itr
everything involving AIOhttp
ok
@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.user)
async def rhymeapi(ctx, word):
ctx: commands.Context
word: str = "rhyme"
async with aiohttp.ClientSession() as session:
url = await session.get(f"https://api.datamuse.com/words?rel_rhy={word}")
urlJSON = await url.json()
rdn = random.choice(url).get("word")
await ctx.reply(f"Word: {word}\nRhyming Word: {rdn}")
Install from https://python.org
@ebon island
one thing I see is that you're still trying to do choice from the url not the urlJSON
i already have python
fuck that makes sense
Ah do python -m pip install -U pip
I am running my bot in replit and it shows this error while installing the package. How to fix this?
Someone help ,me
seems working @shadow wraith
same for me
Awesome 🙂
thx for helping
No problem! Happy to help ❤️
:]
help me pls
.
?
dont use replit then
File not found error
oh
lol
it's an ssl error
wait are you stealing my rhyme command
:|
Getting
[SSL: CERTIFICATE_VERIFY_FAILED]on Python 3 on OS X?
Navigate to yourApplications/Python 3.X/folder and double click theInstall Certificates.commandto fix this.
Happy coding!
as someone who uses mac, i can confirm the only two ssl errors i got were network issue and certificate verify failed
no I tested it using my bot lmao
that's the only way to make sure everything works with your logic and API call
can i use idle for the discord bot?
bruh this is so hard
Why would you want to use IDLE for your bot?
well idk what else to use
can someone tell me how to make and use dropdowns and example or tutorial pls? thnks
use dnd it looks the best also sry for ping
dnd?
the thing is how to add space here?
@client.command(aliases=['b'])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,*,reason= "No reason provided"):
await member.send(f'You are banned from {ctx.guild.name}, because: {reason}')
await ctx.send(member.name + "has been banned from the server")
await member.ban(reason=reason)
@slate swan
i’m really, really sorry to tell you this
but i have a json file in my dir with 1800 colors - its the Lancebot resources one….
i have the discordheximals.py file in the github because apparently i can't import discordheximals x]
!pypi discordheximals
returns hexcode by name for discord.py and its forks
You could add it to the start of that has been banned ... string yk
ok
Same happened with me, it just doesnt work properly
Imagine using f strings
How do I send a msg when a user boosts a server
why tho lol
figure it out, if u have an error tell us, we're not here to give u codes
Well, f strings are the recommended way to concatenate strings
!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.
You'll often concatenate strings in dpy, so.
ik i am doing cuz the server i am testing is not the server i will be using it
how to use activity assets in discord.py
hmm, your wish
!d discord.User.activity
No documentation found for the requested symbol.
ye cuz many ppl recomend me it
But i find it hard xd
name = "Ashley"
age = 210391
print(f"{name} is {age} years old")
coughs
Mhm
Ashley is 210391 years old
yes
tell me when you find the docs
activity name works,no idea how to make assets work
Wdym by activity assets
!d discord.Member.activity for some reason discord.User payload doesn't have the activity key
property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.
Note
Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.
Note
A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activities "discord.Member.activities").
for discord.ui.button, how to know what the user has chosen? and then reply
!d discord.MessageInteraction.author
No documentation found for the requested symbol.
interaction.author?
Yea
how to use this?
It is the same as context.author
It returns the user/member who clicked on the button
!d disnake.MessageInteraction.author
The user or member that sent the interaction.
Phew, there
!d discord.ui.Button.label
property label: Optional[str]```
The label of the button, if available.
(;
Nope, unfortunately not yet
haven't received a response in Async just yet
working on other things in the meantime 🙂
Ah cool (and that's sad)
Haha no worries, I've got plenty to still be working on
Ah cool
and the error only occurs after many hours running
Oh, hmm
do you know offhand what the command is to check whether a user has permissions for a given action within a method? Not as a decorator, I remember it was a method on the ctx
Can u run pip install -U discord.py once?
ok so i understand now thanks
A further question:
if a user clicks on a button, how to tell the label of the button that they clicked on is there a special element for that thanks
!d discord.Member.has_permissions
Okay I forgot
I don't get what is the purpose of user_command in disnake
thanks Hunter 🙂
hey guys, will I get banned if I ask about a specific discord fork problem in here..?
no idts
Those are the commands u get after right clicking a member
Nope
if a user clicks on a button, how to tell the label of the button that they clicked on is there a special element for that thanks
okay cool B)
!d discord.on_interaction
discord.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to slash command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.
New in version 2.0.
So it adds the commands to the context menu right?
Yes.
Ok thx got it
ll have a look thx
👍
so, Im using nextcord, and I skimmed the docs and it looks like pretty much everything is the same, and it loads all my cogs, but then it has an error on running talking about future.result..? heres my full error
File "main.py", line 39, in <module>
bot.run('token', bot=True, reconnect=True)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 666, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/client.py", line 645, in runner
await self.start(*args, **kwargs)
TypeError: start() got an unexpected keyword argument 'bot'```
how to make a command like this in py?
The run function has no bot kwarg
remove bot=True
!d discord.ext.commands.Bot.wait_for @blazing lynx
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**...
lool thank you!
!d discord.Client.run
run(*args, **kwargs)```
A blocking call that abstracts away the event loop initialisation from you.
If you want more control over the event loop then this function should not be used. Use [`start()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.start "discord.Client.start") coroutine or [`connect()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.connect "discord.Client.connect") + [`login()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.login "discord.Client.login").
Roughly Equivalent to...
thanks!
may you provide a simple example of wait_for message?
Thought so
There is one there in the docs (;
Well I am on mobile and it's hard to talk in Python on mobile, so, uhhh
@maiden fable im sorry i still dont get it after all your help :(
im making a rock papaer scissors game and i need the content the user has clicked on idk what the on_interaction means and how to do this please can u explain in more detail im soory
is ctx.author sufficient to be passed into the permissions_for() method? I am assuming no as it is the string representation but perhaps that is a dunder str or repr, or if not, how can I get the Member object from a ctx?
Ah, what u need is a View class
yes i have one
ctx.author is a member object
Dude @unkempt canyon
this
awesome 🙂
thatss all i have
Okay, so name your functions differently
oh yea
how about a command like this? where you just say the name of the role and if it can be assigned to me it will.
ctx.author will return a member object if the message is sent in a guild
it just seems easyier
done
async def addrole(ctx, role: discord.Role):
await ctx.author.add_roles(role)
how can you make multiple categories in help cmd without cogs
then what do i do do i store a variable after each of the callbacks?
but i will have to mention a role wont i?
ill try that ig
What would the proper usage be assuming the following:
user = ctx.author
if user...: #some permission check
do_something()
I saw there is permissions_for() permissions_in and has_permissions() which is the proper choice in such a circumstance?
and what is passed
ctx.channel.permissions_for()
assuming in that context user is passed as args, but where does it get the permission it is checking for in that case?
Well depending if the user can use the full command. If a normal user may not use certain args you would need to use permissions inside the command.
#bot-commands Type !user for example there you can display your own information. But you are not allowed to tag a user. Only staff is.
how to use height and width command in Embed.set_image
seems like the following is working as I had desired:
if ctx.author.guild_permissions.kick_members:
is that a normal thing?
There is not kwarg for that
why not use the declerations?
!d discord.Embed.image use this.
property image: _EmbedMediaProxy```
Returns an `EmbedProxy` denoting the image contents.
Possible attributes you can access are...
@command.has_permissions()
can i patch that?
how to make a eval command ?
!source e
Run Python code and get the results.
The most simple way is just use builitin eval(), but its functionality highly limited in terms of async
its just an unban command it doesnt work
Any help?
Btw I am new to python
Will also output to console.
Depends
If you eval single line of code it will just return a result
Why not just try to unban him and if you get an error just deal with that.
@slate swan user.discriminator is int I am pretty sure and you are comparing it to str you got from splitting
How to change it to make each person has his individual balance, because when I do !balance I get how much I have and then my friend tries and he gets the same thing, btw I'm new to the discord library I just started today
Also I've never seen such way of comparing values not sure about it
!global and use a database.
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
Stop watching these unheavenly YouTube guides. Just use a type hint. e.g.
@bot.command()
async def unban(ctx, user: discord.User):
await guild.unban(user)
Unrelated to what you asked but for the footer, use a timestamp
!e ("str1", 2) == ("str1", 2)
@vale wing :warning: Your eval job has completed with return code 0.
[No output]
The timestamp will automatically change
He has unban command but ok
I fixed it but ok
member: discord.User uhm
It won't be able to convert to User if that user doesn't have mutual guilds with bot I think
It will.
What's the pycharm shortcut to comment out lines?
ctrl + /
Ctrl + /
Thank you 🙂
Unless the converter doesn’t fetch, it should work with any user
Alr lemme check that
Pretty sure the converter does fetch.
if match is not None:
user_id = int(match.group(1))
result = ctx.bot.get_user(user_id) or _utils_get(ctx.message.mentions, id=user_id)
if result is None:
try:
result = await ctx.bot.fetch_user(user_id)
except discord.HTTPException:
raise UserNotFound(argument) from None
return
I am just interested myself is it possible to fetch a user who is not in mutual guilds because I had an issue with that in past
It will work with the id but not the name. Hopefully the people using the bot are literate enough to copy an id
The lookup strategy is as follows (in order):
1. Lookup by ID.
2. Lookup by mention.
3. Lookup by name#discrim
4. Lookup by name
And in our case he tries to get a user with name+discrim
So your example with hint wouldn't work for his case
It works globally with the id, locally with the name or id
Yes
Everything works so much easier if everyone would just use either mention or id lol
Sure but does he really need that?
Maybe
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
@commands.command(aliases=['p'], brief='$play [url/words]')
async def play(self, ctx, *, video: str):
channel = ctx.author.voice.channel
voice = get(self.bot.voice_clients, guild=ctx.guild)
song = Music.search(ctx.author.mention, video)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
if not voice.is_playing():
self.song_queue[ctx.guild] = [song]
self.message[ctx.guild] = await ctx.send(embed=song['embed'])
await ctx.message.delete()
voice.play(FFmpegPCMAudio(song['source'], **Music.FFMPEG_OPTIONS), after=lambda e: self.play_next(ctx))
voice.is_playing()
else:
self.song_queue[ctx.guild].append(song)
await self.edit_message(ctx)
does anyone know?
Do you have ffmpeg downloaded?
what os
i used pip3 install ffmpeg
Operating system like windows or Linux?
If you’re using a Debian based distro you can run this command
$ sudo apt install ffmpeg
How do I make an asynchronous block still only run synchronously locally?
Like, still hand the interpreter off to any other functions but for that execution of the function do one thing completely then the next thing etc at specific points?
i ran that in vsc
and what did it say when you ran it?
nvm it wasnt the same thing
i ran "sudo pip3 install ffmpeg" and it installed ffmpeg
i ran that command you told me to now do i restart vsc?
also @pulsar shell how do i put vsc as my status
We won't help with music bots here.
Can you give more context? Everything in Python happens in the order that it is written but it relinquishes control after a yield or await
tysm for helping!
We don’t help with anything that “breaks laws” or “breaches terms of service” this code isn’t doing any of those
Thus music bots.
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
You know what it is fact you just help him just seem to me like you don't really care.
Where do you see anything ytdl-related in this code? This guy could just be playing royalty free music directly from his machine

Yeah that's why he can input URL's
Magic, you are aware just don't do it.
how to put vsc as my rich presence?
Try running ffmpeg -version in your terminal
it worked thanks
Ah ok
what's wrong here? I typing number, but nothing happens, and even there any errors
i didnt know it was still breaking tos even if it was a private bot for only 1 server
@pulsar shell?
I'm pretty sure you install it through the marketplace
Message.content will always be str not a int
oh, ok, what i should do if i want to accept only numbers from user?
How do I make a discord bot that after running !badass command, it sends a gif and a text?
use Context.send() ?
pass the gif link as a string
how do I set it up?
or pass a string containing a normal text
URL or file
how to accept only integer messages from user ?
typehints
Try and convert it to an int if it gives an error tell the user to input ints or use slash cmd to force ints.
or define a condition for it
Can I use mee6 for it?
check how i tried to do
elaborate?
I mean like int()
I want after typing !badass a bot to send a gif and/or some text
I'm a little confused about why I'm not getting the prints as I expect them, trying to troubleshoot an issue where the script stops on the pass_the_mic method:
async def take_turn(self, server):
for num in range(server.word_count):
await self.make_message(server, num)
else:
print('sleepy time')
await self.pass_the_mic(server)
print('sleepy time 2')
server.task = asyncio.create_task(self.take_turn(server))
async def pass_the_mic(self, server):
channel_to_be_sent = server.approved_channel
pass_time = server.pass_time/2
message_to_be_sent = f':checkered_flag: **Get ready to pass the mic! ({server.word_count}:{server.turn_time})**'
await self.message_sender(channel_to_be_sent, message_to_be_sent)
await asyncio.sleep(pass_time)
message_to_be_sent = f':microphone2: **Pass the Mic!**'
await self.message_sender(channel_to_be_sent, message_to_be_sent)
await asyncio.sleep(pass_time)
print('yeah')
prints yeah, doesn't print either sleepy time despite the fact that they are surrounding the call for pass the mic
that’s very simple. just use a command decorator and use Context.send() to send whatever you’d like
perhaps you should read the docs before trying to make commands
????????
is there a way for me not to program the bot?
do you want it to program itself ?
Are you sure pass the mic is even being called? That else statement after the for loop seems out of place
yeah it is
it runs normally
and it hits the "yeah" as mentioned
the else after the for loop means it executes only once the for loop has been completed fully
ik basic python but how would i check if all the letters or content in the msg content is capital or not
hey i would like to know how to get the bot's Servercount onto a status?
why does this not work?
wait can't just i use msg.content.upper()
use the length of guild.members
Is it possible that it’s being called by another function and not the one that you mentioned? Also if your’re using create_task recursively I’d recommend just using a while loop
but I am confused why above it goes into the pass the mic call but not either print sleepy time call when they go directly before and after it
is that your bot's dashboard or a different bot dashboard
so py len(str(bot.guilds))?
while is blocking if I'm not mistaken?
@patent lark
mee6
!e ```py
def upper_string(text: str) -> bool:
return all([c.isupper() for c in [word for word in text.split()]])
print(upper_string("TEST"))
print(upper_string("TeST"))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | False
If you await something it will be fine
no cant i just do
this will return how many guilds the bot is in
never do that , just len(bot.guilds)
!e
deez = "lol"
print(deez.upper())
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
LOL
this would work too?
whats wrong with str?
Think isupper() also passes whole sentences.
oh yeah and how do you measure how much letters there are in a message
len func
you want to convert all the bot guilds to a string as your status ? that’s very off
fuck your right
!e py list_x = ['1' , '2'] # there are only 2 elements print(len(list_x)) print(len(str(list_x)))
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | print(len(str(list_x))
003 | ^
004 | SyntaxError: '(' was never closed
so why does this not work? its custom commands in mee6
it will convert ur bots guilds objects into a string, you dont want that
!e
test = "amogus lol"
print(test.isupper())
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
False
Depends on how you use it.
Also counts spaces though.
@shadow wraith #bot-commands
does that check if every letter is capital?
also if you feel like that could become an issue you can add await asyncio.sleep(0) somewhere in your while loop (preferably towards the end)
????
um the list gets converted to a list itself
Why does this not work? Please someone help me its a mee6 custom commands
this is not the mee6 support server
!e ```py
def upper_string(text: str) -> (bool, int):
return (text.isupper(), len(text.strip()))
b, c = upper_string("TEST")
print(b)
print(c)
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | 4
^^^^^
It will force the coroutine to yield.
Figured out the issue, in my haste I somehow duplicated the take_turn method, now it should be working
this looking good in a on_message event?
if bool(message.content.isupper()) is True and len(message.content) > 9:
await message.delete()
await message.reply("Fix your caps lock key damn")
you’re right.
false
ik this isnt python related but please tell me whats wrong @patent lark
is that kali linux?
debian
UI is way to fancy for kali lol
which distro
i’ve used linux few times. not enough knowledge to give help.
wym by distro
what linux distribution are you using?
ik its debian based , but which one...
Well you are making a music bot anyways so stop asking for help here 
I've already made you aware of the fact you are breaking ToS.
a .deb file?
bro im asking about your operating system
ok , just show me a ss of your ui
what if the music was coming from their machine locally? or their own music?
$play [url/words]
forget i said anything.
maybe he has a large database of songs
Yeah don't think so.

wtf is your problem
People breaking ToS.
he just follows tos
im asking for help on downloading discord
chill
not related to your current problem tho
nothing about a bot just discord
well this is for discord bots. if your issue doesn’t relate, please ask somewhere else
the 🌟 App 🌟
Then this isn't the correct channel
ok, one question: do you have youtube_dl imported in your file
wrong reply oop
i deleted the commands cause people is just being butthurt about it
wait im not meant to say that oop
Seems like you got a broken install, since your on debian based try sudo apt-get -f install For further questions refer to #unix
im sure noone would be able to help you if wont know what os you are using
yea and what andy said
Don't use debian myself so /shrug
follow ToS doesn’t = “butthurt”.
I usually do pacman -Syu if pacman dies
based
i was following tos. i wasnt using youtube, spotify, soundcloud or anything i was using mp3
they didnt say anything about mp3 in the tos did they?
Do you own the music?
Mp3 but you're asking for a url?
Like did you buy a license for the music
Because otherwise, even if it's from an mp3 it would break ToS
Yes, he’s playing royalty free music from an mp3 and you can’t prove otherwise
Just because we can't prove it doesn't make it appropriate.
And him saying he is using mp3's is just a lie since what local file uses URL's?
If it was an mp3 why would the description say to provide a url
Anyways i don't really want to discuss it further i just asked you 2 to follow the rules of this server. I don't get why you guys are fuzzing about it so much.
Also he has no safe guards in place stopping people from accessing files they're not supposed to
It’s totally possible that he has a lookup system based on urls. We’re literally helping him download ffmpeg and you’re trying to say he’s breaking tos out of pure speculation
so I want to import a list from another python file which is not in the same folder,can I import it?
it’s clear that they are disobeying ToS, may this discussing be dropped and brought back to topic?
in a discord bot or?
yes
More of a question for #python-discussion
Does need an __init__ in the folder.
Python general do be bit crowded rn tbh.
it's related to my bot so I just asked it here
will try
Well it’s in your bot but your question doesn’t relate to discord bots
If I had an error that is in my discord bot but doesn’t relate to discord bots then I’ll ask in #python-discussion
for import i recommend a #❓|how-to-get-help since it's not the easiest for a starter.
if a bot runs out of computer resource (ram, cpu, etc..) will it get killed immediately or wait for resources (so like go not responding)?
See of it like a game, will the game crash?
Okay well it won't crash.
ok thank you
To some extent though, RAM can only be compressed by that much.
??
based
If the game cannot allocate anymore memory how is it even gonna run
You mean extent?
🤔
Yeah lol
Does the Python interpreter compress the ram?
System does it automatically, but in trade your CPU will need to work harder.
ohhh ok
I found a way to exploit my mobile data
Would be pretty annoying if your pc RAM hits 100% it will just insta crash.
My mobile data ran out a week ago, but I found a way to connect to data without having any data
Let's not talk about exploiting here 👀
I connected to my WiFi and did not leave my phone, until it disconnected my WiFi. However, with no mobile data my phone shouldn’t load anything, but it functioned perfectly and loaded everything as normal
I don’t know why it does that
Until the bill comes because you used overbudget lol
Maybe I guess
hahahahahah
But it shouldn’t take away money
Because all of it is gone
But I still managed to use it somehow
Idk how 
guys what does this line do
if not not not not not "hello world" != (guild = discord.utils.get(bot.guilds,name=__str__(str(discord.utils.get(bot.guilds, id=getattr(discord.utils.get(bot.guilds, name=discord.utils.get(bot.guilds, id=getattr(guild,"id")).name), "name").id).name))).channels):
Fcks your brain
^^
!ot-names
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
Like the language
Yeah but seriously what's the point here
it's technically related to discord.py
async def open_account(user, ctx):
users = await get_bank_data()
user = ctx.author
if str(ctx.author.id) in users:
return False
with open("bank.json","r") as f:
users = json.load(f)
if str(ctx.author.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
ExtensionFailed: Extension 'cogs.cookies' raised an error: NameError: name 'ctx' is not defined
You forgot to add self in arguments, if it is a class
oh yeah thanks
Bro
You’re copying swas.py innit
async def open_account(self, ctx, user):
```?
Without knowing what it does
💀
i know what it does im just making it into a cog
Cool
if you know it did you do that?
Of course I did, I understood everything he said
Json
@tough lance
Yes I suppose
It’s mainly Json
still says ExtensionFailed: Extension 'cogs.cookies' raised an error: NameError: name 'ctx' is not defined
Hi I'm trying to let my bot respond to another bot (Avrae) but can't figure it out, since I'm fairly new to Python. Anyone got any tips?
rolled_20 = 'Natty 20!'
@client.event
async def on_message(message):
if message.author == client.user:
return
if 'Total: 20' in message.content:
await message.channel.send(rolled_20)
hi
i want to do such that by just typing 4+5 the bot gives answer
but idk how to do that
my current code=
`@Bot.command()
async def add(ctx, numb1:int, numb2:int):
await ctx.reply(numb1+numb2)
@Bot.command()
async def multiply(ctx, numb1:int, numb2:int):
await ctx.reply(numb1*numb2)
@Bot.command()
async def divide(ctx, numb1:int, numb2:int):
await ctx.reply(numb1/numb2)`
ctx before user and type hint it to commands.Context
command are only invoked by a prefix - you want to use on_message
do u know frisky bot?
i want to do like that 😂
!pypi simpleeval || you can also use this to solve messages. you can do ```py
import simpleeval
@Bot.listen("on_messaga")
async def solve_equation(message: discord.Message):
try:
x = simple_eval(msg.content)
except:
x = False
if x:
await ctx.send(x)```
god i love mobile coding
how do you get if a message is sent in a channel and the information of it because rn im trying to make it so it adds ⬆️ and ⬇️ to each message in the channel
why does the formatting fail
Need help with discord bot
what do you need help with
File "C:\Users\vgrav\OneDrive\Skrivebord\New folder (6)\config.py",
line 81, in on_message
if len(code) < 16:
TypeError: object of type 're.Match' has no len()
show the command which has that
iscord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: argument of type 'int' is not iterable
show code (not the variable, the actual code in ur file)
you can't iterate through an int
while 1:
try:
@bot.event
async def on_message(ctx):
webhook_url = hookurl
global ready
if not ready:
print(Fore.LIGHTCYAN_EX + 'word ' + str(
len(bot.guilds)) + ' Servers 🔫\n' + Fore.RESET)
print(Fore.LIGHTBLUE_EX + time.strftime("%H:%M:%S ", time.localtime()) + Fore.RESET, end='')
print("[+] Bot is ready")
ready = True
if codeRegex.search(ctx.content):
print(Fore.LIGHTBLUE_EX + time.strftime("%H:%M:%S ", time.localtime()) + Fore.RESET, end='')
code = codeRegex.search(ctx.content).group(int)
start_time = time.time()
if len(code) < 16:
then how
💀 bro only tuples, dicts and lists can be iterated through
that's what i assume, but with libraries you can probably go further
wait what
i have no knowledge with regex therefore i am unable to help :[
okay
not at all go for it
since i no have github account and i forgor my password to my github acc just add an alias for the Color class to Colour
Does anyone know how to make a simple ticket bot?
some people have the skill to do it, we just can't immediately provide code
For the reactions when using ext-menus, how do I make it so whenever a user reacts to one, it removes their reaction instantly? I’ve tried clear_reactions_after but that removes the users reaction when they press on another reaction which I don’t want. Full file: https://mystb.in/LaunchHappenedHungarian.python
ill do it
thanks! :]
i didn't pip3 install it since it didn't work, i just have the 2.9k lines of code as a local file in my bot's dir
disnake clearly has buttons
weird, it wasn't there the last time i searched
!d disnake.ui.button
disnake.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`disnake.ui.View`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.View "disnake.ui.View"), the [`disnake.ui.Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") being pressed and the [`disnake.MessageInteraction`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction "disnake.MessageInteraction") you receive.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
cool

thanks
your very welcome
hey why doesn't my formatting work
show
:[
@bot.command()
@commands.guild_only()
@commands.cooldown(1, 5, BucketType.default)
@commands.check(isdev)
async def pypi(ctx, project):
embed = disnake.Embed(
title=f"({project})[https://pypi.org/project/{project}]",
description="",
color=disnakeheximals.Color.banana_yellow(),
)
await ctx.reply(embed=embed)
code
isn't it the other way around
tried swapping the brackets and parentheses but it still failed
but also with that you can just do url = can't you
:[ so does the pypi command here use an author as a looking-like "title"
embed = disnake.Embed(
title = "bleh",
url = "https://google.com/"
)
can't you do this tho-
does that work, have you tried it?
i think in the past that worked
!d disnake.Embed
class disnake.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.Empty "disnake.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.
ig so
but no it wont work
hes trying a hyper link lmfao
ik
ima try it
no its my module
bro i did import discordheximals as disnakeheximals x]
!pypi discordheximals
returns hexcode by name for discord.py and its forks
i kept what you told me to import discordheximals as something
hm...
i see
creative of you
that's for lazy coders smh
whatever you like tbh
okimii
no
where’s my pull hm?
i barely wokeup
what tz are you
ill do a pr later smh
can't wait for modals: https://devsnek.notion.site/devsnek/Modal-aka-Form-Interactions-e839b3dd8c214eb08f950764a8328e36
ill maybe do a pr about idk more commands or sm
i still have to push my other package to pypi
the heximal package for the basic hexcode without 0x prefix
its supposed to be a bare url
@slate swan thanks for the pr
i have to learn how to make better displays in git
i have to make a description for pypi with a markdown file but pycharm doesnt support it si thats theirs no description so i might have to download vsc to do it
How do I update pycord (fork of dpy) to 2.0 in replit? I asked the comm, but they didn’t help much
async def on_message(message):
botnummer = 1
if message.channel == "923698425126592592":
if message.content == botnummer:
if message.author == bot.user:
return
else:
nummer = botnummer + 1
print(nummer)
await message.add_reacion("✅")
botnummer = botnummer + 1
else:
await message.channel.send(f"Verkeerd nummer door {message.author.mention}, jullie hebben het gehaald tot {botnummer}. En we zijn nu weer bij 1.")
botnummer = 1
else:
return````
I am in the specific channel, and I dont get any prints. But neither get an reaction added, but I am trying the 1 of the designated botnummer
Maybe because botnummer is an integer, but message.content returns a string
Try replacing botnummer with str(botnummer) in line 5...
Hello
Hello
@bot.event
async def on_message(message):
botnummer = 1
if message.channel == "923698425126592592":
if message == str(botnummer):
if message.author == bot.user:
return
else:
nummer = botnummer + 1
print(nummer)
await message.add_reacion("✅")
botnummer = botnummer + 1
else:
await message.channel.send(f"Verkeerd nummer door {message.author.mention}, jullie hebben het gehaald tot {botnummer}. En we zijn nu weer bij 1.")
botnummer = 1
else:
return```
Still no output
ello mate
Oh wait... I didn't notice it the first time. In the same line, you have to compare message.content not just message
i had message.content also didnt fix it
message.content and str(botnummer) at the same time?