#discord-bots
1 messages ยท Page 1020 of 1
no
how can typehinting break inheritance at any codepoint~
its for typehinting stuff so i.e if you want an argument to get satisfied by a function it would be typehinted with Callable
Typehinting decorators are a pain
wait do i not know what type hinting is
isnt it just
sure
def foo(bar: str):
pass
why not use ParamSpec and Callabale and Awaitable or Coroutine?
You're proving my point
Can you type for me?
i am lol
ok
@commands.command()
async def ping(self, ctx):
embed = discord.Embed(title="Ping")
embed.add_field(name="`Pinging...`")
embed.add_field(name=f"**Latency is** ``{round(self.bot.latency * 1000)}``**ms**")
msg = await ctx.send(embed=embed)
bro is it not documented or do i have the wrong path?
?
@slate swan I'm from mobile, btw you should correct the indentation
Hmm
are you using discord.py?
Yes
this should work, just correct the indentation
hm true, you can still just stringyfy the return type instead of returning self type
ah, got it
its still the same
This could be easily fixed with a TypeVar though
Self is still the preferred way though
why are you storing ctx.send in a variable?
maybe he wants the message object idk
what
to access the message object later im guessing
like
@bot.command()
async def test(ctx):
msg = await ctx.channel.send("Ok")
await asyncio.sleep(1)
await msg.delete()
the 2 spaces in the function signature
paste your code here
Ok
@commands.command()
async def ping(self, ctx):
embed = discord.Embed(title="Ping")
embed.add_field(name="`Pinging...`")
embed.add_field(name=f"**Latency is** ``{round(self.bot.latency * 1000)}``**ms**")
msg = await ctx.send(embed=embed)
@commands.command()
async def ping(self, ctx):
embed = discord.Embed(title="Ping")
embed.add_field(name="`Pinging...`")
embed.add_field(name=f"**Latency is** ``{round(self.bot.latency * 1000)}``**ms**")
msg = await ctx.send(embed=embed)
how are you using classes but not indenting right ๐
@regal pulsar
theres an invalid character in the line
so its not an underscore or a letter or number etc
You know you don't need to mark every picture you send as spoiler, right?

Copy pasting made you paste an invalid character
?
So how to fix this?
zero-width unicode escape character?
has happened to me before
yeah
Rewrite yourself with valid characters
๐งข
?
Nothing
ok
i require assistance
We require code/errors
ok so
ive made my bot
import os
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix= "?")
@bot.command()
async def hello(ctx):
await ctx.send("Hello!")
token = os.environ['TOKEN']
bot.run(token)
tjhis is the code quite simple
And your command doesn't work with no errors, right?
Right
the thing is how do i make a new command such as ?joke
use api's
Just like you made one for ?hello
Copy the command you've made in the middle and rename the fuction
async def joke(ctx):
but then i get this
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "joke" is not found
am i supposed to like
write it on the same file or make a seperate on
cause thats what im doing rn is making a separate and copy pasting the code and only changing the command
you need get channels at on_ready
is someone gonna help me or should i go look on youtube
@red kernel wwit
it takes upto 2 hours for those to show up
where should i put that
seems like it
in a new file or the same lines of code
None
Below your other command
@bot.command()
async def hello(ctx):
...
@bot.command()
async def joke(ctx):
...
now i get File "main.py", line 12
async def joke(ctx):
^
IndentationError: unexpected unindent
๎บง
what the- why do you have a discord.Client subclass inside of a Cog class?!
!indents
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
dont use unicodes
wdym
here its shoes you used a japanese char
Have you actually learned Python before doing a bot? Just as a side question
yes some of the basics
!eval
def ๆ(x):
print(x)
ๆ("a")
@river pivot :white_check_mark: Your eval job has completed with return code 0.
a
hmmm
See this and compare with your code
Then you've got to learn at least more, the library is not meant for beginners as said in the documentation.
!eval
print(999-้ฟๅ)
@river pivot :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name '้ฟๅ' is not defined
hmmm
ok im sorry
no problem bro

But your solution is this, just compare with your code and you will see @red kernel
i just tryed
what did you even expect to happen
!eval
้ฟๅ = 13
print(999-้ฟๅ)```
@wicked quest :white_check_mark: Your eval job has completed with return code 0.
986
on def names or var nsmes unicode works
? i dont see a problem
File "main.py", line 13 @bot.command() ^ IndentationError: expected an indented block ๎บง
!indents
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
read this, do this
Can anyone help me with asyncpraw
!eval
print(20-๐๐)
@river pivot :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(20-๐๐)
003 | ^
004 | SyntaxError: invalid character '๐' (U+1D7D9)
Actually unintentionally created NSFW bot ๐ฅถ
hmmm
You can do your random tests in #bot-commands instead of flooding this channel ๐

โฌ๏ธ
where are you defining my_msg?
not to be cocky but it would help if we knew what is my_msg
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
add_reaction doesn't return anything
As you can see it doesn't return anything
So keep using msg instead of setting a new variable my_msg
yep
what's that kwarg to set it so that ppl who are mentioned in the message aren't actually mentioned
so for example if u mention @slate swan it won't actually mention them
!d discord.AllowedMentions
class discord.AllowedMentions(*, everyone=True, users=True, roles=True, replied_user=True)```
A class that represents what mentions are allowed in a message.
This class can be set during [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") initialisation to apply
to every message sent. It can also be applied on a per message basis
via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for more fine-grained control.
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=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...
"(" was not closed i mean i did... (and im using pycord with bridged commands so i can have application and prefix)
Probably missing a , after "Pick a category"

Again
Stop doing msg = await msg.add_reaction
Just do await msg.add_reaction...
You're always setting the variable before that to None
Correct
Of course
Sure
For the ending you can use the timestamp <t:timestamp:R>
Here would be an example
!e
import time
print(f"<t:{int(time.time())}:R>")
Sending this will give nice formatting, try it yourself
Just get the timestamp of a datetime object, which is probably what you have right now.
You're using twice the same option value
okay idek whats up with me anymore, istg i checked it five times howd i keep missing it ๐คฃ
!d discord.utils.format_dt
discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
in the app_commands.CommandTree.command() decorator, there's a guild kwarg where you can specify the guild ID
e.g @tree.command(guild=discord.Object(id=MY_GUILD_ID))
note that when syncing, you should also specify the guild ID the same way you'd do with the decorator c:
haven't gotten what to work?
guild_ids
welp
oh
so bot has a bot.wait_for thing, which is basically what you want
!d discord.ext.commands.Bot.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
there we go
You need to manually sync in discord.py
ye, if its puclic itd take your bot a few hours to sync, and make sure u invited the bot with application commands enabled. and add guild_ids to bypass waiting, but itd only work for the specific listed servers
@client.event
async def on_ready():
print("Loaded & Online!")
client.loop.create_task(status_task())
``` how change into idle?
nono, it's a global wait_for, you specify what type of action you want in the event arg
I believe there's an example in the doc
Yes
not really sure, haven't experimented enough with slash commands, there's a gist that covers the basics though if you'd like to check it out: https://gist.github.com/Rapptz/c4324f17a80c94776832430007ad40e6
@client.event
async def on_ready():
await bot.change_presence(status=discord.Status.idle)โ
print("Loaded & Online!")
client.loop.create_task(status_task())
Like this?
Make sure not to change presence on ready. Use the activity kwarg in the bot constructor
Ok
^ if you're using 2.0, you can alternatively use setup_hook for async stuff such as cog loading
And dnd?
wdym?
why don 't I click on the reaction if I didn 't click on the first one first ?? And why can they only work in turn ?
@slate swan
!d discord.Status.dnd
The member is โDo Not Disturbโ.
?
then you should probably remove the str(reaction.emoji) == ":one:" from your check, otherwise it'll only check for the 1๏ธโฃ reaction, instead of expecting any reaction as input
apart from that, you're already checking if the input reaction is already a 1๏ธโฃ, 2๏ธโฃ or 3๏ธโฃ
You shouldn't be changing presence on_ready
nope, don't delete your if statement, delete the part in your check function where you check for the emoji type
yep
If an Asyncio task has a done callback, and during the original task there is a VoiceClient.play() in that task, is the task considered done after the song is "played" or after it finishes and hits the after block?
async def cmnd(ctx):
select = Select(
placeholder="Pick a category",
options=[
discord.SelectOption(label="One"),
discord.SelectOption(label="Two"),
discord.SelectOption(label="Three"),
discord.SelectOption(label="Four"),
discord.SelectOption(label="Five"),
])
async def my_callback(interaction):
await interaction.response.send_message()
```how can i make the `await interaction.` to edit it? wadda i use for edits? 
Hey guys quick question:
Is it possible to make the value of an embed a hyperlink?
I know it can be done by for example:
embed.add_embed_field(name='Buyer', value='[go to google.com](https://www.google.com/)')
, wont work for me since my value and my link are variables tho.
Thank you in advance ๐
what do you mean they are variables?
embed.add_embed_field(name="Buyer", value="[str(wov_name)](str(wov_link))", inline=True)
then use f strings, format, concatenate, etc
thats how that would look in my case and this would for obv reasons not work
I'm really confused about why you've written it that way, is there a particular reason you're doing it like that?
I'd suggest an f string and referenced the variable that way
i did await interaction.message.edit but it gives an error altho it still works
Tbh because i dont know better. I am pretty new to all this
so your best friend is going to be an f string, a formatted string
denoted by f''
so for example f'What a nice day today, how are you doing, {name_of_friend}?'
!e ```py
my_var = "your best friends :D"
print(f"F strings are {my_var}")
@fading marlin :white_check_mark: Your eval job has completed with return code 0.
F strings are your best friends :D
๐
haha it not only could work, it will work ๐ F strings are awesome, most places you use strings an F string is the best and most pythonic way to do it
there's also string concatenation, % thingamajic, and str.format
but we don't talk about those...
yep, f string is basically an evolved version of those
anyone used dropdown menus? ๐
kinda, but only dpy's one, sorry :/
aah rip
but itd prolly b similar
do u know why it gives an error even after await interaction.message.edit works?
traceback?
It works, thank you very much guys! Today i learned about f" strings! Highly appreciated!
sure thing c:
No problem ๐ Best of luck on your journey in Python! Keep asking questions and keep exploring!
wdym? ๐
could you send the error that you're getting?
im not getting any terminal errors, it edits it fine, but i get this on discord itself (even tho it did work..)
async def cmnd(ctx):
select = Select(
placeholder="Pick a category",
options=[
discord.SelectOption(label="One"),
discord.SelectOption(label="Two"),
discord.SelectOption(label="Three"),
discord.SelectOption(label="Four"),
discord.SelectOption(label="Five"),
])
async def my_callback(interaction):
await interaction.message.edit(f"You chose: {select.values[0]}")
select.callback = my_callback
view = View()
view.add_item(select)
await ctx.respond("Here ye go!", view=view)
ooh aight
Are you using discord.py?
yeah cause this makes sense
pycord
self.get_kitties
hmm now i get this
it does make sense because its not a static method its just a method of the class which in its parameters has an argument named self which needs to be satisfied by an instance of the class
i havent had to work with functions in like a good 2 weeks so i completely forgot how they worked
(at least in dpy) edit_message only takes keyword argument, so you should do edit_message(content=...)
content=
aah it works now! but say i wanna add an embed, howd i do edit_message(content=embed=embed) ๐
hmm content="" embed=embed?
no just embed=embed
^
๐ป
:D
@slate swanby the way, I threw my code here and there was Russian and you didn't write something like the rule number
How would i get current channel ID in discord.py
dude, the option that you will now get an adequate assistant is very small. So be careful
Define "current channel"
Because bots can't be focused in one channel like you might on your regular client
the channel a user types the command on
so if i do
help
it will get the current channel of which the user typed the command of
Ah. You can use ctx.channel.id for that
Alright thanks.
Yup
@slate swan you're lucky you got an adequate assistant))
But remember there are people from the category of I'll throw off the link without knowing what)
What are you getting at?
there's no need. just warned the person
About what? It seems like you're upset about someone linking you to docs/a rule?
it's just that there is such a group of people who can't say anything themselves and only spreads links
That's because links often times explain things much better than we can
Especially when those links are official documentation
Written by a specialized team of people who know the library inside and out
about how it works and how it is described there, I will keep silent, otherwise they will give mute again
Wise, I understand you're frustrated that people throw links around but like I mentioned, those links are helpful and reading documentation is an essential skill
for the same specialized people. Not for novechkov
well, despite the way it is written, most likely those who understand it, they just don't need it
Yeah, from personal experience, I can tell you at one point you stop needing documentation because you've kind of memorized it at that point
And unfortunately the documentation does seem to cater to those people which is counterintuitive
Regardless, documentation is the best resources when you're trying to learn anything
well, only at this moment will you understand it. I just don't understand her at all. I remember learning how to make bots in js and there the documentation is more understandable for novechkov
I've heard it said that discord.js's documentation is better, yeah
@sick birch
well, you see. You yourself understand that a person like me will never understand how to do something about it, well, this is more complicated
I didn't even know js at all and without sitting on js servers, I was able to make a good bot that could go into the voice and say something
so I thought that well, if I could do it in a language that I don't know at all, maybe I could do 1000 times better in a language that I know and understand at least. But no, I think I was very wrong and it turns out 50/50
why does it print this like once every few hours, it doesn't bother me and doesn't mess with anything. I just want to know why
on_ready() can get triggered multiple times when your bot re-connects to the websocket
Which is why it's not suggested to do anything in there other than printing
jesus you type fast
For example, if you were creating new database tables in on_ready, you'd have like 20 different duplicate tables just because it connects to the websocket multiple times over the course of a a few hours
!d discord.on_ready if you look at the documentation it actually has a warning saying exactly that too
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful
and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up...
Is there a way to let a discord bot know when it has too many requests and then have it send a message letting the user know this?
Not sure if I'm explaining this well, but basically something similar to how if you spam commands in Bcoins bot, it tells you to wait like this:
make your own custom cache, use a global event and check if one command is running and etc
package
Actually, it is how I formatted it.
Postman works fine, can someone show me what I did wrong?
Um I understood none of that ๐
I really need sleep, sorry
I'm not exactly great at coding, I'm learning too.
I would advise if you're starting, to learn slash commands - They're being enforced by Discord here soon.
Some may disagree but I learned how to use custom prefixes !help -help ?help as an example and switching just confused me.
I can send you YouTube links of videos that teach you if you'd like, the ones I learned from.
do you mean something like a cooldown?
well yes, basically something like this:
!d discord.ext.commands.cooldown
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based
either on a per-guild, per-channel, per-user, per-role or global basis.
Denoted by the third argument of `type` which must be of enum
type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType")...
you can use it like this
@commands.command()
@commands.cooldown(1, 30, commands.BucketType.user) # so 1 use for every 30 seconds per user
async def command(ctx):
...
why?
because I just followed the first tutorial on youtube which uh doesn't use .ext
๐
or just check the ratelimit remaing hearder in all payloads?
ext has amazing features and hybrid commands also in master branch
or just check if the bucket for the endpoint is depleted
i hear hybrid commands have given many issues have you encountered any? i havent tried them nor am i interested in them maybe ill check src code later
Typical
Hey I didn't know at the time that ext existed
Well there were issues but most or all of them are fixed .
There are some workarounds though in same cases , so you might have to modify your command signature a little .
and commands.Greedy is not supported
mhm ic
@bot.slash_command(guild_ids=guild_ids)
async def log(interaction : Interaction, query : str = SlashOption(description="Enter the user's gamertag.")):
for id in server_ids:
url = f"https://api.nitrado.net/services/{id}/gameservers/games/players"
async with aiohttp.ClientSession() as session:
response = await (await session.get(url, headers=headers)).json()
print(response["data"]["players"])
if query in response["data"]["players"]:
print("True")
Can someone help me with this?
The code works until line #7 - When I try to query a name in the file, it doesn't seem to come back.
Even though it's listed in the JSON.
Did I format it wrong?
making a session for each id
and the final if statement is unnecessary
Yeah, I have 16 servers I have to search through or so.
you can jusr make one session?
How would I go about that?
I asked in here and someone said this was the proper way to do it
no you would just do a session outside of the loop
# this is bad
for i in range(5):
async with aiohttp.ClientSession() as session:
...
# this is good
async with aiohttp.ClientSession() as session:
for i in range(5):
...
Okay, will add onto that.
I'm kinda new, trying to find the best way lol
its fine you just need to be a little more careful
Got it, that would work with 16+ different ids ?
yeah just set your actual for loop inside of the context manager
Okay, let me try to fix it some.
Though, at the bottom -
if query in response["data"]["players"]:
print("True")
Did I format this wrong or is it bec of how I did the rest of the code?
you could just do
if response.get("data"):
...
well on this line
print(response["data"]["players"])
it will raise a KeyError if its not in it
so the if statement will always happen
yeah hence the reason you should use dict.get
or there will be a key error
!d dict.get
get(key[, default])```
Return the value for *key* if *key* is in the dictionary, else *default*. If *default* is not given, it defaults to `None`, so that this method never raises a [`KeyError`](https://docs.python.org/3/library/exceptions.html#KeyError "KeyError").
I guess I should explain what I'm doing more, I kinda didn't explain it well.
I'd be searching through 16 servers, getting their name and then matching it by fetching their id
End-Goal is for the user to type /ban gamertag then it'll ban them.
Though, you need their id to ban, wanting to make it more simple.
It's a bit of stretch, haven't done something like this before.
"name":"HOLY Zyrtec",
"id":"8561a51590f9d ....",
"id_type":"internal",
"online":false,
"actions":[
"delete"
I've yet to use dict.get let me check that out
did you try restarting your bot?
is it possible to check the type of device a user is on
I wish we could know if theyre on discord mobile or not
stop your bot, run it again
Not talking to you
!d discord.Member.is_on_mobile
is_on_mobile()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.10)"): A helper function that determines if a member is active on a mobile device.
ctrl + c in terminal
it have to check this all day long? it's almost an overload
did you sync them?
Are your commands global or local
!d discord.app_commands.CommandTree.sync
await sync(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Syncs the application commands to Discord.
This must be called for the application commands to show up.
Global commands take up to 1-hour to propagate but guild commands propagate instantly.
Client doesn't have cogs
You need to either make a custom cogs ext or just use Bot
You would also need to make your own tree.
its prefix is ! so it would be !help and do it in #bot-commands
Yo! I have a bot and a bot that I am working on from discord.ui import View, button works with one bot but doesnt work with the new one, it says there is no module named discord.ui
You need to have discord.py version 2.0.0 installed. You can find instructions on how to do so in README.md in discord.py's github page
pip install -U git+https://github.com/Rapptz/discord.py
Now it is saying main.py:15: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited bot.load_extension(f"cogs.{filename[:-3]}") RuntimeWarning: Enable tracemalloc to get the object allocation traceback
it is the same code for my other bot and it works fine, and I dont think that one is using the updated discord.py
await it
read https://discordpy.readthedocs.io/en/master/migrating.html for a list of breaking changes
@heavy folio why does my old bot still work the same?
Is there a way to just keep it like that for my new bot?
and when I await it says await outside of function
show code
async def on_ready():
print(f"{bot.user} is online!")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
please tell me I dont have to change much, I hate updates
What
i want cogs docs my friend want
i mean you can put it in on_ready no?
!d discord.ext.commands.Cog
class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.
A cog is a collection of commands, listeners, and optional state to
help group commands together. More information on them can be found on
the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.
When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta")
are equally valid here.
okay thanks
Why do you hate updates
Updates brings features and bug fixes
gotta change like everything
bot.load_extension()
in mine disnake its not coro
cant, says await outside of function
.
You can just subclass commands.Bot and overwrite setup_hook
Better to put it in setup_hook
either way its not quite a lot of changes
async def on_ready():
print(f"{bot.user} is online!")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
await bot.load_extension(f"cogs.{filename[:-3]}")
like that?
If you really don't like this changes then go back to the outdated version of discord.py
cause that doesnt work
await
yeah it dont work๐คทโโ๏ธ
did you make the setup function async
Not the best idea to load cogs in on_ready
It's going to throw an ExtensionAlreadyLoaded and crash your bot in on_ready()
Put it in setup_hook
Just add a boolean to check if on_ready was already called
You'll also have to subclass bot to use that
Yeah i already said it here
okay, can I just make it like my other bot and stay at 1.7.3? But then I need help importing the discord.ui
even though my other bot works :/
there isn't discord.ui in 1.7.3
You have to be on 2.0 to use discord.ui
But Im not on my other bot and it works just fine
Maybe my discord.ui is outdated to work with 1.7.3 also
I really doubt you'd be able to use discord.ui on 1.7.3
I swear I am
There's probably something else going on
Ill show my other bot code
Like venvs or conflicting installs
What's to say that's the one your bot is using?
You've probably got a 2.0 somewhere else it's using
well, I dont have to use the await shit for my old bot
Then you've got a broken package install and you should get it fixed asap
anyways I guess I am fucked so how do I do the await shit again?
for new bot
starting over
import discord
import os
from discord.ext import commands
import json
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all(), case_insensitive=True)
bot.remove_command("help")
@bot.event
async def on_ready():
print(f"{bot.user} is online!")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
bot.run(os.environ.get("TOKEN"))
class MyBot(commands.Bot):
def __init__(...):
super().__init__(...)
async def setup_hook():
# do setup stuff here
bot = MyBot(...) # this will be your new bot instance
@bot.event
...
@bot.command()
...
I am confused already
I'd love to be able to clarify
How can I put that into my code? I cant make sense of all that, being so used to how mine is formatted
and with this new bot instance, will I have to change anything about my commands because that would be a painn
class Cog(commands.GroupCog):
"""this was more than 100 chars and was supposed to be a cog description""" # errored out if more than 100 chars
@app_commands.command()
async def test(self, interaction):
"""this is the slash cmd description which was less than 100 chars"""
...
```is it intentional that the cog description cannot be more than 100 characters? it used to be possible
That's understandable, I see you have
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all(), case_insensitive=True)
commands.Bot is the default bot instance, and by subclassing it, you're basically making a copy of commands.Bot, and extending it. So your new class will take the place of commands.Bot
Anyone know where I can find a mass dm bot on discord (DM if you can)
No
No. That's against Discord's terms of service
I just dont know what to put where, like the ... and what is considered the "setup stuff"
Basically, you're replacing
bot = commands.Bot(...)
with
class MyBot(commands.Bot): # this part is important
...
bot = MyBot() # notice how it's different from `commands.Bot()`?
Probably because discords limit in length of slash command group descriptions
"Setup stuff" can be things like loading cogs (what you're interested in), creating aiohttp client sessions, connecting to your database, and all that jazz
Can you translate my code into that I still am clueless on what any of it means or the point in doing so๐ญ
Speaking of aiohttp client sessions, @alpine pewter you shouldn't be creating a new client session like this:
async with aiohttp.ClientSession() as session:
...
you should have a global one
Translate your code, I'm not allowed to do that, nor would that benefit your learning. I can guide you through it step by step, however
So, having a bit of a dilemma, can't get pydub to 'select' the file, it just exports it straight up. I needa have the MP3 as an object.
import pydub
import os
import io
print(pydub.audio_segment.AUDIO_FILE_EXT_ALIASES)
recording = pydub.AudioSegment.from_file(io.BytesIO(txt2),format="mp3")
mp3 = recording.export('voice_claim.mp3',format='mp3')
await ctx.respond(mp3)
# txt2 and ctx are irrelevant mumbo jumbo, I just need mp3 to be an actual object I can use.
Are you trying to stream this to a discord voice channel via a bot?
No, just post it as a file
Hey @hidden hazel!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Ohh alright. Someone explained it to me earlier and I thought it was just the location of the aiohttp.
What's wrong this way and how/what can I do to fix that?
And thank you btw
Ah, I ask because that's unfortunately out of the scope of this channel. We are internally discussing a new topical channel that could fit the scope of your question, but as that does not exist as of yet, I suggest you claim yourself a help channel (see: #โ๏ฝhow-to-get-help), or ask in #python-discussion
thank you robin for your help, I have to sleep now but I will definitely be here tomorrow๐ญ
Ah, alright.
no, that's not the point
group commands arent shown, their subcommands are and look carefully in my @app_commands.command() deco and func, i have the description there and that's the one which will be shown
i dont think group commands by themselves will be shown? so i dont get why the cog description has a character limit
Donโt create a session per request. Most likely you need a session per application which performs all requests altogether.
More complex cases may require a session per site, e.g. one for Github and other one for Facebook APIs. Anyway making a session for every request is a very bad idea.
A session contains a connection pool inside. Connection reusage and keep-alives (both are on by default) may speed up total performance.
from: https://docs.aiohttp.org/en/stable/client_quickstart.html
Yup. Ping me if you need any further assistance
Got it, I'll definitely look into that.
I didn't know it caused an issue that way, I've only used aiohttp this way before.
As for how to fix it? Do the same thing I told Tok to do, subclass commands.Bot, and bind your newly instantiated aiohttp.ClientSession to your bot instance (self if you're subclassing):
class MyBot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
...
async def setup_hook(self):
self.session = await aiohttp.ClientSession()
bot = MyBot(...) # notice how this is different from how you might usually do `bot = commands.Bot(...)`?
Forgot self. Been doing too much javascript
Ohh okay, so, something like that would fix any problems for the future?
For the aiohttp - anyway.
You got it
Okay, I'm somewhat newish to coding, I'll try that and if I need help, I'll let you know ๐
I do have one more question about cogsif you can
Please, go ahead
server_ids = [10675, 10501, 10482, 10490, 1016, 10416, 1796, 10483, 1047, 10450, 10412, 10709, 179, 1051]
guild_ids = [956462089935941652]
def __init__(self, bot):
self.bot = bot
@nextcord.slash_command(guild_ids=guild_ids)
async def ark_ban(self, interaction : Interaction, gamertag : str = SlashOption(description="Enter the user's gamertag.")):
if (not interaction.user.guild_permissions.administrator):
embed = nextcord.Embed(title="`โ` `System Exception Error!`", description="**Exception Error, Checklist:**\nEnsure user permissions are met.\nCheck the API's current status.", color=3066993)
embed.set_thumbnail(url = "https://i.imgur.com/FmzHoKr.png")
await interaction.send(embed=embed, ephemeral=False)
return
else:
async with aiohttp.ClientSession() as session:
for id in server_ids:
url = f"https://api.nitrado.net/services/{id}/gameservers/games/banlist"
response = await (await session.post(url, headers=headers)).json()
print(response)
embed = nextcord.Embed(description=f"**`>`** **`โ
- System Success:`**\nThe user have been banned!\nResponse: `({gamertag})`", color=3066993)
await interaction.response.send_message(embed=embed, ephemeral=False)
How come guild_ids register through all my commands below that? Though the server_ids will not register?
(Haven't fixed the aiohttp yet)
Wait
Half the code is missing lmao
Oh yeah thatโs correct
They're my own servers on Nitrado, I cut them in half to be safe, the full ID gives admin access through API.
They're accurate though ๐
Okay, and what do you mean by "the server_ids will not register"?
Do you actually need an await for that?
I donโt think so.
Not sure, it does need access to the event loop however
03.05 02:12:50 [Bot] NameError: name 'server_ids' is not defined
That's the error I got with it positioned there, though when I moved the [server_ids] into part of the code, it worked fine.
just pass it in then
ClientSession() takes a loop kwarg
If not passed in it probably runs asyncio.get_running_loop
Yeah, but when you have async setup hook function you may as well call it in there with nothing attached
i mean thereโs not really any extra effort needed
!paste Can you post your full code in a hastebin?
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Will do
You're right, looking at the documentation and it doesn't seem like they're using await on it
Yeah, don't know how you'd make a class constructor async anyway
I believe the issue is the placement of it.
The headers and server_ids have issues.
https://paste.pythondiscord.com/nanekawaqi
!e
class AsyncConstructor:
async def __init__(self):
print("Asynchronous initialisation")
async def main():
await AsyncConstructor()
asyncio.run(main())
don't think that's gonna work anyway
async with aiohttp.ClientSession()
Try moving those inside the constructor and bind them to the instance
Can you dumb that down for me some? Lol
Well, that's more of an __aenter__/__aexit__ deal rather than a truly asynchronous constructor
yea.
Slide it into the init
class Nitrado(commands.Cog):
def __init__(self, ...):
...
self.headers = {...}
self.server_ids = [...]
self.guild_ids = [...]
Constructor = __init__
Will do, that's how I started it, it gave an error but maybe I messed it up
One sec, trying again
Also, if you were to make a global ClientSession like I mentioned earlier, you can just pass in your header into that and aiohttp will automatically include that with any requests made with that ClientSession instance
Straight from the docs:
headers={"Authorization": "Basic bG9naW46cGFzcw=="}
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get("http://httpbin.org/headers") as r:
json_body = await r.json()
assert json_body['headers']['Authorization'] == \
'Basic bG9naW46cGFzcw=='
Notice how the headers are passed into aiohttp.ClientSession rather than session.* methods?
Okay, that's starting to make more sense to me.
I was confused on how to go about that.
Will you be on for a few so when I switch it all you can check it out?
If you pass it to the session, aiohttp will automatically pass it to the methods
It's useful for shared headers, like what our friend here is doing
Thatโs epic
Yup, especally when you interact with different APIs that have their own headers, you can have multiple clients for each API with their own shared headers
Across all methods tho? What if one of the methods doesnโt require any headers?
https://paste.pythondiscord.com/oxocevucuv
So, I switched it like you said, I got this error.
03.05 02:32:04 [Bot] NameError: name 'server_ids' is not defined
Not sure about that. The whole point is that ALL methods require it. You may be able to override it by passing an empty header however
Sounds reasonable
Wait, so, I'd need to put self in front of that?
I did not know that lol
Iโm your init
Yes
All those variables you made there need self
Or it binds to the function not the class
pretty sure. Idk
Even for guild_ids ?
idk python. Iโm just here.
If you're setting, that is. If you're just accessing, then it won't be found
I've used it normally without it for about a month, haven't ran into that issue
Am I like missing something or is your indention off
The rest is fine, the issue is I didn't know where to put my headers/server_ids
Pass that into your aiohttp.ClientSession within your setup_hook()
They're basically in the same scope you had them earlier
They're aligned, I don't think that's the issue.
It might look odd on the formatter
I think. Iโm just trying to support what Robin is saying. Since he said to move them into the init
Let me just change the code into the other aiohttp
Then go from that
!e
class MyClass:
x = "Hello, world!"
def say_hello(self):
print(self.x)
MyClass().say_hello()
@sick birch :white_check_mark: Your eval job has completed with return code 0.
Hello, world!
Oh looks like it's automatically bound as a class instance when you have it top-level inside a class
Leave your stuff how it is then and just access them like self.server_ids and self.guild_ids
TIL
mm
async def start_loop():
await self.api.start_loop()
print("Post Count")
start_loop()``` ```py
Warning (from warnings module):
File "C:\Users\culan\OneDrive\Desktop\3.0.0 echo\cogs\api.py", line 28
start_loop()
RuntimeWarning: coroutine 'DiscordListsPost.start_loop' was never awaited``` i can not seam to fix this can someone help?
!e
import __hello__
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Hello world!
no
its a class variable
Yeah, which are really just bound to self
its the same for all instances and can be accessed with instances of the class
Same thing, different terminologies
not quite
This is a bit different yeah
theyre class variables and not instance variables
It's more like static keyword in Typescript or Java
self.x = x
i.e here self.x has a different value depending on the instance of the class
while
x = ...
is a class variable which will always be the same no matter the class instance
Hello
Yup, slightly different
that is so.
@nextcord.slash_command(guild_ids=guild_ids)
async def ark_ban(self, interaction : Interaction, gamertag : str = SlashOption(description="Enter the user's gamertag.")):
server_ids = [106, 101, 102, 1040, 104, 16, 10486, 1083, 1046, 100, 2, 104, 109, 1051]
if (not interaction.user.guild_permissions.administrator):
embed = nextcord.Embed(title="`โ` `System Exception Error!`", description="**Exception Error, Checklist:**\nEnsure user permissions are met.\nCheck the API's current status.", color=3066993)
embed.set_thumbnail(url = "https://i.imgur.com/FmzHoKr.png")
await interaction.send(embed=embed, ephemeral=False)
return
else:
headers = {"Authorization" : key.nitrado_key}
async with aiohttp.ClientSession() as session:
for id in server_ids:
url = f"https://api.nitrado.net/services/{id}/gameservers/games/banlist"
response = await (await session.post(url, headers=headers)).json()
print(response)
embed = nextcord.Embed(description=f"**`>`** **`โ
- System Success:`**\nThe user have been banned!\nResponse: `({gamertag})`", color=3066993)
await interaction.response.send_message(embed=embed, ephemeral=False)
@sick birch - So, I figured out the issue, this is working mostly.
This command gives the response of it working - Though, it doesn't do anything.
The API response saying that the user was banned.
When I use it through postman, it works just fine.
Assuming it has to do with the aiohttp, should I try switching to what you said now?
do know even if its a class variable suggest its a variable in the class scope which any instance can call the variable ofc but its not in the global scope!
"doesn't do anything" as in how?
The API responds with this below - Sorry, I should probs word things better.
"status": "success",
"message": "The user has been added to the banlist."
}```
It's a `POST`
When I do it through my bot, it says it bans the player but doesn't work.
When I do it through postman, it bans the player immediately.
I'm unsure what's wrong with my part of the code.
Let me try it with one ID instead.
Doesn't work as in, the player is not banned in the game?
hi
Howdy do?
im fine :D , how are u
I'm doing peachy, thanks for asking!
Correct. My code replies stating the they have been banned, through the API.
Though, the player does not get banned in-game.
I tested the API with postman, it works properly. It's an issue with what I did wrong.
I'm unsure what I did wrong though.
It's a start :)
whats the issue?
Ah, and you're 100% sure postman & your local code matches up?
long story short, API request works through postman, not through aiohttp
weird postman probably does it in a better way
probably making a bad request then
Anyone know why my interaction.user.status is returning as "offline"
anyone knows how to set up webhook?
is the user... offline?
I'm using the same URL from postman, it's a post and I'm 100% certain something is wrong with my code.
I just can't figure out what. It replies from the API saying it did ban them. Though, it doesn't actually do any action.
No
im struggling to make a vote reward for my discord bot
It's me, and I'm well online
the user is offline or you dont have members intent if they arent not sure
disnake
Either you're passing in the wrong ID (valid ID - it's someone elses, just not yours) or something's wrong with Nitrado's backend
intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix='-', intents=intents, case_insensitive=True, strip_after_prefix=True)
could someone help me
Traceback (most recent call last):
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
TypeError: youtube() takes 1 positional argument but 2 were given
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: youtube() takes 1 positional argument but 2 were given
@commands.command(aliases=["YouTube", "YOUTUBE", "Youtube"], pass_context=True)
async def youtube(ctx, *, query: str):
req = requests.get(('https://www.googleapis.com/youtube/v3/search?part=id&maxResults=1''&order=relevance&q={}&relevanceLanguage=en&safeSearch=moderate&type=video''&videoDimension=2d&fields=items%2Fid%2FvideoId&key=').format(query) + os.environ['yt'])
await ctx.reply('**Video URL: https://www.youtube.com/watch?v={}**'.format(req.json()['items'][0]['id']['videoId']))
could you show the code or tag me?
This should work as intents, right?
Fantastic! Glad to see some practical uses for modals
thats a lot of lines
I use modals to send embeds!
Will do, one second!
Have a field for the title and the description at least
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
you need to pass in a query argument when you run the command
:D
sure
this looks low-key awesome
postman is just like a client to help with request thats all theres no such thing as it does it better lol
i know
it depends on the payloads you send
yea i did but it says sm error
@alpine pewter could I have the link to your code again? Had it up on my laptop but switched to my desktop and lost it
im now adding giveaway stop cmd
how did you run the command?
you used an sql based db i suppose?
you are missing self
m!youtube mo vlgs
sparky uses json files
https://paste.pythondiscord.com/ohebufosey
@sick birch @slate swan
It works immediately when using postman, so I know it's something I'm doing wrong.
I've checked the server_id and it's accurate as well - The API returns a success code saying it bans the player and it doesn't actually ban the player with my code but it works as expected with postman.
๐ถ
very strange ๐ค
I trimmed the server id in the link for security purposes.
But other than that, it's 100% accurate
does the phone status thing gets a lot of websocket requests?
I just got a discord popup on my server, but I click before it came up so it disappeared immediately. Anyone know what it could have been?
I own the server btw.
pardon?
!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)
its just a presence, like any other
its http request and it wouldnt matter really the gateway handles it quite easily
@alpine pewter by chance, are you using postman's special thing for authorizing? or are you doing it manually?
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
In the "authorization" tab I mean
๐ค is the new change in slash commands permission anyhow breaking code-wise ?
This code was working before but now it isnt
you did not import Path
um whats that drop down menu called ??
I'm not too sure what you mean by that.
I entered it as a POST and put in the info necessary, then but the AUTH token.
When I start it, I'm in the params tab. If that helps
@slate swan
!d discord.ui.SelectMenu
No documentation found for the requested symbol.
Where'd you put the auth token?
okay
Authorization, under a Bearer token
what is that exactly? are you makign your own wrapper?
no
is the mobile status thing
from pathlib import Path
in main file:
discord.gateway.DiscordWebSocket.identify = ok.get_mobile()
Aha, spotted. When in Postman you select the "Authorization" tab and use a Bearer token, it actually creates a header like this:
{
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
But yours looks like this:
{
"Authorization": "YOUR_TOKEN_HERE"
}
I can tell from this snippet in your code, line 27:
headers = {"Authorization" : key.nitrado_key}
It should be:
headers = {"Authorization" : "Bearer " + key.nitrado_key}
Let me try that, I'm gonna be so happy if that's all
alright indian guy on youtube solved my problem
Of course
was it hunter?
yeah youtube's better than here
LOL
if that was his problem how did it not raise a 401?
Hunter has a yt channel?
lmao
hunter is a lovely indian lad
nah, just asking
Not sure. Maybe just their API design, bug on their end
KEKW
REPORT BUG
what about me >:C
poor api design smh
you arent cuz you havent accepted my friend request while hunter did๐ก
btw, I wanted to ask, lightbulb-hikari doesnt have support for like nicknames and stuff? do i need to make direct requests to the api?
even after those splitgate games i even knew you before you had those colorful roles๐
i cant lmao
wdym ofcourse it does
Actually, I don't believe that this is the issue, if I enter it wrong, it tells me that the token is missing.
It's working normally as it was before, same issue.
click on my pfp and youll see my profile pop up and then press this button๐
huhh, me who couldnt even find them in the docs
thanks i'll look those up again
Strange, because postman prepends "bearer" to the start, yet it works from there?
lol
getting nickname: hikari.Member.nickname
setting nickname: hikari.Member.edit(nickname="okiuwume")
ayo?
okiuwume ????????????
i can only see scary eyes
okiuwume
With the key I have in, I put bearer in it already, it seems to be working.
Do you want me to type it normally?
.lo
yesh yesh, thanks a lot uwu sarthak
no uwus guys im too mature for that
totally not targetted to you
๐๏ธ๐๏ธ

uwu
Do me a favour, go to the Headers tab on postman, then click "X hidden" button to the right of "Headers"
Then let me know what you see next to "Authorization" (blank out your API key, of course)
....
c'mon okimii, you're such a princess, why not uwu
im a man
Yes, I'm here
๐คฃ
Alright lads, bit off topic. Let's get back on track
average 13yo
im 15?
@sick birch
And this is working, you said?
still not my fav indian lad๐
!ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
MOVE TO OT
Yes, it's working this way on postman currently
sarthak and hunter are my fav indian lads cuz they have me added๐ก
Robin...is indian?
And you did capital B Bearer with a space after? (in your code)
it seems as if so
I just banned myself from my own server, it 100% works in postman
everyone here add robin
no please i have 32
๐
32 is a nice number
lets make it the funny number
I thought you were American for some reason
i love you more sarthak
Here's the key page, part of the key.
nitrado_key = "Bearer B7rcAjbI5N..."
because of his name
ye if u plus 37 (jk)
Oh, you've hard coded the "Bearer" part in your code?
POV: Robin decoines at least one of them to not make it
lol
hey robin!
idk
your view examples are poo!
Yes, I did. Is that wrong?
That explains it. I thought your API key variable just contained the API key
How do you mention your bots name in a f string?
๐ how does that matter where he's from, lets get back to the channel topic?
The userโs username.
Sorry, I didn't mean to confuse you lol
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
can be accessed with bot.user
No no, it's alright. The problem is still there however
I mean, at this point I can only chalk it up to an internal issue?
Have you tried using just one ID?
Probably, do you want me to send you the docs?
See if you see something I don't
hey robin i have a question
indian guy on youtube got that
Yes, I have
but i dont have
๐
any reason why discord keeps their websockets closed to me๐
go ahead
its mt
!ot !ot !ot
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
LOL
i cant connect even after sending hbs๐
@sick birch
||https://doc.nitrado.net/#api-Player_Management-AddToBanlist||
Here's the exact spot in the API I'm trying to recreate on my own bot. It's working on postman currently.
Is it like this ? (f"\n\n{client.user.name}")
i cant even send hbs lol
its been a long time since i used top.gg ,im sure i did that atleast once lemme recheck
yes that would work :D
okok thankssssssss
It doesnt
Very strange, I'm stumped honestly
i think discords websockets hate me๐
error?
๐คฃ
It has to be a backend bug
i rickrolled okimii
BRUH
not funny๐ฟ
I'm starting to probably just accept that lol
erm
tf weird string parsing, may i see more code
I suppose get in touch with Nitrado customer support if they have one, and ask them what's up?
async def verify7(ctx):
e = discord.Embed(color=0x36393F)
e.description = """How to get Selfie & Age Verified
Make a selfie of you holding your (ID / Passport / Drivers License) (no copy/scan) & a physical piece of paper containing the following information:
:heart: Discord name, ex. : User#0000
:heart: Local time, timezone and date ex. : 00:00 AM NZDT, DD/MM/YYYY
:heart: Server name: True Love 16+
โคท After that make a close up picture of your (ID / Passport / Drivers License) showing the following information:
:heart: Date of birth
:heart: ID Photo
Send your verification photos to: (f"\n\n{client.user.name}")
"""
await channel.send(embed=e)```
should be
f('Send your vertifiaction photos to {client.user.name}')
Probably, this is the response I get from my console when I enter the code.
u cant format a string inside a string
it will be taken as a text not a string formatter
damn robin didnt answered my question hes just like websockets i send heartbeats and he never acknowledges them๐
my bad. too many messages
let me take a look for ya
I've been harassing him the last hour, sorry
`e.description = f"""How to get Selfie & Age Verified
Make a selfie of you holding your (ID / Passport / Drivers License) (no copy/scan) & a physical piece of paper containing the following information:
โค๏ธ Discord name, ex. : User#0000
โค๏ธ Local time, timezone and date ex. : 00:00 AM NZDT, DD/MM/YYYY
โค๏ธ Server name: True Love 16+
โคท After that make a close up picture of your (ID / Passport / Drivers License) showing the following information:
โค๏ธ Date of birth
โค๏ธ ID Photo
Send your verification photos to: \n\n{client.user.name}
"""`
Well i want to have it as a string formatter in the embed]
๐
black hearts
Well honestly, it's better suited for #965291516031549500 as this channel is quite busy at the moment. If you can send code, and any tracebacks that would be very helpful
@loud junco ok see, this is where you enter your website to send request to, when the top.gg events are triggered
you first need to enter a value for this then the "Send" button appears
imagine sending your license to a random dating bot
i did asked there but you never check, its like if im sending you hbs and you close the connection on me like you got me like a zombie connection๐
!rule 7 REVENGE
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

i entered webhook url and authorisation
after i press save
no send comes out
Apologies, but it's a lot to keep up with ๐
Wait, I figured it out I think @sick birch
I just copied postmanes code of it and it worked
Postman generates python code?
okimii fix your grammar ๐
too fast for that
did you try reloading the page, the website is quite sluggy now
For requests only I think
okok
alright got it thanks
Ah, interesting
i dont fix grammar, grammar fixes me๐
ahem
imagine using top.gg after this button
๐ณ
fixes u in what way
any way you want to imagine
Doesn't help you discover bots
ye
thats true
It just helps you to invite a bot you visit its profile
url = "https://api.nitrado.net/services/XXX/gameservers/games/banlist?identifier=vSpectraI"
payload={}
headers = {
'Authorization': 'Bearer B7rcAjbI5Nw...',
'Cookie': '7c7a3581f78104008dff0...'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Yeah, this is all it is apparently to work.
Only took me an hour to realize there's a copy button 
right
anyways im gonna go to sleep, Goodnight everyone!๐
gn oki
'night
i just woke up
I would do some minor adjustments like using requests.post() instead of requests.request("POST", ...)
gn i hope u dont get nightmare of mine
mine never checks it
BRUH
Other than that, yeah, good for you! Sorry I couldn't be of more help to you
fix your grammar first๐โโ๏ธ
AMONG US
nigerundayo smokey
Goodnight my fellow crewmates๐๏ธ๐๏ธ
Got it, I'll change that, do you think that's all?
And no worries, Nitrado is slow. I've been hosting off them for 5+ years, my servers stay up only like 70% of the time.
API is probably terrible
Should be it. I'm off to bed, so if there's any issues ping me, I usually check my inbox in the mornings
For sure, I appreciate all that help. ๐
t'was my pleasure
@client.event
async def on_command_error(ctx, error):
embed =discord.Embed(color=000000, title=f'Vexon | Error!', description=f"**:RikkaDance: | {error}**")
await ctx.reply(embed=embed, mention_author=True)
I want to change this
Into this
SPOILERS
Xd sorry
๐ถ
Anyone?
Use the Levensthein distance algorithm to get the closest matching command (recommended). Or simply check if the command you've used is in one of your commands, e.g. you have command botinfo and ban but you've tried info, info is in botinfo but not ban. (Less recommended as it might not always be accurate.)
What if i want to ping it in the embed?
Append .mention
like mention it like @ everyone for example
That you can't
I have seen servers and it seems thats you can
What you can do is mention someone, but they won't get any notification
thats a mention, not a ping
I know you cant btu i was saying for example
Cloning another bot 
or yeah mention the bot in embed
bot.user.mention as said
I hope you moderate your server really well and make sure everyone is 18+
If there's minors being involved on the server and no one is kicking them out, then yes, it's against ToS and your server will get terminated along with your account.
How to change bot status into this?
Can you stop marking them as spoiler? It's really annoying as many people already said...
And you can't do that
Why?
Because the API doesn't let you do it
You can, but it's not intended
Well
I know.
mobile_status ?
Yes
Hence not recommended and shouldn't be explained
Surprised they're not completely blocking it
?
:v
Simply don't do it
So how these guys do that?
Again
lmao
๐ถ
It is technically possible
Hmm
But
- Not recommended
- Pretty sure it's against ToS in that case
- With your knowledge I wouldn't get myself into that
why would you even need that if its not recommended, its just a status and doesn't affect performance of the bot
is it related to api manipulation?
Yes
ah
Well
Websocket identify manipulation
to be exact yes
Which is as per terms of service disallowed
I suppose as you're working with that sort of thing, you're naturally going to be interested in that
Against tos what?
yeah
Seriously?
terms of service of discord
Yes
Can get your bot and account technically terminated if discord cares
Xd got it
They would probably do something else than terminate your account directly
Such as a warning or hindering your bot to use that status
๐
Figured out the actual issue 
I forgot the params @sick birch
i forgot
