#discord-bots
1 messages ยท Page 39 of 1
Can u send the file where you load the cogs? The main file
async def load():
for file in os.listdir('cogs'):
if file.endswith('.py'):
await bot.load_extension(f'cogs.{file}')```
I am kinda new to cogs btw
Ok so the file name includes .py, and you can't do that
If the filr name is warn.py, you should load:
cogs.warn
So use string slicing for that
Can you give an example pls ๐ฅฒ
Like the complete part, cogs=[names] then the load.extension
I seriously don't know where to place that load.extension thing ๐ฅฒ
You placed it good, you just gotta string sluce the last three chars of the file string
Like? ๐ญ
@pale turtle :white_check_mark: Your 3.11 eval job has completed with return code 0.
warn
does anyone know how i can make a discord bot that pings people in my server every time my roblox game is updated
OOOOOOOOOH
In place of 3, i should 2 or?
No why
Oh wait nvm
Look you get from the directory file names warn.py, and you want to remove the .py part of it, last three chars
Ight got you
yo guys
?
how to add multiple client.event in bot ?
i have written a python discord but the thing is it got alot of if condition so i want to deconstruct into small functions
Why not use .listen() instead.
im using this method which is fucking shit
let me try
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
@pale turtle thx alot bro, it works now
i just have to replace client.event with client.listen() right ?
you can do
@client.listen('on_message')
async def some_listener(ctx) -> None:
# do something
there are breaking changes in discord.py 2.0
@rancid stump .
๐ฅฒ
got it
what version was your old code written in?
1.7 something like that
@slate swan ?
what is your client code?
its discord.py file
do you not define client anywhere?
@ionic edge in d.py 2.0 the setup functions of cogs are coroutines that means that you need to do async def setup(...) and await bot..... there are other breaking changes, check the docs
yeah this is same im using
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
Yeah but don't call it client call it bot or smth
just giving an example and he was calling it client
I use asyncio.sleep() , how can I stop it with other commands ?
no way?
no wa
or use a botvar
but the command will only work one at a time
await asyncio.sleep(time)
if botvar_for_check == True:
do shit
don't recommend
schedules are gud
how can i use slash command and prefix command together??
in dpy?
yep
they're called hybrid commands
!d discord.ext.commands.hybrid_command
@discord.ext.commands.hybrid_command(name=..., *, with_app_command=True, **attrs)```
A decorator that transforms a function into a [`HybridCommand`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.HybridCommand "discord.ext.commands.HybridCommand").
A hybrid command is one that functions both as a regular [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") and one that is also a [`app_commands.Command`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Command "discord.app_commands.Command").
The callback being attached to the command must be representable as an application command callback. Converters are silently converted into a [`Transformer`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Transformer "discord.app_commands.Transformer") with a [`discord.AppCommandOptionType.string`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.AppCommandOptionType.string "discord.AppCommandOptionType.string") type.
Checks and error handlers are dispatched and called as-if they were commands similar to [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command"). This means that they take [`Context`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context") as a parameter rather than [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction").
All checks added using the [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") & co. decorators are added into the function. There is no way to supply your own checks through this decorator.
New in version 2.0.
Delete channels? Y would u want that
because someone made many channels on his server
those people you don't wanna give admin to
i can do that for you
dm me your server invite link
@cold tide
but do it fast
๐
๐
message = await ctx.reply(file = discord.File(spin['path'])) how i can i add this on embed?
not enough information
are you getting an error?
If not, do you have an error handler?
Are you sure your bot has the required permissions? Is channel a valid object with a delete method?
guild = ctx.guild
spam = True
while spam:
for channel in guild.channels:
await channel.delete()```
๐๏ธ ๐๏ธ
why do you set a variable instead of just doing while 1 or while True
probably to end the loop but you can always use break
he never changes the value of the variable though.
its an example mr
Ik I was just saying along with what his code says
and you can always say while True over while 1 since a number thats not 0, boolean value is True
just delete the guild instead โ
yup
sarth intelligence is out of human range ๐ณ
r i p
while 9000-8999:
print('a')
๐ญ
also @slate swan my cat is here, with me, safe, without being kidnapped
not for long
prove
i wont even look, there is a wall, it's like 10 cm between me and a wall, how can he be there?
in the walls
๐ณ
while 10/2*2-2.4:
print('a')
while float("NaN"): print("a") ๐ณ
??
!e while float("NaN"): print("a")
@slate swan :x: Your 3.11 eval job has completed with return code 143 (SIGTERM).
001 | a
002 | a
003 | a
004 | a
005 | a
006 | a
007 | a
008 | a
009 | a
010 | a
011 | a
... (truncated - too many lines)
Full output: too long to upload
NaN is true or what
while True: print('a') ๐คฆโโ๏ธ
float ("NaN") is a truthy value
[print("a")for _ in iter(int,1)]
0, [], (), "", {}, etc are falsey
no!
imagine being "Not a Number" and still being a number
isn't that a okimii?
Imagine being CAS(Cute And Sarth)
otherwise how is he inside my walls and kidnapping my cat without kidnapping it

exactly, you can't
but you can
its CoS
def cute(sarth: Sarth) -> CuteAndSarth[OkimiisLove]:
...
no its VCaSaO (Very Cute and Smart and Okimii)
im not smart, im smort
you are smart

Just need to add function decl & function calling and I'll be able to use discord.py in my programming lang
lol whatt
bro you made your own language?
await bot.sleep(300)
AttributeError: 'Bot' object has no attribute 'sleep'
is it like python compatible?
asyncio.sleep(300) ?
Yes it's python interoperable , meaning you can use ANYTHING from python inside of my programming language (if I have actually added the ast) and it also means you can import my programming language into python
andy is the type of person to bully someone for using rust and continue using ruby
isnt bot an instance of asyncio?
The programming language compiles to python bytecode
wtf
is it?
That includes all existing python libraries
yes? its a built in var isnt it?
and what langauge did you write your language in?
Python and it compiles to python bytecode
Idk ask okimii he knows all
nope
Later I'll bootstrap the compiler
Meaning soon the programming lang will be written in itself
wait did you guys really not get that was a joke?
@slate swan is bot an instance of asyncio?
๐คจ
what
i mean you can actually use discord.utils.Union instead of typing.Union so there's no jokes in this channel
?
I didn't ๐ญ
Bootstrap is a css framework, how are you going to "bootstrap" the compiler
there's not only that bootstrap
Bootstrapping as in compiler design
so its a language compatible with python that uses an interpreter with a JIT compiler to comile the src code into python bytecode?
Bootstrapping in the compiler context means writing the compiler in the language your compiler compiles
basically built in itself
Yes hence bootstrap
I see 
In computer science, bootstrapping is the technique for producing a self-compiling compiler โ that is, a compiler (or assembler) written in the source programming language that it intends to compile. An initial core version of the compiler (the bootstrap compiler) is generated in a different language (which could be assembly language); successiv...
iirc python has a bootstrapped version named pypy
btw what description do I put for a ping command?
So I should assume the same wouldn't apply to tailwind lol "I'm going to tailwind my compiler"
Bot latency mb
speed.
oh wait im smart, ill put "Pong!"
every bot does that
what? really?
That's why I put bong for mine
True
ping is actually the heartbeat latency in respect to the websocket, nothing to do with speed
Oh
Juice WRLD
It's more of a convention like "Hello world"
its called ping and pong because of ping and pong frames
Wouldn't it have something at least to do with speed?
not necessary
it depends on your internet connection ofc, but there much more factors ( like the server side connection etc)
It is the speed at which a packet was sent between you and the service
wdym
yeah, but thats not actually limited to that right
Hi, I would like to create a help command (I'm using slash commands) but I don't see anything in the docs, I'm looking for something like the default help command with normal commands, is that possible with slash commands or do I have to create it manually? Thanks.
why would you need a help command for slash commands
I mean latency is just the time it takes to send the data right? That is pretty much talking about speed
I think I can use speed for mine..
HOW
fiber is insane
HTTP methods should work irrespective of that?
rich western country moment
cries in 50mbs
me at my 69 download speed
Your request goes over the internet which has latency
it's not that bad though, like 100 a month
100 what
Moneys
what currency
that's a lot
almost got the 69
rich western country thinking 100USD a month isn't a lot of money ๐
How do you do this again Im stupid I forgot, how do I enter an channel and with get channel, and then just send channel.send etc
with light waves yes
was it lightwaves or something like that i forgot the correct term
then move here
genius
y9 is inviting zeffo to his home, because y9 is home alone
poor country cannot move to rich western country
at least for me
at least for russia
'light signals'
yes
There's a lot of places where u cant just "move"
No because your wealth determines that
money
getmoney
no need for wealth when you can just move from your room to your kitchen๐ณ
๐คฏ
and make a sandwich
mine is pretty much same
fetch a channel id I forgot how anyone please xd
what provider is that
not your wifi moment
discord.utils.get?
@slate swan i wanna sleep, but i dont wanna sleep cus this is the only time you are online
ill make you a sandwich any day๐ณ
whats it again exactly for a channel id I completely forgot
!d discord.utils.get
discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Changed in version 2.0: The `iterable` parameter is now positional-only.
Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
UTC -4 moment lmao๐ญ
i had the same speed like 5 months ago with my old ISP
๐ฎ
bro is using his microwave as his router
what measurement system is that ? a comma after hundreds
imagine playing minecraft
In Europe you use , and not .
, are cooler
not everywhere, thankfully
no
channel = discord.utils.get(ctx.guild.channel_id=1009202180709941309)
``` what was it exactly i forgot ๐ซ
just use fetch?!?!? or get?!?
wait what do you guys use instead of , then?
like what would 12,345,678 be in your system
I just forgot how and im tired
periods๐
Would be an error
You canโt use two ,
12 million three hundred forty five thousand six hundred seventy eight
๐ like an IP address
๐
me in russia: 12 345 678
ETF
no i mean considering that its the International system, what would it be in your system
12.345.678
Indians casually ignoring hundredth thousand
Or just ignore the dots and do 12345678
But it looks better with .
indeed
channel = client.get_channel(1009202180709941309)
``` right lol
you should use or if the method returns None
I just want to get a channels id and then await channel.send thats all
I just forgot how it works ๐ซ
nvm I got it lol
I should sleep lol
channel = client.get_channel(1009202180709941309) or await client.fetch_channel(1009202180709941309)
bot.http.send_message()
ew
internal methods๐ญ
it gets involved in the end anyways
yup
Hey, I am working with the new slash commands, and I want to know if interactions act the same as ctx? Where I can check the channel and what not
so I can limit an interaction (slash command) to specific channels.
What does a client.event need to be in a cog?
commands.Cog.listener
@bot.slash_command(description="Repeats you, use /say (what you want to say)")
async def say(inter, what_to_say):
await inter.channel.send(what_to_say)
#finish interaction
What command would i use instead of finish interaction?
bot = commands.Bot(command_prefix=!,activity=activity,status=discord.Status.idle,intents=discord.Intents.default(),)
^
SyntaxError: invalid syntax
remove the last comma
Your command prefix should be string
ok
yeah that too lol
,
Wdym
I mean how do i do /say without revealing who sent the message
if its disnake you can just use Interaction.send to respond to it
Oh, ephemeral
bot = commands.Bot(command_prefix='!',activity=activity,status=discord.Status.idle,intents=discord.Intents.default()) my bot nont respond at !
It would say user used /say
You mean, only command author can see the message
yeah, if you want it to use a webhook then you can just respond to the interaction with an ephemeral message
Any errors?
Alright ill look into that
whats your dpy version?
@commands.Cog.listener()
async def on_guild_join(self, guild):
try:
link = await random.choice(guild.text_channels).create_invite()
except:
link = "I don't have perms to create an invite"
channel = await self.client.fetch_channel(1009210344020905994)
embed = discord.Embed(title=f"Added to server", color=0x00ff00)
embed.add_field(name=f"Server Name:", value=guild.name, inline=False)
embed.add_field(name=f"Server ID:", value=guild.id, inline=False)
embed.add_field(name=f"Owner Name:", value="f{guild.owner}", inline=False)
embed.add_field(name=f"Owner ID:", value=guild.owner_id, inline=False)
embed.add_field(name=f"Membercount:", value=f"{{len(guild.members)}}", inline=False)
embed.add_field(name=f"Invite:", value=f"{link}", inline=False)
await channel.send(embed=embed)
``` Why doesn't this work? Doesn't error either
Just doesn't send the message where it should
uh ill test
What I mean is i dont want the Twilight used /say to be there, But I want the response to be visible to anyone, so whoever sent the message is anonymous
your code creates an invite link. If it cannot for any reason, it sends a message to some channel. Is that what you intend?
If the bot gets added to a server, yes
?
why are you creating an invite and doing nothing with it?
I am sending it in the embed?
you aren't sending anything if the invite link is created succesfully
you're only sending if there was an exception raised when creating it
So you mean reply to it with an ephemeral and then send another message with what they want to say?
respond to the interaction with an ephemeral message yes and then send a message with a webhook yes
Ok
Thanks for the help
just use Interaction.send and send one message thats ephemeral and that other one thats not ephemeral internally disnake would check if the interaction was already responded to and sends a message with a newly created webhook
youre welcome
1.7.3
do you have 2 on_messages?
if so, you should use listen
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
no
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.
from discord.ext import commands
import discord
import asyncio
import random
import os
activity = discord.Activity(type=discord.ActivityType.watching, name="Tsw X IlTelegatto")
bot = commands.Bot(
command_prefix=commands.when_mentioned_or('!'),
activity=activity,
status=discord.Status.idle,
intents=discord.Intents.default(),
)
thats all your code?
i literally provided a pasting service why use another one?
and why the trailing comma?
what is trailing
Can someone help? Using nextcord
@bot.command()
@commands.has_permissions(manage_messages=True)
async def delete(message, limit: int):
await message.channel.purge(limit=limit + 1)
await message.send(f'{limit} message deleted by {message.author.name}.', delete_after=2)```
how can i make bot reply to users who dont have permission to manage_messages?
Using error handler I think
lets try
how to make <@userid> into user id
i tried int()
but got ValueError: invalid literal for int() with base 10: ''
@bot.command()
@commands.has_permissions(manage_messages=True)
async def delete(message, limit: int):
await message.channel.purge(limit=limit + 1)
await message.send(f'{limit} message deleted by {message.author.name}.', delete_after=2)
@delete.error
async def delete_error(ctx, error):
if isinstance(error, PermissionError):
await ctx.reply('You dont have permission to do this.', delete_after=2)```
it didnt worked
Isn't it MissingPermissions or something?
Try to raise the error and see what it says
discord.ext.commands.errors.MissingPermissions: You are missing Manage Messages permission(s) to run this command.```
should i make it error.MissingPermissions?
Did you try to import the error?
I mean try to do: commands.MissingPermissions
You need to do commands.MissingPermissions
its a class
should i always use commands or is it just for some cases?
hence the UpperWord naming
fixed this but now this? I looked into the cogs and it says the same there...
How are you using the command because @heavy swift should work
but its not replying the message
try:
msg = await bot.wait_for('message', timeout=999)
usern = bot.get_user(int(float(msg.content)))
writep = {
usern: nextcord.PermissionOverwrite(send_messages=True, read_messages=True),
}```
If it's a slash command, why not just take it as an argument?
its a button
where are you using <@userid>, is that supposed to be usern?
Oh ok
u mention user then bot takes it in makes it into integar
Are you sure that ctx.reply takes deleted_after as an argument?
i was using the wrong prefix, its done now
thank you
np
I see, I haven't worked with interactions before but assuming the layout is correct, I'd refrain from converting it to a float, just use int(user_id) & try using the api call fetch_user instead
Someone? Please? ๐ฅบ
you would then of course have to await it since it's a coroutine
usern = bot.get_user(int(msg.content))
ValueError: invalid literal for int() with base 10: 'mention user you wish to add?'
i'm trying to define some application commands inside of my commands.Bot subclass, yet am running into an issue. If i don't call tree.add_command for the commands and go to run the commands, I get CommandNotFound, yet when I add it and then sync, I get CommandSignatureMismatch. What exactly am i doing wrong?
Iโm not sure but sometimes this error happens when you have a variable named same as your function
DO you have another variable or function called uptime?
wait im stupid does this get member object?
Comment out all your command handlers, sync, uncomment, sync, should be good to go
You're trying to convert "mention user you wish to add?" to an int
Thanks! I just checked and yes i had a variable with the same name, now its fixed!
usern = bot.fetch_user(int(msg.content))```
๐๐
Does nextcord not require the use of a check function?
didn't seem to work sadly
idk its discord py fork
ur too powerful
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward. why am I getting that error?
replit moment
is there a solution?
dont use repl
what to use?
pc
You need a check function because your msg var isn't actually the message being sent, it's waiting for your button to be pressed
Are you using replit?
yes I am
That explains it
ofc he is
just type kill 1 in the shell, it changes your ip
is replit that bad?
Yes, it's really bad
!d discord.Client.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). 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.10)") 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.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
yes
people host nuke bots and they used shared ips so you suffer with them
it's not required too
if that isnt bad idk what is
are there any other free hosting services?
@sick birch where to write server questions?
why doesnt my blacklist system work?
client.blacklisted_users = []
def read_json(filename):
with open(f"blacklist.json", "r") as file:
data = json.load(file)
return data
def write_json(data, filename):
with open(f"blacklist.json", "w") as file:
json.dump(data, file, indent=4)
#Cog...
@commands.Cog.listener()
async def on_message(self, message):
if message.author.id in client.blacklisted_users:
return
@commands.command()
@commands.check(jet)
async def blacklist(self, ctx, user: Union[discord.Member, discord.User] = None):
if ctx.author.id == user.id:
await ctx.send("Hey, you cannot blacklist yourself!")
return
client.blacklisted_users.append(user.id)
data = read_json("blacklist")
data["blacklistedUsers"].append(user.id)
write_json(data, "blacklist")
await ctx.send(f"Hey, I have blacklisted {user.name} for you.")
@commands.command()
@commands.check(jet)
async def unblacklist(self, ctx, user: Union[discord.Member, discord.User]):
client.blacklisted_users.remove(user.id)
data = read_json("blacklist")
data["blacklistedUsers"].remove(user.id)
write_json(data, "blacklist")
await ctx.send(f"Hey, I have unblacklisted {user.name} for you.")
{
"blacklistedUsers": [
numbers,
]
}
async def on_ready(self):
print('{0.user}'.format(self))
print('Is Online')
print('-----------')
print(discord.__version__)
data = read_json("blacklist")
client.blacklisted_users = data["blacklistedUsers"]
no errors
well technically it kills the container so it resets the IP
danbothost is what i use
how much is it
3$ month
under construction
how to check if somebody adds a role to somebody else?
audit log
ctx.guild.default_role in ctx.author,roles // is this always true ?
probably
How often can you change a channel name with a discord bot? Whats the ratelimit
2/10mins
Make sure to actually respond to any interactions
E.g, sending a message with the Interaction, deferring the reaction, etc
All reactions in the discord API must have a resposne
The issue I have is that im getting ratelimited by changing channel name too often
I want to send a message saying its been successful on one hand
but how do I error handle and state that It didnt work out after interaction fails@?
Before you make the request to the API for changing the channel name do some checks before hand
You can, for an example set a dictionary with some context and a datetime object
is it possible to create a field without value?
For example, ```py
wait: dict[int, datetime.datetime] = {}
async def command(...) -> None:
if (time := wait.get(guild_id)):
if (datetime.datetime.now() - time).seconds > ...:
print("okay, make the request")
# make the request when it doesn't have something
# append
wait[guild_id] = datetime.datetime.now() + timedelta(minutes=...)
Pretty basic example, all your doing here is just checking whether or not you have waited long enough inbetween the calls
Really helpful, thanks alot
also, why use := instead of ==?
Are they not the same? Im just curious
embeds? probably not
are you sure?
the horses on this race are looking same
check for yourself, unless you use an invisible character
its not possible without using emty fields
!e ```py
wait = {"foo": "exists"}
if time := wait.get("foo"):
print(time)
@pliant gulch :white_check_mark: Your 3.11 eval job has completed with return code 0.
exists
isnt it?
that's not using any fields
what are the horses
the horses are just in the description
Otherwise you'd have to do ```py
time = wait.get("foo")
if time:
print(time)
wtf
Oo thats handy, thanks alot
why does \n look like that
how can i make that without using \n's
use multiline strings
np
Anyway to do like an user can click the button once, but when they click it again it would say โyou canโt click this button twiceโ
I donโt want to disable / stop the view after button click
:incoming_envelope: :ok_hand: applied mute to @noble walrus until <t:1660698389:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
sure?
i need to add some spaces between the horses
i tried putting \n's after every horse
but it didnt worked
what would it look like
-
-
- ๐
-
-
-
-
- ๐
-
-
istead of
-
-
- ๐
-
-
-
-
- ๐
-
-
its a little bit bad
embed2 = discord.Embed(title=f"{num}. tur.")
embed2.add_field(name=f" - " * atlar[0] + " :horse_racing:\n", value=f" - " * atlar[1] + " :horse_racing:\n", inline=False)
embed2.add_field(name=f" - " * atlar[2] + " :horse_racing:\n", value=f" - " * atlar[3] + " :horse_racing:\n", inline=False)
embed2.add_field(name=f" - " * atlar[4] + " :horse_racing:\n", value="hbc#1111", inline=False)```
i'll fix it when i complete the command
interesting concatenation
and that's sending it like
-
-
- ๐
-
-
-
-
- ๐
-
-
yes
why not make a blank field in between each line thingy
embed2.add_field(name = chr(173), value = chr(173))
what do you mean
example
embed2 = discord.Embed(title="..")
embed2.add_field(one horse)
embed2.add_field(name = chr(173), value = chr(173)) # blank line
embed2.add_field(another horse)
and it should go like
-
-
- ๐
-
-
-
-
- ๐
-
-
@gusty shard did you try it?
i was searching chr(173)
whats that?
ohh
try it out, let me know if it works. It should
theres one problem
i have two horse per field
how can i put one horse to one field
just split them up into all seperate fields?
isnt it impossible to create a field without value
actually i can put chr(173) to the values
let me try
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining. Can only be up to 25 fields.
Yo, after this month, all the bots should migrate to slash comands right, what will happen if we don't?
wasnt that delayed to 2023 or something
No
mhm
The deadline is August end
mhm cool
I need help
Embed = Discord.Embed(
title = 'Snake game',
description = '''
:blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square::blue_square: \n
:bue_square::purple_square:
''',
color = 0x00FF80);
i'm trying to make an embed and right now im trying to make a grid
it would look like this
Anyone available to help in #help-bagel
:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1660701499:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 100 emojis in 10s).
!unmute 769441935654912000
:incoming_envelope: :ok_hand: pardoned infraction mute for @slate swan.
Can't post that many emotes. ;) If you want to share images of what it looks like I'd suggest a help room.
Okay
thank you
Like that ^^^ but scaled bigger
20x20
but im not sure how to do that...
actually wait I might have an idea
Length = 20;
def __init__(self, Message):
self.Message = Message;
async def Activate(self):
Description = ':blue_square:' * self.Length + '\n'
for i in range(1, 19):
Description = Description + ':blue_square:' + (":purple_square:" * 18) + ":blue_square:" + "\n"
Description = ':blue_square:' * self.Length
print(Description)
Why isn't this working? it just shows 20 blue squares
nvm figured it out
Can someone help me make snake for a discord bot
I'm a little confused.
Uid , roleid and any other I'd comes in int or long int (MySQL) ?
BIGINT
What?
async def Activate(self):
Description = ':blue_square:' * self.Length + '\n'
for i in range(1, 5):
Description = Description + ':blue_square:' + (":black_large_square:" * 9) + ":blue_square:" + "\n"
Description = Description + (':blue_square:') + (':black_large_square:' * 4) + ':flushed:' + (':black_large_square:' * 4) + ":blue_square:" + '\n'
for i in range(1, 5):
Description = Description + ':blue_square:' + (":black_large_square:" * 9) + ":blue_square:" + "\n"
Description = Description + ':blue_square:' * self.Length
``` I have this code to make a snake grid.
I think I am doing it wrong though, shouldn't have I have coordinate points for the grid?
I think I am going about it the wrong way
you're welcome fr
i dont have walls or a home
the kids in my basement
Okay wait is this a good plan?
I'll make a dictionary of vector3s
and then...
nevermind im so confuse
If you are making it with emojis you better don't, cause on some devices the thing's gonna get messed up
Use pillow and render images
You don't need vector3's here lol it's not 3 dimensional game
vector2
Yeah
And what for would you need a dictionary
Like there's only x y for the snake
idk i just need help ๐ญ
Does it get longer or smth
Try to make that game in terminal first
To create a principle and then transfer it to the bot
Not to have delays with testing
yes
Okay
@vale wing I mean I only know ho wto use pygame
im sorry im so new to thsi
There are guides and #game-development
Also pygame has nothing to do with a discord bot
but how do I make a game in the terminal?
If you will be using image generation it doesn't really matter where you do it
If not just use like # for walls and ! for the snake or smth
And create that thing as text
You can even use your emojis if terminal is ok with displaying them
Okay
@bot.command()
@commands.is_owner()
async def view(ctx, arg) -> None:
async with aiofiles.open(f'{arg}.txt', mode='r') as f:
try:
lines = await f.readlines()
x = len(lines)
z = len(await f.read())
if z > 2000:
await ctx.send(file=f'{arg}.txt')
else:
await ctx.reply(''.join(lines))
await ctx.send(f"Total lines: {x}")
except Exception as e:
raise e``` why doesn't it send the file?
Woudnt i have to use the curses library or something?
oh okay
railway.app
any way to disable some slash commands on a specific server with leaving them global? or the only way is specifying on which guilds they will work?
permissions v2 has those settings
you can do that manually by configuring server integration settings or set permissions while creating the command internally
who is permissions v2
and i want to completely disable command on a server, however this is also helpful, except I'd want this as a decorator
!d discord.app_commands.default_permissions
@discord.app_commands.default_permissions(**perms)```
A decorator that sets the default permissions needed to execute this command.
When this decorator is used, by default users must have these permissions to execute the command. However, an administrator can change the permissions needed to execute this command using the official client. Therefore, this only serves as a hint.
Setting an empty permissions field, including via calling this with no arguments, will disallow anyone except server administrators from using the command in a guild.
This is sent to Discord server side, and is not a [`check()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check "discord.app_commands.check"). Therefore, error handlers are not called.
Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.
No way to not make the command show up unless u sync per guild which is bad
um then just make a check and send a "command not usable" response when the check fails
you can't completely hide a specific global command
that's what i did until now
and will do
yeah an ephemeral response sounds just right for the purpose
{
"response": {
"players": [
{
"steamid": "76561199084247549",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "Aethra",
"commentpermission": 1,
"profileurl": "https://steamcommunity.com/profiles/76561199084247549/",
"avatar": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993.jpg",
"avatarmedium": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993_medium.jpg",
"avatarfull": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993_full.jpg",
"avatarhash": "988a9289a0c11c184cfd1eec707e4719a00ff993",
"lastlogoff": 1660613718,
"personastate": 1,
"realname": "Aethra",
"primaryclanid": "103582791429521408",
"timecreated": 1597861298,
"personastateflags": 0,
"loccountrycode": "CA",
"locstatecode": "ON"
}
]
}
}
The json information when I call it isn't sending
you really shouldnt be creating a connection uppon each call
Sorry?
you shouldnt be creating a session in aiohttp uppon each call of the command.
what have I done wrong?
whats the issue, it doesnt send the value parsed?
Correct
I sent the json file the api provides
When I call the information it doesn't send anything.
have you loaded the cog and are you sure your command is being triggered?
Yes
I'm affirmative
When I call "Response" it calls all the information
But when I parse anything else in the file it shows nothing
or call the value parsed
the description?
?
have you used print to see if the command gets triggered?
i mean what's wrong there?
check in server integrations that the command perms got updated or not
The cog is loaded to main. if I make it send content['responses'] it sends
"players": [
{
"steamid": "76561199084247549",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "Aethra",
"commentpermission": 1,
"profileurl": "https://steamcommunity.com/profiles/76561199084247549/",
"avatar": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993.jpg",
"avatarmedium": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993_medium.jpg",
"avatarfull": "https://avatars.akamai.steamstatic.com/988a9289a0c11c184cfd1eec707e4719a00ff993_full.jpg",
"avatarhash": "988a9289a0c11c184cfd1eec707e4719a00ff993",
"lastlogoff": 1660613718
"personastate": 1,
"realname": "Aethra",
"primaryclanid": "103582791429521408",
"timecreated": 1597861298,
"personastateflags": 0,
"loccountrycode": "CA",
"locstatecode": "ON"
}
]
}
}
do you have error handlers?
what part of the response do you want
No, I do not
I have command error event, that's all
wrong index
sorry?
the parsing should be
content["players"][0]["steamid"]
Well, honestly this is like my first time using json
And I don't often use dictionary
well i recommend you look up on it
parsing a hashmap is essential for dealing with APIs
Hey, once it LOL
It's not quite working ๐
Like, nothing is sending once I execute the command
can you try to print something after sending a message?
that is correct
Do you mean nothing is printing?
seems like the context manager exited
So, what can I do about this?
i guess so?
shouldn't it be content['response']['players'][0]['steamid']?
well its allowed for everyone according to the interface
and wait, you cant set permissions for a subcommand, permissions are limited to commands
subcommands are actually just command options
bruh
what do I do?
i have prefix show (fallback) that should be allowed to everyone
others for admins
there's app commands checks that you can use for the add command
wdym
sadge:(
Hi, I'm trying to make an embed creator using modals, but I need to get user input in how many fields they want in the embed, but I can't get the input from commands, because of how the code works, how can I get user input from this? Thanks.
class EmbedCreator(disnake.ui.Modal):
def init(self):
components = [
disnake.ui.TextInput(
label="Name",
placeholder="Placeholder Name",
custom_id="name",
max_length=25,
)
]
super().init(title="Title of modal", components=components)
async def callback(self, interaction) -> None:
embed = disnake.Embed(title="Tag creation")
for key, value in interaction.text_values.items():
embed.add_field(name=key, value=value, inline=False)
await interaction.response.send_message(embed=embed)
@client.slash_command()
@has_permissions(administrator=True)
async def send_modal(inter,
fields: int = commands.Param(name="fields",
description="The amount of fields you want in the embed.")):
await inter.response.send_modal(modal=EmbedCreator())
Is there a way for the bot to leave the server? Such is a like a command .leave serverid and it wil leave that?
await self.bot.leave_guild(guild)
You can try this ig
Just define the guild and you will be fine
async def register(ctx):
with con:
con = sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS userinfo (
userid = ctx.message.author.id INTEGER
balance = 0 INTEGER""")```
im new to sqlite3, i need help with my currency bot register command.
sorry if there are lots if mistakes in my code :/
@commands.command()
async def test(self, ctx, guild):
id1 = 813824599522541628
id2 = 574217755692236803
if ctx.message.author.id == id1 or ctx.message.author.id == id2:
await self.client.leave_guild(guild)
Something like that?
Await it
await what
await self.client.leave_guild(guild)
I have that?
an example of how you create a table
with con:
con = sqlite3.connect('userinfo.db')```
this part of your code doesn't make sense, you're saying with con but then defining con immediately after
whats object_id? id? x? y? direction?
pls explain further

What's this?
those are my column names
ah
Im usng disnake any help?
show code
Just try your thing if it doesn't work then follow what I said
import disnake as discord
from disnake.ext import commands
client = commands.Bot(command_prefix="?")
@client.event
async def on_ready():
print("Ready!")
@client.slash_command(name="ping")
async def ping(ctx):
latency = round(client.latency * 1000)
await ctx.send(f"Pong! The ping is `{latency}` ms", ephemeral=False)
@client.slash_command(name="echo", description="Send a message through the bot!")
async def echo(ctx,* ,text):
await ctx.send("Your text has been sent.", ephemeral=True)
await ctx.send(text, ephemeral=False)```
also use client = commands.InteractionBot() if you're using slash commands
mhm
that could be the other reason
leme try
i see nothing else there that could be a problem
No again
async def register(ctx):
with con:
sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS userinfo (
userid INTEGER,
balance INTEGER
""")```
is it correct now?
async def echo(ctx,* ,text): i don't get this line, what are you trying to do
The user gives a text to be sent BY the bot
you want the user to input something or?
ye
await self.client.leave_guild(guild)
``` thats the error
oh that's not how you do that
Mhm
async def echo(ctx, text: str):
Any idea?
pretty sure that's how you'd do it
hmm
how is the script supposed to know what con is
Dosent resolve the error still
no attribute leave_guild so that's not how you leave the guild, itll be a different thing
oh so how do you do it?
@dull terrace
a quick way to find out is to do print(dir(self.bot))
itll give you a list of all the possible attributes and you'll probably find one that makes sense for what you're trying to do
Hm?
I just want it to leave a server when I do .leave serverid and it needs to leave that thats all
class discord.Guild```
Represents a Discord guild.
This is referred to as a โserverโ in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guildโs hash.
str(x) Returns the guildโs name.
Yeah use this lol
async def register(ctx):
con = sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS userinfo (
userid INTEGER,
balance INTEGER
""")```
yeah but what would it be in the code then lol
fixed it
Get guild object and use leave method
just ```py
await self.client.leave(guild)
Nah man
oh
You get guild object with bot.get_guild
No but I will enter in the ID, you get me?
self.client.get_guild.leave idk
Read about OOP when you have time
I'm just trying to ask what it is lol
Understand the principle of types, methods and objects
In other words, spoonfeed you
As a qualified pedagogical worker I discourage such methods
pedagogical
async def register(ctx):
con = sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS userinfo (
userid INTEGER,
balance INTEGER
""")
INSERT INTO userinfo (userid, balance)
VALUES:
(ctx.message.author.id, 0)```
Pls help me
pls tell me what esactly is not correct and what i need to change
how does python know that you're inserting that into your database
it's better if python don't know that way linter won't freak out ๐ฟ
:/
why are u creating new table for each user 
and use the cursor to execute SQL queries
then how should i make the code?
do u mind just giving me the code?
okay i'll give you the code, but you have to finish updating the 3k lines of code for my bot
fine then
gimme the code for create table and register command and ill learn the rest of SQL
He doesn't really, he's just ensuring, but it's better to do it on startup obviously
considering his dict, no.
hmmm ok..
async def register(ctx):
con = sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS userinfo (
userid INTEGER,
balance INTEGER
""")
@bot.command(name="register")
async def register(ctx):
con = sqlite3.connect('userinfo.db')
cur = con.cursor()
cur.execute("""INSERT INTO userinfo (userid, balance)
VALUES(ctx.message.author.id, 0)
""")```
I asked AI to write an intro for "guide how to create a discord bot with python" and this is what it made
In this tutorial, we will be learning how to create a discord bot using the discord.py library. This library is extremely useful for creating bots in Python. However, before we get started, I want to let you know that this tutorial is for absolute beginners. If you don't know what a discord bot is, or if you don't know how to use the discord.py library, then this tutorial is not for you.
๐
a paradox it is
so is this correct now?
you shouldnt make a connection each call or use sqlite
then help me change the code?
and why are you making a cursor, just use Connection.execute, it returns a cursor object if you nreallu need one
!pypi aiosqlite
...
Is there a way to convert random.choices list names to member object so i can mention them?
First of all, why does the list have to consist of names
you want to convert name to a member?
let me explain
i have integer in a db table ok?
you can but you shouldn't.
ok
store the user ids in a list and then when you want to mention them just send <@user_id>
What kind of integer
i want the bot to choose some random people through that integer. So for example, if the int is 5, the bot will choose 5 random people. I did that with random.choices(list, k=data[2]).
And i stuck there
yeah this is a better way over having partial objects
The list can be ctx.guild.members, you will get the list of Member objects and will be able to do whatever you want with them
if you want to use attributes on the partial object its just hectic
I cant store the ids at that point of my code
why not
And why not this
so:
members = ctx.guild.members
list = random.choices(members, k=data[2])
something like this?
Yeah I think just don't redefine list builtin plz
i'll just change the variable
list = dict```
๐ฅ
and if you are trailing an underscore should be done
!e
list = dict
jeff = list([("will", "this"), ("work", "hmm")])
print(jeff)
@dull terrace :white_check_mark: Your 3.11 eval job has completed with return code 0.
{'will': 'this', 'work': 'hmm'}
use parametization and instantiation to make it worse
from typing import Dict, Coroutine, Any, Callable, Awaitable, MutableMapping, Protocol, TypeVar
R = TypeVar('R')
good: Dict[Dict[Dict[tuple[Coroutine[Any, Any, None]], list[Any]], Dict[Callable[Callable[..., R]], Protocol[R]]], tuple[Dict[list[Dict[MutableMapping[str, R], Awaitable[R]]], float]]] = diy```

why annotate the variable and using tying.Dict, just use dict and instantiation to make it cursed
iirc typing.Dict cant even be instantiated
now way better
why have you got curly brackets around this getpuuid['data'][0]['players']['red'][1]['currenttier_patched']
could be better over nesting annotations lol
!e
banana = {"this": 1, "is": 2, "a": 3, "dictionary": 4}
print(banana["this"])
if banana["this"] == 1:
print("does this help?")
print({banana["this"]})
if {banana["this"]} == 1:
print("this wont print")```
@dull terrace :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 1
002 | does this help?
003 | {1}
got there eventually
read the code i wrote again and pay attention to curly brackets and what it prints
there is no way the console output for {getpuuid['data'][0]['players']['red'][1]['currenttier_patched']} is "Diamond 1"
how get ctx of other server?
in this code py @bot.command('role') @commands.has_permissions(administrator=True) #permissions async def role(ctx, user : discord.Member, *, role : discord.Role): if role in user.roles: await user.remove_roles(role) #removes the role if user already has await ctx.send(f"Removed {role} from {user.mention}") else: await user.add_roles(role) #adds role if not already has it await ctx.send(f"Added {role} to {user.mention}")
nvm fixed
embed.add_field(name="Created at:", value=f"<t:{int(member.created_at.timestamp().timestamp())}:f>")
.timestamp().timestamp() ๐
class must not be inside the cog
how can i do it then?
outside of the cog
!e
class A:
class B:
y = 7
def foo(self):
x = self.B()
print(x.y)
c = A()
c.foo()
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
7
u could do self.uno
well yes... but what's the point? why not make class outside?
idk 
If I have this ```py
class SomeView(discord.ui.View):
def init(self, message: .Message):
super().init()
@discord.ui.Button(label="label", url=...)
How would I set the button url to `message.jump_url`?
url=message.jump_url
set it during init by modifying the .url attribute on your function
that won't work
depends on where you define message
do you mind elaborating?
on instantiation, dpy looks for functions decorated with button() and replaces them with Button instances, which means you can edit those buttons afterwards by modifying them directly
discord/ui/view.py lines 171 to 179
def _init_children(self) -> List[Item[Self]]:
children = []
for func in self.__view_children_items__:
item: Item = func.__discord_ui_model_type__(**func.__discord_ui_model_kwargs__)
item.callback = _ViewCallback(func, self, item)
item._view = self
setattr(self, func.__name__, item)
children.append(item)
return children```
actually they use @Button() ๐ณ
yeah thats a typo
ah the decorator form actually doesnt allow url in the first place
there's no point for a link button to have a callback, so ig they disallowed that syntax entirely
i thought i used it and it work
and there is no opportunity for link button to have a callback
if you ever needed to put url buttons anywhere other than the end you'd have to clear_items() and add every button back, which is a little bit inconvenient
Master why are you awake
what's the problem?
is it 4 PM for you?
yes it is
UTC-7 moment
i was up at 2am tackling readthedocs's build process, literally couldnt find any documentation about the problem i very easily stumbled into until i made a guess and it fixed itself
If I have ```py
class MyClass(discord.ui.Button):
...
await myfunction()
class Bookmark(commands.Cog):
...
async def myfunction():
...
what are the ways I can access myfunction in the `MyClass`?
yeah whats up
@spring flax
- you do
await myfunction()whereas it is not async - myfunction has to be a classmethod if you want to use it via
Bookmark.myfunction() - do
from __future__ import annotationsto access the class that is in defined in future
@client.slash_command(name="echo", description="Send a text message through the bot")
async def echo(ctx, *, text=None):
await ctx.send(text, ephemeral=False)```
It's because of this little guy
Guys can anyone suggest me good command idea (useful)
Whats ot
Off topic
remove the *
that's not ot
No related to code lmao
and it should be text:str
They want a idea
I tried it, Won't work
It's related to discord bots
where is word "code"
Alr
Anyway anyone suggest me idea pls?
one way is passing the Cog instance to your component, or if the button can be written in the same file as your cog, you can reference any of its classmethods within your init/callback
I removed the specific command and it worked
But if I add it again it just-
they are in the same file, yes. How can I access it? You mean doing class.func()?
typed up the code as i said to correct it and it worked on my bot
Leme try
sure, just only for methods decorated with @classmethod / @staticmethod
i swear to god
eval command
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
I already have :)
What's that
are you using an sql database?
for what?
idk
Eval don't need database
no, in your bot, not for eval
this is literally it, idk what your
I using sqlite for my afk and prefix command
!e py print('this is eval')
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
this is eval
Dosent work for my smh
you're using disnake right?
Alr thx
Yep
???
You can make a sql command then
it can't be to do with that code then, what other code you using
Can you suggest any idea to me to make my bot clean?
Wrong token
to execute sql queries from messages
Nope
wdym clean?
Whats use of that?
It should be correct
Reset the token
I mean organised code
and put the new one, Give it a try
I have changed it twice in code according to the dev portal
import disnake as discord
from disnake.ext import commands
client = commands.InteractionBot()
@client.event
async def on_ready():
print("Ready!")
@client.slash_command(name="ping", description="Get the latency of bot.")
async def ping(ctx):
latency = round(client.latency * 1000)
await ctx.send(f"Pong! The ping is `{latency}` ms", ephemeral=False)
@client.slash_command(name="echo", description="Send a text message through the bot")
async def echo(ctx, text:str):
await ctx.send(text, ephemeral=False)
client.run("My token!")```
Still not working
@dull terrace
Can I see the token command ine
Lol
;-;
Define it first
I am using replit and I have an environmental variable called TOKEN storing the value
Exactly lmao
Move that my_secret to top
You defined your secret after the run line
Hmmm?
Hmm
