#discord-bots
1 messages Β· Page 22 of 1
Hey @still swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
...
!paste please use this for long code
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.
Hey @still swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
how..
just open the link, paste the code, save it, copy the url, and send it here
but the error is:
TypeError: unsupported type annotation <class 'bot.converters.Member'>
The above exception was the direct cause of the following exception:
discord.ext.commands.errors.ExtensionFailed: Extension 'bot.exts.moderation.verification_cog' raised an error: TypeError: unsupported type annotation <class 'bot.converters.Member'>
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000013162EEE280>
then the bot is closed: RuntimeError: Event loop is closed
um tbh it was a fun command thingy like i text like -bam
and it says user#0000 has been banned
is it possible?
also that
you know how to do something like that
is that a slash or hybrid command?
@bot.command()
async def bam(ctx, Member: discord.Member):
await ctx.send(f"{ctx.author} has been banned"}
if yes, custom converters can't be used, atleast this way
slash
yeah then converters won't work
in embed..
oh
thx
just use the converter inside the command function
@bot.command()
async def bam(ctx, Member: discord.Member):
await ctx.send(embed=discord.Embed(description=f"{ctx.author} has been banned"))
from http import client
import discord
from discord.ui import Button
from discord.ext import commands
from discord.components import *
bot = commands.Bot(command_prefix="=")
@bot.event
async def on_ready():
print("Ready to use!")
await bot.change_presence(activity = discord.Activity(type = discord.ActivityType.playing, name = "Buy stuffs at Magic Shop" ))
DiscordComponents(client)
@bot.command()
async def buy(ctx):
await ctx.send(
"Choose your order",
components = [
Button(style=1, label="Hello")
]
)
can someone help the button didnt work ofr me
i was trying to make a fun command thingy like i text like -bam
and it says user#0000 has been banned
but it not working somehow
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='-', intents=discord.Intents.default())
@bot.command()
async def bam(ctx, Member: discord.Member):
await ctx.send(embed=discord.Embed(description=f"{ctx.member} has been banned" , color="7289DA"))```
this my code
Not working how? Errors? What does it do?
no response when command is run
-bam @user
you have a bot.run("token") right
then no responce
yea
i think something is wrong with that ctx.member
from http import client
import discord
from discord.ui import Button
from discord.ext import commands
from discord.components import *
bot = commands.Bot(command_prefix="=")
@bot.event
async def on_ready():
print("Ready to use!")
await bot.change_presence(activity = discord.Activity(type = discord.ActivityType.playing, name = "Buy stuffs at Magic Shop" ))
DiscordComponents(client)
@bot.command()
async def buy(ctx):
await ctx.send(
"Choose your order",
components = [
Button(style=1, label="Hello")
]
)
is this the correct code to create button? or am i wrong in some parts
@west veldt
no just say user has been bammed
and what does it do now?
that looks like a response to me
oh
now i changed it then no response
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='-', intents=discord.Intents.default())
@bot.command()
async def bam(ctx, Member: discord.Member):
await ctx.send(embed=discord.Embed(description=f"{member.name} has been banned" , color="7289DA"))```
here
check your terminal for errors, you can't expect someone else to read your code and predict errors
um
Member: discord.Member
here you define Member as uppercase and refer to it in your code as member without capitalization. if you checked the terminal, you would have seen an error telling you that member is not defined
discord.ext.commands.errors.MissingRequiredArgument: Member is a required argument that is missing.
how are you invoking the command?
@bot.command()
async def bam(ctx, member: discord.Member) -> None:
await ctx.send(embed=discord.Embed(description=f"{member.mention} has been banned", color=0))
@west veldt
Member should be lower case
Follow proper naming conventions
Also let's not spoonfeed please
Python variables need to be snake_case
what is that
and occasionally SCREAMING_SNAKE_CASE for constants

(though I don't think there's an official spec for it)
Usually referred to as screaming snake case
Traceback (most recent call last):
File "c:\Users\ADMIN\Desktop\bot momento\magic bot conf.py", line 4, in <module>
import discord
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_init_.py", line 20, in <module>
from .client import Client, AppInfo, ChannelPermissions
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 38, in <module>
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\state.py", line 36, in <module>
from . import utils, compat
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
^^^^^
SyntaxError: invalid syntax
what is this error
Is it 100% necessary to upgrade pip when there is a new version?
my pip is currently screaming at me to update so no
python -m pip install -U https://github.com/Rapptz/discord.py
why's this not unpacking
the other time i updated my pip it brokeπ 
I just upgraded it
async is a keyword and can't be applied like that. asyncio also has no async attribute, what are you trying to do?
you forgot git+url
"forgot"

yes when forget means something other than forget
i dont know bro
i didnt know what i do but like
π
man asyncio.async is not a thing, please explain what you're trying to do. i find it hard to believe that you are writing python aimlessly
for real this is not my code i just saw it in error and hover through it
oh nvm i just re-read your code, i think you're looking for this:
!d asyncio.create_task
asyncio.create_task(coro, *, name=None)```
Wrap the *coro* [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) into a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") and schedule its execution. Return the Task object.
If *name* is not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").
The task is executed in the loop returned by [`get_running_loop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop "asyncio.get_running_loop"), [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError") is raised if there is no running loop in current thread.
so it's not your code or your script?
what app
? this just got real confusing real fast
Does anyone know bots like restcord or letoa
Would it be hard to make one
visual studio code
yea
i executed my script then i go to the error output
i hover to the directory and found it
to my knowledge, restcord is a library (in php π) for the discord api. as for letoa, yeah it's probably difficult
it looks to me like you might have fiddled with the installed package
just re-install discord.py with pip or whatever package manager you use
Hello, is it possible to modify the amount of time you have to interact with a button ?
i think i messed up because i install a lot of unknown package
Maybe ill have to uninstall all
@slate swan btw can you guide me how to make buttons in discord python
Thereβs prolly alot of oath resources out there
i stopped using discord.py a while ago and don't have experience with the new interactions api, sorry
and I donβt wanna copy other code (skid) as this is a project I wanna independently make
Oh ok
Thanks for the help though
Appreciate it
π
oath resources..?
Docs
you can look at the examples on the gh repo - https://github.com/Rapptz/discord.py/tree/master/examples/views
any query is welcome!
yes it is possible, certainly
you can always interact with a button unless its disabled
Is there role:discord.Role parameter in v2?
why wouldnt it be?
cause i get errors for some reason
desc = f'{role.mention}\n\n**Users:** **({len(role.members)})**\n'
on role.mention and len(role.members)
can you show more code? we don't know what role is being defined as or whether its value is changing
why to show more code since i have errors only on that line?
what are the errors then?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'mention'
^ goes back to this
role is parameter
it's likely you're doing something like this:
@commands.command(...)
async def foo(role: discord.Role):
...
This is wrong, ctx needs to be the first element. You may also be missing self as a parameter.
man i can't help you if you don't let me.
dude
i just forgot to add self parameter
im smart π
ok cool
your issue is resolved then?
yes
In v2 , how can i put the buttons one below the other?
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
there is a row argument
so you put row=0 for one button and row=1 for the second
and the second will be below
@slate swan
yes? what's the problem with that?
because when i add row=2 , its underneath the row=1 button
of course
rows are rows
0th row is above 1st row
2nd row is below 1st row
@button(..., row=0)
@button(..., row=0)
@button(..., row=0)
@button(..., row=1)
@button(..., row=1)
@button(..., row=1)
you can have same row value for multiple buttons
multiple => 5 to be a exact
yes, 5 rows with 5 components
a selectmenu is considered to be a complete row itself
I got it! Thanks
well, this still looks pretty nice
How many lines did this take you
why do you want to know
Um whjy not
cus I wrote this when I was complete noob, I dont remember but I think it can be about 5000000 lines
bro what
that's why im rewriting that bot
@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.
217
not more than 100
well idk, can wrap it up into that + depends on library
is there any way i could get python to do something any time an exception happens in any part of my code?
217 - 73 = 144
i want to make the bot dm me when an exception happens
there's an error decorator
on_error event
error handlers
for every part of my code...
!d discord.Client.on_error
await on_error(event_method, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
The default error handler provided by the client.
By default this logs to the library logger however it could be overridden to have a different implementation. Check [`on_error()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_error "discord.on_error") for more details.
Changed in version 2.0: `event_method` parameter is now positional-only and instead of writing to `sys.stderr` it logs instead.
Hi, how can I get the message object of an interaction?
gahh I thought I had more
an interaction is not a message?
there;s no commands tho
it just wraps the default bot class
yes
that wouldn't catch everything, just errors in using the library right 
I don't think there's a central place to catch all errors
wouldn't there be some way with logging or something
who knows, maybe there is some on_all_error hidden in some lemonsaurus.ext.commands.app_guilds lib
logging is logging, not handling errors
yeah but everything's connected to your client after the runtime so that should work for almost everything
hmmm
did you guys know that you can attach an else statement in a for loop?π³
@vale wing did u give nerd bot to anyone?
yes
π³
You can also attach it to a try/except
its cursed like hell
yeah works for while as well
!e
for a in range(11):
print(a)
else:
print("Done")
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
004 | 3
005 | 4
006 | 5
007 | 6
008 | 7
009 | 8
010 | 9
011 | 10
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/osifazeciz.txt?noredirect
well that's obvious
π³
Not necessarily cursed, it's pretty handy
i've only ever needed to use for else once in like 15k lines of code
I never knew it until now
we all knew that sarthππ€
same, for the for loop
shhhhhhh
π
okimii in chat π³
gahh, PEP8
what about it
PyCharm moment
π³
PEP8 moment
i only follow pep9001π³
Um, actually, I don't wanna maintain another bot π€
yup
Um, actually, my friend was annoying me in voice channel exactly like your bot except instead of Um, actually,, he was using Uh, but,
Um, actually, "um, actually" is better than "uh, but"
Um, actually, I'm about that my bot was acting EXACTLY like your bot
Ok
well maybe he just wanted to be a nerd π€
is there a way to send commands thru the console?
Why the hell does this occur even though I have dm messages intent disabled
I would recommend using raw requests to discord API cause sending commands from console has nothing to do with async lib and is gonna block a websocket
what is raw requests?
I just wanna use the console to use commands
Like commands your bot already has or what
How are you going to parse context to there
That's for sure
How?
Just make some DM commands or listen to on_message for messages in your DMs idk how you want to implement it
Alright I will try

did u read the error?
intentional #discord-bots message
@client.command()
async def dm(ctx, member: discord.Member, *, message):
if isinstance(discord.channel.DMChannel):
await member.send(message)
await ctx.send(f"{ctx.author.mention} I have sent a message to {member.mention}")
discord.errors.Forbidden: 403 Forbidden (error code: 50003): Cannot execute action on a DM channel
I want to use commands in DMs
- what is
if isinstance(discord.channel.DMChannel), that is not even a thing, look at docs - The member u are trying to dm has closed DMs or blocked the bot
I just stole the code from google
and no the member hasn't blocked the bot
Just tell me how to use commands in DMs
there is no discord.channel how didn't it give an error though
idk
discord is the package
channels.py is the file
DMChannel is a class in that file
but you use discord.channel
I.e. discord.channel.DMChannel
What do I do now?
!d discord.channel.DMChannel
class discord.DMChannel```
Represents a Discord direct message channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channelβs hash.
str(x) Returns a string representation of the channel
WOAHT?
so ig its channel, not channels
ohmygosh im so dumb
WHAT DO I DO
rewrite the code yourself
I can't...
instead of googling it
just tell me what to do..
he just did
discord.errors.Forbidden: 403 Forbidden (error code: 50003): Cannot execute action on a DM channel wtf is this error?
access denied
WHAT DO I DO THEN
pray that the member you are trying to send message to will unblock the bot if he blocked it or open his DM's if they're closed
DMs closed?
Like not allowing DMs from server members
Bruh, I want to use a buttons paginator, I was thinking for design and remembered RoboDanny's one, now I can't imagine any other way of this paginator
So you know how with webhooks you can send messages with any name or profile picture? Is it possible to recreate that functionality without manually creating and calling a webhook?
well, that is the only way except of ephemeral messages, like interaction.response.send_message(..., ephemeral=True), then bot will send a message that only one user can see which can be sent only by webhooks, so you don't have to recreate it's profile in webhook
but if you want a profile that is not similar to your bot's, then webhook is pretty much the only way
ohh it's already 0 AM
Alr bet thx
@slate swan, gn
And how could I create a webhook in code?
!d discord.Webhook
class discord.Webhook```
Represents an asynchronous Discord webhook.
Webhooks are a form to send messages to channels in Discord without a bot user or authentication.
There are two main ways to use Webhooks. The first is through the ones received by the library such as [`Guild.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.webhooks "discord.Guild.webhooks"), [`TextChannel.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.webhooks "discord.TextChannel.webhooks") and [`VoiceChannel.webhooks()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.webhooks "discord.VoiceChannel.webhooks"). The ones received by the library will automatically be bound using the libraryβs internal HTTP session.
The second form involves creating a webhook object manually using the [`from_url()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook.from_url "discord.Webhook.from_url") or [`partial()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook.partial "discord.Webhook.partial") classmethods.
For example, creating a webhook from a URL and using [aiohttp](https://docs.aiohttp.org/en/stable/index.html "(in aiohttp v3.8)"):
Oh gn sweet dreams
there is even an example below
night night, dont let your cat biteπ
get it cuz dont let the bed bugs bite
Pov commands using prefixes and reaction buttons rehehehhe
π³
he wont, hes with me
Donβt let the dogs bite in the night without the light
nice
π³ π³ π³
Ur in Russia?
goes checking where's my cat
πββοΈ
naah he's in the kitchen
looking in the window
maybe he's missing you lol
π
yes
ohhh my gosh, I just figured out that tomorrow, or today I have to spend like 2-3 hours in the morning, and then my WHOLE day is free, hehehe im gonna go crazy (switch between accounts)
bye guys, solve problems (not with my cat)
so im starting off with this new code
and im trying to figure this out
import discord
import os
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.attachement:
await message.channel.send(content=message.attachments[0].url)
return
await message.channel.send(content)
client.run(os.getenv('TOKEN'))
i want it to grab the image and also print out the same image
is that possible
print the image??
like for the bot to reprint the same image the user did
Why not use f strings on line 8? they're faster
i can add that
but im not sure how to do the rest
Just print the url?
do i need to store the url into a var
Because they're following Lucas's YT tutorial
Who?
This guy on YT that makes pretty bad tutorials, as you can see
You could
are they old videos?
d.py==1.7.0 ?
Yes, but even so they don't use things like f strings
isnt that already stored in content
Try it
@calm ridge call .to_file() on the discord.Attachment instance, and pass it into the file= kwarg into ctx.send()
Don't have to mess with URLs or anything
does someone know how can i get the account length of someone and display his days since his creation?
okok
account length?
E.g if i created my account yesterday, the bot to display 1 day
the only thing is i need it as a url
to display elsewhere
Don't use to file then
yea
Thought you wanted to send it on discord?
He wants to print the image too, I assume he means the url
I don't think you can print actual images in console
that is correct
Wait so what's your issue?
^ this code doesnt print out the same image the user already put in the channel
!d discord.User.created_at
property created_at```
Returns the userβs creation time in UTC.
This is when the userβs Discord account was created.
@slate swan
and the image for some reason is not stored in content?
because you aren't printing it?
its printing in line 16 tho
or do i use ctx.send
print content
I knew that but can i make display only the days?
What did it print for you?
You can try out the new discord timestamps
they do it??
damn I'm behind 
me too
@calm ridge just print message.attachments[0].url and see if it matches the image your bot sends
isnt that this line ```
await message.channel.send(content)
remove that line
you are already passing the argument content in your previous message
!d discord.TextChannel.send
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.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
@calm ridge
@slate swan for example, your account was created <t:1542564916:R>
π
i made my database cursor global like an idiot and didn't think about the consequences 
Is there a way to make a slash command global cause i have my bot in 3 guilds?
Yes, just sync without providing any guild IDs, but global commands can take up to an hour to propagate
async def setup(bot:commands.Bot) -> None:
await bot.add_cog(
test(bot),
guilds= [discord.Object(id=...)]
)``` so from this which is from cog, i just remove the `guilds = [discord.Object...]` right?
await add_cog(cog, /, *, override=False, guild=..., guilds=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a βcogβ to the bot.
A cog is a class that has its own event listeners and commands.
If the cog is a [`app_commands.Group`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Group "discord.app_commands.Group") then it is added to the botβs [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") as well.
Note
Exceptions raised inside a [`Cog`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog "discord.ext.commands.Cog")βs [`cog_load()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog.cog_load "discord.ext.commands.Cog.cog_load") method will be propagated to the caller...
Another question
I have command which takes from db some values. These values can be random as quantity. Now I have 20 values. However are these values are, I add them to embed but as you understand, this embed is too big. So , is there a way to make every page to has 10 values, if they exist?
I know that can be done with discord-ext-menus but i dont really understand these menus
Did anyone work with sellix api before. Like automize purchases and connect them to discord bot?
Give me an idea for one of my bot's commands.
Is it possible to record audio with discord.py?
if yes, give me an example
Because you can record people without their consent.
π€¦ββοΈ
Still don't think discord.py supports audio recording you'd need to make something custom.
Just leave it alone.
You are allowed to record voice with the bot. I have asked the mods.
Just... Leave it alone I removed it in my wish-list...
Any idea why my discord bot wouldnβt be updating/syncing itβs commands with my guild?
async def on_ready(self):
await tree.sync(guild = discord.Object(id = guild_id))
log(f'Logged in as Name: {client.user.name} - ID:{client.user.id}', folder = "logs")
log is a custom function that simply prints to console and saves the log to a folder
After I add a command and restart the bot, it wonβt show as a slash command in the Discord server. Also when I require new parameters/remove parameters it doesnβt update, but running the command will show the new response from the bot.
How do I add break lines between the datas?
On your dump add , indent = 6
indent not indend
thanks
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location) How do I fix this import error?
When I spam to level up, And then I level up while I'm spamming, The bot sends the level up 2 times, What's the best fix for this?
My code used to work before
You probably need to reinstall discord.py
ok
make sure youβre running the start from the same directory as the discord folder
When I spam to level up, And then I level up while I'm spamming, The bot sends the level up 2 times, What's the best fix for this?
Debugging your code
as my bot folder?
How do I debug this
Did you pip install for discord.py or did you download the foler
You need to debug your code, Iβm not able to debug it for you here.
Try reinstalling it
The directory youβre running the script from, is there a file/folder named discord
What about in the same folder as your bot?
Iβm still seeking help on this
rate limited perhaps? you shouldn't be syncing in on_ready either way
The issue had to do with me using run instead of start
I just figured it out and came back to say solved
hey
i cant run my discord bot and i got errors
for my GUILDS
const Discord = require(Discord.js);
const { token } = require('./config.json');
console.log(token);
const prefix = !;
const client = new Discord.Client({
allowedMentions: {
parse: [users, roles],
repliedUser: true,
},
intents: [
"GUILDS",
"GUILD_MESSAGES",
"GUILD_PRESENCES",
"GUILD_MEMBERS",
"GUILD_MESSAGE_REACTIONS",
]
});
client.on("ready", () => {
console.log("NitroNet Services botten Γ€r nu uppe!")
})
client.login("")
is these guilds right? Discords documentaion doesnt explain so good
this is a python server π
javascript moment
you're reassigning the value of ids
name it something else?
your variables...
show updated code
you're not changing your json info when you first load it
also ^
what you're basically doing is:
loading your json file
setting id as the guild id
dumping the guild id to your json
you're not editing the object (assuming it's a dictionary) that gets returned once you load your json file. Put simply, you're not "adding" the guild ID to your "database which isn't a databse"
no, I won't spoon feed you. If you don't understand json, perhaps read the documentation for it/some articles
https://docs.python.org/3/library/json.html
https://www.w3schools.com/python/python_json.asp
https://realpython.com/python-json/
@bot.command()
async def purchase(ctx: commands.Context) -> None:
try:
await ctx.send(f"{ctx.author} How would you like to pay? (b) boost (btc)")
message = await bot.wait_for("message", timeout=60, check= lambda d: d.author == ctx.author and d.channel == ctx.channel)
except TimeoutError:
return await ctx.send("Error !")
if message.content == "b":
await ctx.author.send(f"{ctx.author} Please boost the server to recieve your purchase !")
if message.context=="btc":
await ctx.send(f"{ctx.author} please send the equivalant of $2 to this address: bc1qtcdmjhqzzsfv2xc8efvd7gat4e4uvtze2ahr9q")
bot.run(token)
if message.context=="btc":
2nd statment isnt working ^
Message object has no attribute context, did you mean content?
typo π
Simple misstakes lol
@cold tide your PfP has got to racist π
Ive got this (tokens on the bottem) and when running the command $version, its not doing anything
Ideas?
Indents
can you tell me more, im new to python
Ty
Someone tell me how you can make a event that sends "error this command doesnt exsist"
Would be appreciated.
Not sure how to.
!d discord.ext.commands.Bot.on_error
await on_error(event_method, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
The default error handler provided by the client.
By default this logs to the library logger however it could be overridden to have a different implementation. Check [`on_error()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_error "discord.on_error") for more details.
Changed in version 2.0: `event_method` parameter is now positional-only and instead of writing to `sys.stderr` it logs instead.
can you show me a example??
well, there is no example for this in docs
well you just do usual event
@bot.event
async def on_command_error(ctx, error):
``` and then check if error is CommandNotFound and send that it is not found
```py
if isinstance(error, commands.CommandNotFound):
await ctx.send(f"Command {ctx.command} not found")```
but im not sure about ctx arg in on_error
on_command_error?
should use on_command_error instead, ye
yeah of course...
discord added some stupid vc feature
So what should it be like?
text in voice?
I already sent
here
nah thats cool, they added some emoji feature that spams the vc window with that emoji

Whats the hex color for red?
some random, danny doesnt join public servers usually
anyone know?
!d discord.Colour.red
classmethod red()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour "discord.Colour") with a value of `0xe74c3c`.
the id.
0xe74c3c
sorry.
How to send a message if command is used in the wrong channel??
do you have a decorator?
Well if you don't have a decorator for a specific channel, then you can just add if ctx.channel.id != channel_id: and send that it's wrong channel
in the beggining of command
The principle of decorators might be complicated for beginners so you can just remember that you need to decorate certain functions with certain decorator
Shortly decorator turns the function into something that decorator function returns
uncontrollably online?
Yes
what does that mean
I cant make it offline
waht?
Can't you just go to terminal and turn it off?
ohkay
My bot is not changing appearance too
Yes
Hello, Do you have any sample about a discord boot that makes speadchtotext from audio channel?
i had absolutely same bruh like yesterday
discord does that intentionally for easier connection next time you try to make connection, like if you testing a bot and turning it on and off in every while, so discord decides to not disconnect you as soon as you turn the bot off to save its resources if you re-connect within some time

Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
if you want it to go offline instantly you can use bot.close()
um i was trying to make a purge command but it is kindaf giving me a error im coding in replit.com ```py
@bot.command()
@has_permissions(administrator=True, manage_messages=True)
async def purge(ctx, amount=5):
await ctx. channel. purge(limit=amount + 1)
await ctx.send(((embed=discord.Embed(description=f":tick: successfully deleted {amount} messages in {ctx.channel}", color=0x2E08CB))
please help me get thru this
what are these brackets?
for what?
you need to remove them, leave only 1, cus they're not even closed
then it says this
File "main.py", line 33
keep_alive()
^
SyntaxError: invalid syntax
!e
print(((((((((((("uwu"))))))))))))
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
uwu

im using that flask thing to make bot alive
there is no embed arg in print
idk, i dont use repl.it cus it's bad
when did I say there is? 
even i use vs code but if i doit with replit and use that flask import and then i somehoe get bot pinged atleast once in a while which im doing with a different website bot is alive 24/7
I mean in the example you showed brackets doesn't matter but in his case they do because he uses embed arg
!e
print(((((__import__("random").randint(1, 10))))))
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
^^^^
Hi
hi
why did you use so many brackets?
to show me that they do not matter
what seems like a good abstraction for Intent builder py intents = Intents( Intents.X | Intents.Y | Intents.Z , ...) or ```py
intents = Intents()
intents.add_intent(Intents.X)
the first one ofc, the second one looks too wordy
first
yeah so ill go with that :p
go with happiness instead π
ah well, not my thing
understandable, still working on dawn?
i was just done with the slash commands part and decided to take a break
slash commands are done with extensions ( cog like stuff ) and the bot base
i'll make the user and message commands when im bored
mhm cool
good luck 
the autocomplete looks so uwu 
will it be hard or omega hard to switch to hybrid commands from usual commands?
no?
nop
the format is pretty much same
I hope so
but the fact that literally every library in existence does the same
ephemeral send
meh the list comps π
@Command.autocomplete("argument name")
async def name_it_anything(**some_args) -> list/Choice:
...``` is basically what each library does
but i wont be shocked if dpy came up with some weird shit
**args π
wait, @slate swan so even if I do usual it can send ephemeral message?
do usual?
I mean not slash
please define usual
no
it wont
im high so ignore that
then how will this work
ctx.defer and ephemeral=True only run when trigger is from a slash command
i think it will just not send the ephemeral response
without any error
Guys what's this error?
time to dig in the source code
wrong token
okay, then I'll try em and see
Hmm but token is correct
no
?
when command is invoked as slash command -> ephemeral = True works
when command is invoked as message command -> ephemeral = True is ignored
that all looks sus but ok
πΆββοΈ thats what i said
do you use some .env or something
still but still
um can anyone help me a bit i was trying to make a kick command but it not working its not even giving an error ```py
@bot.command(pass_context = True)
@has_permissions(administrator=True, ban_members=True)
async def kick(ctx, userName: discord.member):
await userName.kick()
@kick.error
async def kick_error(error, ctx):
if isinstance(error, MissingPermissions):
await ctx.send(f"Sorry you don't have permission to do that")```
discord.Member
me?
ummm uhhh im kindaf new to discord.py so... π
ok
It's all good
What?
import discord
from discord.ext import commands
from discord.ui import Button
bot = commands.Bot(command_prefix="=")
@bot.command()
async def hello(ctx):
button = Button(label = "Hi", style = discord.ButtonStyle.success)
view = View()
view.add_item(button)
await ctx.send("Hi", view = view)
can someone help me the command doenst work for me
and also in the error its the View() not defined
because it's not defined
you have no class View
and no class View imported
from discord.ui import Button, View ?
oh ok
import discord
from discord.ext import commands
from discord.ui import Button, View
bot = commands.Bot(command_prefix="=")
@bot.command()
async def hello(ctx):
button = Button(label = "Hi", style = discord.ButtonStyle.success)
view = View()
view.add_item(button)
await ctx.send("Hi", view = view)
added import view but when i use the command =hello nothing responded
no errors?
it still doesnt work ;-;
the member doesn't kick?
nahh
did you bot.run?
yea i did
but the discord doesnt allow me to send it here
the bot is online tho
What are cogs?
damnn it workedd
what is it.
lol
but not for me i used bot.run()
but it doenst work even tho
its weird that it doesn't show any error, but you need to have intents in your code and portal
the important one here is Intents.message_content
ohh
so how do i fix like where do i add it
like:
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(..., intents=intents)
I mean, class names as pascal case is just a convention of writing code in any language 
I don't know what pascal case is
PascalCase
ThenWhatIsUpperCamelCaseFor?
that's that's literally not a thing, it's the same as pascal case
I can relate 
No you can't, you know so much python shit π€§
I swear I dont
give me a problem and that's where I get stuck
here you go: "problem", now it's yourth
Convert a given list to a hashmap
@bot.command(pass_context = True)
@has_permissions(administrator=True, ban_members=True)
async def kick(ctx, userName: discord.Member):
await userName.kick()
await ctx.send(embed=discord.Embed(description =f"**:tick: {member.display_name} has been kicked **", color=0x2E08CB))``` um this my code it was supposed to send an embed after the member is kicked but it isnt somehow
Why do people send embeds like that
why not
I like making an embed variable instead
maybe you dont have those permissions
it kicks the member
and name it e
Master32 real
i sent the script to my friend
just doesnt send embed after kicking
and it worked for him but not for me
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if itβs within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
x == y Checks if two embeds are equal.
New in version 2.0...
oh yes
member is not defined
it's userName, not member
o
userName.display_name
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="~")
@bot.command()
async def hello(ctx):
await ctx.send("hi")
when i use ~hello nothing happened and no error output whats the problem (the bot is online)
try @client.command()
why
he has bot, it just wont work
the bot command line must be full blue
what?
in vsc its full blue
this is discord, not vsc
Do you have Message content enabled on the dev app ?
that looks like dpy 1.7.3 so it shouldnt matter
so you have an on_message event?
Hmm
no i dont
yes
and are you on dpy 1.7.3 or 2.0?
pip show π
sleep
how do i check
pip show discord.py
Version: 2.0.0a4464+g87c9c95b
2.0 hehe
run pip show discord.py
intents
you need to enable them in your code
how do i do that
Zeffo was wrong wtf
and the dev portal but I think you've done that
I stg intents is a mandatory kwarg in 2.0!!!
and also
he just didnt use 2.0 features that's why zeffo thought of 1.7.3
the weird thing is it works for my friend
and that
but not for me
intents = discord.Intents.all()
because he has 1.7.3
myabe your friend is on dpy 1.7.3
!d discord.Intents.all
classmethod all()```
A factory method that creates a [`Intents`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents "discord.Intents") with everything enabled.
why not 2.0
Why do you want to downgrade
because its pretty complicated
just enable intents and it'll work
and im just a newbie
import discord
from discord.ext import commands
from discord.ui import Button, View
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="=", intents = intents)
@bot.command()
async def hello(ctx):
button = Button(label = "Hi", style = discord.ButtonStyle.success)
view = View()
view.add_item(button)
await ctx.send("Hi", view = view)
heres the code i sent in to my friend after fixing and it worked for him but not for me
Run pip uninstall discord.py
Then python -m pip install discord.py==1.7.3
Or listen to Zeffo & Master
holy shit
it worked, the capital letters got me π
bruh
classmethod default()```
A factory method that creates a [`Intents`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents "discord.Intents") with everything enabled except [`presences`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.presences "discord.Intents.presences"), [`members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members"), and [`message_content`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.message_content "discord.Intents.message_content").
go sleep it's 3 am are u kidding
import discord
from discord.ext import commands
bot = commands.bot(command_prefix="!", intents = discord.Intents.all())
@bot.event
async def on_ready():
print("Bot is online")
bot.run("Token")
this is the error:
Traceback (most recent call last):
File "main.py", line 4, in <module>
bot = commands.bot(command_prefix="!", intents = discord.Intents.all())
TypeError: 'module' object is not callable
could someone help?
capitals
ok
of great britain
import random
from discord.ext import commands
TOKEN = 'tokem'
client = commands.Bot(comands_prefix='Poke!, poke!')
@client.event
async def on_ready():
print('{client.user} is on')
@client.command
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
kick_messages = ["Pichu used charm to kick {member.mention}", "Pikachu used thunder shock to kick {member.mention}", "Raichu used walt switch to kick {member.mention}", "Squirtle used water gun to kick {member.mention}", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}",
"Venusaur used solar beam to kick {member.mention}", "Charmander used Flame thrower to kick {member.mention}", "Charmeleon used metal claw to kick {member.mention}", "Charizard used inferno to kick {member.mention}"]
await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')
client.run(TOKEN)
bot isnt kicking
why not just await member.kick()
ok
Hey @pearl shoal! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
go reset token
import random
from discord.ext import commands
TOKEN = 'token'
client = commands.Bot(comands_prefix='Poke!, poke!')
@client.event
async def on_ready():
print('{client.user} is on')
@client.command
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await ctx.member.kick()
kick_messages = ["Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick {member.mention}", "Squirtle used water gun to kick {member.mention}", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}",
"Venusaur used solar beam to kick {member.mention}", "Charmander used Flame thrower to kick {member.mention}", "Charmeleon used metal claw to kick {member.mention}", "Charizard used inferno to kick {member.mention}"]
await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')
client.run(TOKEN)
still not working
ok
coz it's cool
you didnt call client.command
import discord
from discord.ext import commands
from discord.ui import Button, View
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="=", intents = intents)
@bot.command()
async def hello(ctx):
button = Button(label = "1", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message("one")
button.callback = button_callback
view = View()
view.add_item(button)
await ctx.send("Hi", view = view)
i want to make it so that it will response base on what button is clicked. i think i have to use 'if' if yes how do i make it if no whats the way to do it
you could subclass Button and make the response a parameter
or subclass a view
how do i subclass
you only have one button right now, so they can only click one of them
if you want to have another button, you just make an instance of Button and add a callback for that button
yea but can i make another gui with buttons will pop up after a button is clicked
yea, you just make a new view or add buttons to the existing view and send it
ok thanks ill try
@bot.command()
async def hello(ctx):
button = Button(label = "son", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message("one", view = View1(), View3())
button.callback = button_callback
view = View()
view.add_item(button)
await ctx.send(view = view)
can i make it so that it will send multiple buttons not only one
how can I read my sqlite db file?
then add another button?
can u help me?
# Create button 1
button = Button(label = "son", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message("one", view = View1(), View3())
button.callback = button_callback
# Create button 2
button2 = Button(label = "son 2", style = discord.ButtonStyle.success)
async def button2_callback(interaction):
await interaction.response.send_message("two", view = View1(), View3())
button2.callback = button2_callback
# Create view
view = View()
view.add_item(button)
view.add_item(button2)
# Send view
await ctx.send(view = view)
here is explanation in comment
I already know that, but I want something I can use to just read all contents of the file
without the use of code
programm?
you can just use the sqlite3 CLI
if you have it installed, that is
yeah
sqlite3 CLI
sqlite3 your_file.db
sqlite3 : The term 'sqlite3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ sqlite3 data.db
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (sqlite3:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Install SQLite on Windows
this section should teach you how to
oh ok i understand
maybe ill subclass button and view because i want to make it so that when a button is clicked another gui with buttons will pop up
I use MySQL Workbench
or yeah that, if you want a GUI
does... that support sqlite?
ok
super usefull
very simple question
how to make a on_message that only works if the message in in a specific channel
if a user messages "hi" in channel "chat" the bot should reply "hi" but if the user messages "hi" in the channel "chat2", the bot should not reply.
pls help
@bot.command()
async def hello(ctx):
button = Button(label = "Robux", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = View3())
button1 = Button(label = "VPS", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = View1())
button.callback = button_callback
view = View()
view.add_item(button)
view.add_item(button1)
await ctx.send(view = view)
when i click button it says that this interaction is unsuccessful but when i click button1 it leads me to view3() any way to fix?
why doesn't it work?
no slash commands in server and also it doesn't work when I execute as message command
is that in a cog?
yes
is the cog loaded?
oh, cogs should have some stuff like tree.enable or idk in them yes?
yes, 100%
can you send an ephemeral message in a different channel from the place it was interacted?
if isinstance(ctx, commands.Context):
await ctx.send(embed=embed)
elif isinstance(ctx, Interaction):
await ctx.followup.send(embed=embed, ephemeral=True)
return False
I want to send the ctx.followup.send in a different channel within the same server
whilst keeping ephemeral=True
@bot.command()
async def hello(ctx):
button = Button(label = "Robux", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = View2())
button1 = Button(label = "VPS", style = discord.ButtonStyle.success)
async def button_callback(interaction):
await interaction.response.send_message(view = View1())
button.callback = button_callback
view = View()
view.add_item(button)
view.add_item(button1)
await ctx.send(view = view)
this is my code. when i clicked the first button everything is ok but when i clicked the second button it failed
i dont think so, it works fine for me, hold on
are you running the command inside the guild you are copying to?
yes
oh wait im stupid
i have error
application_id set? waht
show the tb not the error
import discord
from discord.ext import commands
bot = discord.Client()
@bot.event
async def on_ready():
print("I am Ready")
@bot.event
async def on_message(message):
if message.author.bot:
return
channels=['counting']
id=bot.get_guild(server id)
number=1
username=str(message.author).split("#")[0]
if str(message.channel) in channels:
if message.content == number:
number=number+1
elif message.content != number:
await message.channel.send(f"{username} messed up at {number}")
number=1
bot.run(token)
i made it counting bot
and the problem is that it always shows "{username} messed up at {number}"
even if the message.content == number
PLEASE HELP
currentTime = currentDateAndTime
print(currentTime)
class Status(commands.Cog, name="Status"):
def __init__(self, bot: commands.Bot):
self.__bot = bot
self.status_list = (
nextcord.Activity(type=nextcord.ActivityType.watching, name=(currentTime.strftime("%H:%M"))),
)
self.current_status = random.randint(0, len(self.status_list) - 1)
@commands.Cog.listener()
async def on_ready(self):
print("Status cog is ready!")
self.status_loop.start()
@loop(seconds=600)
async def status_loop(self):
"""Loop to update status"""
self.current_status = (self.current_status + 1) % len(self.status_list)
await self.__bot.change_presence(activity=self.status_list[self.current_status])
def setup(bot):
bot.add_cog(Status(bot))```
How do i make it so it updates the time continuously?
define the number var outside the event as it gets set to 1 every trigger
on a side note, you can access the username using message.author.name
use a botvar to set the number var 'cause scope issues
ah ok
what do u mean by botvar?
how to make an uptime command.
If the bot is online rn,
And I run the command after 1h 12 minutes 32 seconds it should say
Iβve been up for 1h 12minutes 32 seconds
update time?
ye i want it to update time every min
do ?tag uptime in the dpy server, there's an example command
When i use {ctx.command} it sends None
!botvar
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
Someone tell me how to fix
nice
How to make it so it sends the cmd?
I am getting this error:
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\8ster\Desktop\projects\Discord Bots\Counter\main.py", line 22, in on_message
if message.content == number:
UnboundLocalError: local variable 'number' referenced before assignment```
What even ctx.command doesπ
You referred a variable before assigning it
pretty sure it should send the command that was executed
but its just sending the word None
Something like this
x + 1
x = 0 ```
^
How do i make it send the command that was used?
returns a Command object that the context is of
oh, k
it doesnt work though
Ty for this btw
Just use ctx.message.content
It will send the content the user sent
@slate swan
Message has no attribute apparently
Ignoring me π
Nvm
aaa ... I didn't do that
Great pfp btw 
can u point out my error in my code itself?
See it
I defined the variable after using it
Thankyou π
anyone?
Send your code
Till then lemme get my laptop
ping?
@slate swan
So you want to get what the user sent when the messed up?
oups it's the old code sorry
import discord
from discord.ext import commands
bot = discord.Client()
@bot.event
async def on_ready():
print("I am Ready")
number=1
@bot.event
async def on_message(message):
if message.author.bot:
return
channels=['counting']
id=bot.get_guild(_myserverid_...)
username=message.author.name
if str(message.channel) in channels:
if message.content == number:
number=number+1
elif message.content != number:
await message.channel.send(f"{username} messed up at {number}")
number=1
bot.run(token)
check this code
I defined number
then if the message is equal to the number
if message.content == number:
yes?
And you are defining number after it
no I updating number after it
you are comparing str (message.content) and int (number)
check the line after print("I am Ready")
ohhhhhhhhhhhhhhhhhhhhhhhhhh
you need to do int(message.content) or str(number)
lit me try correct it
to compare them
let*
and also there are a lot of weird thing in your code
for example this line, you don't even use that id
also why do you do if str(message.channel) in channels, why not just if message.channel.name == 'counting'
u have insert the server id in it
lol
what?
check the spellings 
hey
i need some help how do i check a users status every 3 mins?
in a event btw ^
Guys i have db connection in my setup hook for my bot . I want to use that connection in my cogs. How can I use that?
wdym by use, what are you trying to do with it?
Me?
can u help me?
you could set it as an attribute of the bot instance and then use that in the cogs
assuming your cogs have access to the bot instance
Hmmm like it's
self.bot
And i can do self.bot.connrction?
i need some help how do i check users in a server status every 3 mins?
asyncio.TimeoutError():
await ctx.send(βYou failed to respond with the keyβ)
Thanks for help
make a task and do your thing there
that's not valid syntax
you want to catch that error in a try-except?
so cbot.event
!d discord.ext.task
No documentation found for the requested symbol.
msg = await client.wait_for('message', check=check, timeout=15)
await open_account(ctx.author,ctx)
users = await get_bank_data()
earn = random.randrange(500)
if msg.content == random.choice(keys):
await ctx.send(f"Great {ctx.author}! \nYou responded with the key in 15 seconds. You got {earn}")
users[str(ctx.author.id)]["wallet"] += earn
with open("mainbank.json", 'w') as f:
json.dump(users,f)
asyncio.TimeoutError():
await ctx.send("You failed to send the key in 15 seconds, you get nothing")
```** **
my

