@unban.error
@commands.has_permissions(ban_members=True)
async def unbanerror(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
embed3 = nextcord.Embed(title="Missing User Requirement", description="**Next time mention the user or say their ID.**\nExample:\n$unban @viral verge for only telling people the rules", color = nextcord.Color.red())
await ctx.send(embed=embed3)
elif isinstance(error, commands.BadArgument):
embed2 = nextcord.Embed(title="Invalid User", description="**Next time mention the user or say their ID.**\nExample:\n$unban @viral verge for only telling people the rules", color = nextcord.Color.red())
await ctx.send(embed=embed2)
#discord-bots
1 messages · Page 953 of 1
Wym i dont get it
how could I make a dynamic menu with two buttons 'previous' and 'next' with callback, I would have to edit the webhook 10 times and it should go back and forth, how can I do this?
It keeps giving me the Invalid user ERROR
Its ok nvm you answered my question
https://mystb.in/LectureGibsonNurse.python
I am having an issue with this as it's only editing 2 buttons and not all 3, I plan on adding selects later on, so I must remove the buttons only on this and not touch the selects
for the print
<class 'discord.ui.button.Button'>
<class 'discord.ui.button.Button'>
dpy master btw
Thanks
👍🫰
I need assistance if anybody could help
doing
no?
just use the delete_after kwarg
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_messages "disnake.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
bro
Its delete_after
I would done it in a more elegant way
Let's put your roles in a tuple in ascending order
roles = (nor, hc, gm)```
Then iterate through that tuple and do a simple check
```py
for i, role in enumerate(roles):
if role in roles and role != gm:
await user.remove_roles(role)
await user.add_roles(roles[i+1])```

sorry
This should work fine without those complicated condtitions
Need urgent assistance here
!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/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
i think this might be caused by you mutating the children while iterating through it at the same time, as doing so can cause you to skip items
mutating the children
In any other context I would've died
lmao
mutating the children 💀
should i just do something like
>>> x = [1, 2, 3]
>>> for n in x:
... x.pop(x.index(n))
1 # for loop index is i=0 so 1 is popped
3 # index is now i=1, but the length changed so x[1] == 3
>>> x
[2]```
children = self.children
for child in children:
if isinstance(child, discord.ui.Button):
self.remove_item(child)
this?
no that doesnt copy the list of children
but you can store a separate list of the buttons you're planning to remove
🤔 but that's the list of children.
no, itd be a separate list
i wonder why the list of components are called children and not components
So I keep on getting that queued songs are not defined but I have them globally defined
for example py def __init__(self, ...): self.buttons = (self.secretMessage, self.dmMessage, self.denied) # when you want to remove them, iterate through this instead
this is literatetly the same thing
no it isnt, self.children is modified by the View superclass directly
so when you call remove_item while looping through children you are mutating that list at the same time
shouldn't this help with it tho?
Why the hell is it not responding???
@bot.command(help="Moderator/Admin Command")
async def unban(ctx, user: nextcord.Member=None, *, reason=None):
guild = ctx.guild
myEmbed3 = nextcord.Embed(title='User Succesfully Unbanned', description = f"**{user}** has been unbanned!")
myEmbed4 = nextcord.Embed(title=f'Unban Information for {user}', description = f"**{user.mention}** has been unbanned by Admin/Moderator: **{ctx.author.mention}** because **{reason}**")
myEmbed4.set_footer(text=f'User ID: {user.id}')
myEmbed5 = nextcord.Embed(title=f'Your Unban from {guild}', description = f"You were unbanned from {guild} because **{reason}**", timestamp = datetime.datetime.utcnow())
myEmbed5.set_footer(text=f'You were unbanned by Admin/Moderator: {ctx.author}')
if user is None:
embed3 = nextcord.Embed(title="Missing User Requirement", description="**Next time mention the user or say their ID.**\nExample:\n$unban @viral verge for only telling people the rules", color = nextcord.Color.red())
await ctx.reply(embed=embed3)
else:
if ctx.author.guild_permissions.ban_members and user is not None:
await ctx.send(embed=myEmbed3)
await guild.unban(user=user)
log_channel = bot.get_channel(879095317771997246)
await log_channel.send(embed=myEmbed4)
await user.send(embed=myEmbed5)
assigning the list to a variable doesnt copy the list object
^
i would still recommend explicitly defining which buttons you want to remove, offers more flexibility in the future
I'm having problems with my balance command, apparently it's saying that "Result" does not have attribute "execute" and I don't know where the error's happening.
it doesnt have that attr?
I don't see where it does that tho
I only want to remove buttons without needing to define them earlier
well its probably on one of the lines where you write .execute inside your balance command, but preferably you should have your handler print the traceback somewhere too
No I checked them, they all have "cursor = main.cursor()" right before them
hey, yall i have a question i have a class that isn't showing up in the help command if i don't remove it why? i can add another class and it pops up just fine
!d discord.Role.members
property members```
Returns all the members with this role.
anyone knows how to use railway hosting
what this mean
what's the recommended discord.py fork with slash commands
show code
all of the major forks have them implemented, it's entirely up to you which one you want to use as it depends on opinion
i am adding you as friend
no
will send you soon sorry got something urgent right now
send here
soon
dpy master has slash commands 🙂
use that
LOL
can you reload cogs from different computers
or from a computer that the code is not hosted on I mean
just use jsk to reload it
Got unarchived recently
GitHub
A debugging and testing cog for discord.py rewrite bots. - GitHub - Gorialis/jishaku: A debugging and testing cog for discord.py rewrite bots.
then do the following: ```
!jsk py await _bot.reload_extension("extension")
are they gonna update it then?
It has slash commands already
how to use them
wait, can I use jsk to edit code from a different computer????
idts no
:////
btw why self.loop not working in 2.0
I really want to run my code on my pc that's always on and edit it on my laptop
loop attribute cannot be accessed in non-async contexts...
you have to do ```py
async with bot: # a commands.Bot/discord.Client instance
loop = bot.loop
File "D:\Coding\DiscordBot\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Coding\Discord BOT\BOT.py", line 259, in warnings
warns = warns_check(member)
File "D:\Coding\Discord BOT\BOT.py", line 245, in warns_check
warns[str(member.id)]
KeyError: '772977714360483861'
can anyone help tell me if u need code
The traceback says it all
the string isn't in the dictionary
basically the key '772977714360483861' is not in the json file + DONT use json as a database
OH
hm
nvm i got it
@boreal ravine what is the difference between jsk and my own reload command?
So I have this embed description here how can I when it is putting all the titles have them on separate lines because right now it is putting them all on one line also is it at all possible to get rid of the [] as I also show up in the final result and don't look the best?
description=f"{[x.title for x in queued_songs]}"```
ret = await coro(*args, **kwargs)
File "D:\Coding\Discord BOT\BOT.py", line 259, in warnings
warns = warns_check(member)
File "D:\Coding\Discord BOT\BOT.py", line 245, in warns_check
warns[str(member.id)]
TypeError: 'int' object is not subscriptable
@bot.command()
@commands.has_role("Franchise Owner")
async def Promote(ctx, user: discord.Member):
guild = ctx.guild
GM = discord.utils.get(guild.roles, name="General Manager")
HC = discord.utils.get(guild.roles, name="Head Coach")
Nor = discord.utils.get(guild.roles, name="Houston Texans")
if Nor in user.roles and not HC or GM:
await user.add_roles(HC)
await ctx.send("Promoted to Head Coach!")
elif HC in user.roles:
await user.remove_roles(HC)
await user.add_roles(GM)
await ctx.send("Promoted to General Manager!")
elif GM in user.roles:
await ctx.send("Cannot go any higher than General Manager!")
``` Hey I have a problem with my code if anybody can help. When I do ~Promote @ user it promotes them to head coach and its good right, but when I do it again instead of promoting to general manager it sends "Promoted to Head coach!" again and doesnt do anything. Any help?
try moving elif HC above the first if statement
that would cause an error?
elif can only be underneath a first if statement
im quite sure
change elif to if
causes two messags to go off at once
!return
Return Statement
When calling a function, you'll often want it to give you a value back. In order to do that, you must return it. The reason for this is because functions have their own scope. Any values defined within the function body are inaccessible outside of that function.
For more information about scope, see !tags scope
Consider the following function:
def square(n):
return n*n
If we wanted to store 5 squared in a variable called x, we could do that like so:
x = square(5). x would now equal 25.
Common Mistakes
>>> def square(n):
... n*n # calculates then throws away, returns None
...
>>> x = square(5)
>>> print(x)
None
>>> def square(n):
... print(n*n) # calculates and prints, then throws away and returns None
...
>>> x = square(5)
25
>>> print(x)
None
Things to note
• print() and return do not accomplish the same thing. print() will only print the value, it will not be accessible outside of the function afterwards.
• A function will return None if it ends without reaching an explicit return statement.
• When you want to print a value calculated in a function, instead of printing inside the function, it is often better to return the value and print the function call instead.
• Official documentation for return
could you possibly implement that in the code? if not thats fine
async def main(ctx user):
if condition:
return await ctx.send("promoted to ...")
elif HC in user.roles:
return await ctx.send("promoted to general manager")
``` and so on
nope. same issue as before
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
**Hello everyone!
If you need help with command type** `!help` **to see the
command list!
Support server** `!support`
thats the format of the message if you would like to know
thanks

hi

Is there a way to add 'Bot is typing...' before it sends it's answer? One of my commands takes a few seconds to process
hello, I need my bot to grant a role when they select a button but I still can't find the code error
Button = []
@bot.command()
async def button(ctx):
await ctx.channel.send(components = [
Button(type=2, style=ButtonStyle.1, label="Button 1")
])
res = await bot.wait_for("button_click")
if res.channel == ctx.channel:
role = discord.utils.get(ctx.guild.roles, id = 960275258923970590)
await res.author.add_roles(role)
await res.respond(
type=4,
content=f"{res.component.label} has been clicked! This is button 1"
)
!d discord.ext.commands.Context.trigger_typing
await trigger_typing()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Triggers a *typing* indicator to the destination.
*Typing* indicator will go away after 10 seconds, or after a message is sent.
Thanks!
god
why use that horrible lib?
just use main if youre using dpy
pip install git+https://github.com/Rapptz/discord.py
ok
Did i do something wrong?
ae
well yes your arguments arent right
you pass me the command to see if I help you
the event only takes guilds
its a event?
?
on_guild_join is a event not a command
why even create a dm and then send a message just dm the member it will automatically make one?
Then this should be right or am I wrong?
see not a method
send a message to the server and a message to the user by dm
you missed all my point and i already know it.
?
so
await ctx.send(embed=embed)?
does the event take Context?
the answer is no
my point is to just dm the member it will automatically make one
please help me
can you tell me how to send it then?
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
check a channel and send the message lol
!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/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
is it ok for bot with 1200+ server to take more time(5 to 10 min) in start?
cringe
Not okay
I think it should take about 40-50 seconds
Wellp, it depends on your database, algorithms idk
@lethal bloom join official discord py server to check new docs with buttons mate
if you want to see examples
it's a large bot big size of the script..
what server?
official discord py server
yeah i also think so something messed up 
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by the algorithm, supposing that each elementary operation takes a fixed amount of time to perform. Thus,...
you can write a formula to your bot and find out how to short your starup
hi
According to dpy helper it's ok if big bot take time in startup ..currently bot has file: 80 | line: 22,211 | class: 92
good to hear man
use relpit or heroku
replit is not working in python
no
both r bad not recommended for bot hosting
replit has shared ips and heroku isnt for hosting bots
huh ?
so what to do
man i am currently hosting python bot on heroku
yeah but it doesnt work idk why
it ends after 10 days i guess
you could doesnt mean you should. why not use it? slow machines, etc and bad overall
its a personal bot and its fine to host small bot on platform like heroku or relpit
how much guilds and members?
1 and 1
i was having azure but it doesnt work
i mean free trial ended e
its a personal private bot, he probably wants a public one
currently using gcp for my main bot. it's nice
paid ?
yeah but its cheap and 6 month free if u r using gcp for first time
nothing in life is free
https://paste.pythondiscord.com/qenikumaye
how can i make this faster??
not bad code, dont see much := all give you props on that
can a bot use a bot?
thanks!
and how would i make an event where it listens for a message sent by bot?
!d discord.on_message
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
Checl if the message author is a bot
so example?
Hold on
!d discord.Member.bot
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
@bot.event()
async def on_message(message):
if message.author.bot:
code```
something like that or bot.event
no need for else just return
if its a cog that is so
thx
you gotta be quicker mate
another question if i set the status on my bot to be offline if i run another instance and have status online will it over ride the offline and show online?
it would probably override the status of the instance that was runned after the other instance
How do I get all the users with a specific role? like with the role unverified
and does it return a list ?
!d discord.Role.members
property members```
Returns all the members with this role.
ty
and yes the property returns a list
ok here is an example so this bot is ran with a minecraft server mod and it is marked online i want to have another session not with the same code marked offline running 24/7 so it only appers online when the minecraft server is running
so it would be users = discord.Role.members but how do i specify the role
not quite you would need to get a instance of the Role object
oh wait users = self.bot.get_role(id here)
and then userMembers = users.members?
just change the presence
that is so
kk ty
well one is in a toml file and i can't touch that
why exactly?
not a python language its a file ext
do you know how toml file works?
a bit im not quite familiar
let me get you a haste bin with code
may i have the hastebin link
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
https://paste.pythondiscord.com/emisawuvex @slate swan
I was looking through the docs to make sure i was 100% right

😔
not really
do you know where i can find docs?
looks like disnake
@slate swan because i found this file and looks kinda like it
but i have no clue
wish i could help but i have no clue sorry, never done something like that
any idea on where to get some help
maybe #❓|how-to-get-help
i din't even know if it is python all i know is it works like python with the \n thing
new line command
How can my bot get the Hex and RGB of a given color?
"Given color" how will the color be given?
like -color red
There are a lot of shades of red each with their own hex code, do you maybe want to try giving the bot an image or reference to determine it from instead? Otherwise you have a million and one possibilities
maybe try using an api that accepts names and returns hex and rgb codes
If you want to do that you can define color to hex mappings
for example, off the top of my head, red would be FF0000
green, 00FF00, blue 0000FF
(i hope that's right)
yeah you could but an api that uses a database could have way more hexcodes and color shades etc but it depends if he wants specific colors etc
i think im gonna try making an api with flask that uses a database
That's what I do. I have an API middleman for my bot that interfaces with my database. I prefer doing it in js because I like the ORMs but python would work too
ORMs?
yeah it would be better for an api to handle all the queries and strain the api server and not the bot but im just doing to learn mostly
Hey
a question how do you make a api?
I like to think of discord bots as front end. They should only fetch information, and display them. nothing else. the heavy listing should be done by the backend
i never dabbled with making APIs before but it sounds fun
object relational mappings. They let you interact with databases without writing nasty SQL queries, and present returned data in nice formats
you could use flask or js or other things but its just really done with a server that has endpoints that fetch data
horribly explained btw!
Guess i'm using flask
i'm not learning js today
flask is pretty easy

For example, you might create a record in a users table in Prisma like so:
await prisma.users.create({
first_name: "John",
last_name: "Doe",
age: 42,
occupation: "database engineer"
]);
Much easier than writing an sql query
yeah
would you have any resources for making API or just a general guide
flask docs are good
oh god
yeah just read their docs
docs my weakness
its quite easy
Though generally speaking javascript's paradigm is good for APIs
Well javascript is a multi paradigm langauge
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home() -> str:
return "hello world"
really is easy
Yes, I mean it's event-driven so good for web development
Very generally speaking of course
Sure, depends mostly on the function of the API although
you need to run the app ofc so you would need to do flask run
Like, there would be no reason to have an emitter & subscriber function or whatever, for an API that just returns random numbers
It would make sense however, to use emitters & subscribers for a chat based API
That's a fair assesment
pseudo random that is 😔 there is no real random when it comes to computers
Is there something like this in python?
did you even checked its docs💀
And I don't really think it would be worth it for me on such a small scale
No but I already know SQL so I'm too lazy
It would probably be more useful on a larger scale
pretty neat
yeah it just returns html on a local host
yeah just used it on replit cause i don't think this chromebook will like using vsc and being in class
🗿
i mostly use html templates and load them which it kinda sucks because the debugger cant detect changes on templates but this is my page not the home one its an endpoint @supple thorn
lol nope not in class but it doesn't run half bad if you enable linux and the gpu flag
i'm doing it rn
dont mind the cat
What is this error called: Converting to "float" failed for parameter "amount".
At first I thought it was ConversionError, but apparently not...
show your params
self, ctx, amount: float = 1
it failed to convert the amount so just type hint it to an int
It raises when someone inputs something thats not a number
@slate swan I did this py @bot.event async def on_message(ctx, message):
and it doesn't like ctx or message because it only takes 1 not 2 but how do i send a responce
do message.channel.send
remove ctx
oh makes sense thank you
yeah ofc it will just handle the error
Streamer?
Yeah but what is the error called?
yeah i stream myself programming sometimes!
where
which channel
Nvm I found it. Thanks!
1 day
🗿
yeah its always at the start
First day in discord. Im trying to make a discord bot. Nothing is happening in the help channels i try. Through sifting on the internet i have a basic structure but its not working properly
1 stream 1 day ago
https://vcokltfre.dev/
this can help you out!
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
voice revel
ive deleted most streams lol
😳
Thank you okimii. Ill check it out.
where the hell did you find it
Profile
find what
i just see ily in okimii's bio
I should stream some coding stuff too 😳
why don't i see that
YES
But knowing me I'd be procrastinating
andy stream i would watch for sure!
Streaming coding is useless
its fun to watch and i learn allot especially watching corey
his streams are fun to watch
i would send the link but im not because advertising!
sadge i can't see the connections
Hmmmm I won't stream, but tomorrow after work I can screenshare some coding
You can watch me code cursecord live
Where do you stream, andy?
send link andy
I'll probably screenshare in the rin discord
stream on yt!
we can just join from your rich status
Youtube is evil
Lmao, streaming coding on twitch "coding n chill"
why
you wanna stream on twitch aka the platform of simps
Because I totally want to give google all my information just so I can watch cute cat videos
you dont watch yt?
mr proton mail smh
I use a cli program for youtube
lmao
but yes its true yt takes allot of info
i was looking for domains and i keep getting ads to buy domains
make false information
ok so the bot is doing it weird py @bot.event async def on_message(message): if message.author.bot: if message == "BSG Server stopped": print('Successfull') await message.channel.send('worked') and the message matches the check why is it still failing the if check
illegal
youre comparing an object to a string
only if you're caught
let me print message and how do i make it a str?
!d discord.Message.content
The actual contents of the message.
returns a string
I'll ping you tomorrow when I start Okimii, I won't have voice on though
ping me too
but i want to hear your deep voice which is very deep!
i'll probably won't understand anything but i'll still watch
how do i use that with on_message?
message.content
on_message takes an argument which is a message object so use it
yes youre comparing a string with another string
they are not kidding "Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that Bot does not have this problem." it is good to make 2 minute spam lol
whos not kidding im so confused
His voice 😻
well yes? member.Bot returns bool and only checks if the account is a bot account
yes
How do I raise an error like this raise(commands.BadArgument) and add the arguments to it?
ik i was meaning the docs with the bot. i recommmend you never add an else to those checks lol
why would you raise an error from the wrapper?
well it depends on the situation
Actually youre right nvm lol
well any else will print and print and print if the bot sends a message to that channel that it is checking in
you could just use on_command_error which it catches all errors raised by commands
Yeah, but then it makes it difficult to tell the user whats wrong
the function has such a weird dir
!d discord.discord.ext.commands.on_command_error
discord.ext.commands.on_command_error(ctx, error)```
An error handler that is called when an error is raised inside a command either through user input error, check failure, or an error in your own code.
A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
🗿
no they would know it raises the whole exception
Yeah ikr
Thats true
you should hear my voice
I have
i know you have😳
Ahhhhh
Subclassed your help command yet?
no😔
I have all this for my on_command_error:
@commands.Cog.listener()
async def on_command_error(self, ctx: commands.Context, error: commands.CommandError):
await ctx.trigger_typing()
if isinstance(error, commands.CommandNotFound): # CommandNotFound
return
elif isinstance(error, commands.CommandOnCooldown): # CommandOnCooldown
errorName = "Command Cooldown"
errorMessage = f"Try again in {round(error.retry_after, 1)} seconds."
elif isinstance(error, commands.MissingRequiredArgument): # MissingRequiredArgument
errorName = "Missing Argument"
errorMessage = f"Argument `<{error.param}>` is missing."
elif isinstance(error, commands.BadArgument): # BadArgument
params = error.args[0].split('"')
errorName = "Invalid Argument"
errorMessage = f"Argument `<{params[3]}>` is invalid."
else: # Unexpected
errorName = "Unknown Error"
errorMessage = "An unexpected error occured."
warn(f"[!] {error}")
errorEmbed = discord.Embed(title = errorName, description = errorMessage, color = 0xff0000)
await ctx.reply(embed = errorEmbed, mention_author = False, delete_after = 10)
await ctx.message.delete(delay = 10)
let me change the title to CommandError
Get to it Mr
never
Check my message in akeno 🗿
i did
@pliant gulch You around? I'm curious about the advice you gave me yesterday
class Database:
def __init__(self, client: AsyncIOMotorClient):
self.client = client
async def find_one(self, collection: str, **params):
return await self.client['discordbot'][collection].find_one(params)
I made this class so that I could have my MotorClient as a class with it's own methods so I didn't have to copy and paste the same line around everywhere to search through my DB.
I've added find_one, update_one, and find as methods for this class. However, if I wanted to just use one of the basic methods from the MotorClient itself, I can't anymore because I've made the client a Database object. Would I have to make all of the client methods into class methods?
For example, I can no longer do this
await self.bot.mongo_client['discordbot']['users'].update_many({}, {"$set": {str(field): value}})
because self.bot.mongo_client is now a Database object and doesn't have .update_many()
Whereas the regular motor client does have it. Would I just make a second instance of the client that's not a Database object? I don't know if that's a good idea..
my thing finally works. Holy input praise the lord it works.
youre trying to access methods from a super class? not sure what you meant tbh
thats nice!
Before I was running lines of code like this to access my DB:
await self.bot.mongo_client['discordbot']['users'].update_many({}, {"$set": {str(field): value}})
But it was a pain to have to put in
self.bot.mongo_client['discordbot']['users']
every time I had to access the db
So I wanted to do something like
db = self.bot.mongo_client['discordbot']['users']
but andy suggested I make a database class for that
self.bot.mongo_client.client["discordbot"]["users"].update_many(...)
yes its a good idea
I see...
So for one off lines that won't be replicated often I just do that
but for everything else, I should make class methods?
why would you have a classmethod to return a db object?
I'm not the best at python, but here's what I've got so far
class Database:
def __init__(self, client: AsyncIOMotorClient):
self.client = client
async def find_one(self, collection: str, **params):
return await self.client['discordbot'][collection].find_one(params)
async def update_one(self, collection: str, search_key, search_value, mode, **params):
return await self.client['discordbot'][collection].update_one({search_key: search_value}, {mode: params})
async def find(self, collection: str, value: str, sort_order, limit: int):
if sort_order == "descending":
return self.client['discordbot'][collection].find().sort(value, pymongo.DESCENDING).limit(limit)
elif sort_order == "ascending":
return self.client['discordbot'][collection].find().sort(value, pymongo.ASCENDING).limit(limit)
This is my Database class, and I have that because I use those often
ok
It's been a bit of a hassle tbh
Cause like these are basically the default MotorClient methods, I just have them as class methods so I don't have to type the ['discordbots']['users'] every time. Should I be doing something different?
At the end of the day, I want to code efficiently
does arent classmethods?
i see no classmethods in your Database class
I'm probably using the wrong word
yeah because classmethods is a method that affects the class and not instances
I'm just a freshman in college, I've been teaching myself python
I see. Then those would just be methods?
im a freshmen in highschool lol
instances that are bound to a class instance
Either way. Is what I'm doing efficient?
youre making a database object that has methods that are customized for your use?
I don't see anything inherently wrong with it.
Just so I don't have to keep writing ['discordbots']['users'] every time
ah
I'd rather just store that as a variable
Instead of making an entire class for it
I meant methods for common operations
If I have code that runs a simple game and I update a value in the database many times, should I just use the basic method that comes with the Client?
Because those can get quite lengthy
What basic methods are we talking about?
Sorry for my terminology
But stuff like this
await self.bot.mongo_client['discordbot']['users'].update_many({}, {"$set": {str(field): value}})
Ah. I'm guessing you made mongo_client a bot var yourself?
You could make a low-level method as well
yes
async def main():
with open('./data.json', 'r') as file:
data = json.load(file)
async def hook():
bot.mongo_client = Database(AsyncIOMotorClient(data['mongo_url']))
bot.setup_hook = hook
class Foo:
db: AsyncIOMotorClient
async def query(self, col: str, function: str, **kwargs: Any) -> None:
function = getattr(self.db[col], function)
await function(kwargs)
```some pseudo-code
Why not override setup_hook instead of nesting it?
Would basically mean, ```py
await Foo().query("users", "update_many", foo=bar)
Actually, that doesn't make it much better
Not sure, that was recommended to me to solve my problem, I'm still new to code.
And yeah, I see you made a custom class wrapping motor
Probably shouldn't do that
Well, it works but not the best solution. "Flat is better than nested". Subclass commands.Bot, if you haven't already, and override setup_hook
Issue is the **kwargs thing. I would have a hard time figuring out how to query the database with parameters
Hell, if you only want to just shorten accessing the column couldn't you just do bot.mongo_client = AsyncIOMotorClient["discordbot"]?
Not working code^
await self.bot.mongo_client['discordbot']['users'].update_many({}, {"$set": {str(field): value}})
in this, it's much easier for me to write out {"$set": {str(field): value}} than it is for me to try and do that with parameters
Probably, I was thinking about that too
the setup_hook code that's in those files in my module?
Like I can edit them but it asks me if I really want to first lol
you could just make an instance of a class and you just pass the indexes to the params of the class and you can just use them in every method
Oh no no
class MyBot(commands.Bot):
def __init__(...):
...
async def setup_hook(...):
...
You can move everything from your main() to there
Including
with open('./data.json', 'r') as file:
data = json.load(file)
Ahh I'm such a noob still. I also have code for checking / reloading cogs in my main file. That's probably a bad thing isn't it.
Nah. Nothing really wrong with that
I see most open source bots have really small main.py files
Actually, one could argue putting critical functionality like cog reload unloading in your main file is a better way to organize thing
I figured I can't reload Cogs if the code to do so is in a Cog
Hence the checking?
To make sure the cog that unloads reloads other cogs isn't unloaded
Yeah lol. Not sure what other option there is
Move that out of an extension, that way it can't be unloaded or reloaded
I'm basically just lookin for the easiest way to query my database without having long long lines of code like this
user_in_database = await self.bot.mongo_client['discordbot']['users'].find_one({"_id": ctx.author.id})```
Does all of your queries have the discordbot users part?
And they get even longer when using stuff like ['update_many']
For the most part yes. I only use one database and one whatever you call it. Collection?
Hm. You could just put that in a variable, I'm sure you've thought of that already
x.find_one(...)
Yeah. However, I tried putting the whole ```py
await self.bot.mongo_client['discordbot']['users']
in a variable, and it said that a coroutine object doesn't have attribute `find_one()`
Maybe that's a me issue
So I wouldn't put await in the variable?
No
And then I would just do await x.find_one(...)
You got it
I'll try it. Then I wouldn't need this entire Database class
Where would I put that variable? If it's in a Cog let's say
I wouldn't put it in each command, right?
Best to bind it to your bot instance
Ah, in the main file?
Right
self.bot.x.find_many()
Still kind of long but better than before
If you want to shorten it even more you could create a custom context and do it that way
ctx.db.find_many()
Yes. The ctx provided to you on commands can be modified to your liking
Where would I modify that?
https://github.com/Rapptz/discord.py/blob/master/examples/custom_context.py take a look at this
!d discord.Role.members
property members```
Returns all the members with this role.
What's up?
Well, what are you trying to do?
That's the best way to do it, better learn
Oh. Yeah, just use that property then
Tutorials on reading docs... can't think of any. It's a skill you pick up as you go
!e
class D:
def __init__(self, *indexes: tuple[int, int]) -> None:
self.index0, self.index1 = indexes
def get_data(self) -> int:
return {1: {2: 3}}[self.index0][self.index1]
print(D(1, 2).get_data())
@abstract kindle is this how you would like your class to be or what exactly would you like?
@slate swan :white_check_mark: Your eval job has completed with return code 0.
3
Interesting. So it would look like
class MyContext(commands.Context):
self.x = bot.mongo_client['discordbot']['users']
and then I just set my bot to use this context instead?
Not quite. You need functions
No offense to you, but memorizing is one of the worst ways to learn
Mm. Also would this overwrite the normal ctx? cause that is something I use often..
It adds on to it, yes
Oh cool!
@sick birch If I was to just go with the self.bot.x.find_one(...) route, would I put the assignment for that variable under the hook() thing I had?
I don't want to overcomplicate things too soon for myself, I find that it adds multiple hours of coding and trying to figure out what I did wrong and I never get what I initially planned to done.
The same concept yes, but move it into the subclass
ok, so i got my bot to work. I want it to be able to take links as input from messages. I see solutions for how to scan if there IS a link in a message. But i want to be able to take those links from messages and store them in a variable for further use. Any thoughts?
Does that subclass go in main? Do people usually put it there? or would they have it in a class library file?
Or did I make up class library files lmao
It can go in main. It makes sense to put it in main anyway
Probably under imports like that example showed
If you want to, however, you can have a bot.py file containing the subclass. In main.py, import the subclass, instantiate it, and run it
That way your main file will be around 3 or 4 lines
That includes all of my Cog reloading stuff too?
My bot being able to take entire links and only the links from messages is the most crucial part of it.
Okay
I suggest looking into regexes and matching
hm , whats the methods/properties and how do i use them?
The re library, and specifically the match() function
You need to learn regex generally first I'd say
Nah. Here's one to match links: http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+
So uh. Where do i start with that?
Hell
Thank me later for saving you the pain of learning regex
I wouldn't wish it on my worst enemy
but you wish it on me
Did I?
yes😔
Oh. My sincerest apologies 😦
can you gave a small coding sample of how it would fit into some code? Im still baby cheeks new at this…
all good
@verbal breach if you just need to extract link use the pattern @sick birch sent, if you would want to learn about regex more, you can use this resource https://www.w3schools.com/python/python_regex.asp
What's so bad about it
i personally use it sometimes but its not a good source at all
w3 schools is iffy, the official docs are better if you can stomach it https://docs.python.org/3/library/re.html
yes
first time w3 helped with it’s example.
When I was learning regex I went to official docs first too and didn't understand a single thing so uh preference
anyone know hot to do slash commands or just commands with sapces?
Not possible
It's not possible to have commands with spaces in them. Unless you're talking about groups or subcommands
cuz i cant send here
Unless you do a bunch of subcommands but that would be weird
Why not?
its an image
Still should be able to send images here
However message and user commands names can contain spaces
That's a subcommand
oh
@client.event
async def on_message(message):
txt = message.content
x = re.search("http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", txt)
link = (requests.get(x).text)
how to do?
is this code viable?
puggin’
whirl?
I don't remember certainly but I think you need to do x.match() to get the actual string
try it
I might be confusing it so try it out by yourself
that's what "give it a whirl" mean
what how to do sub commands iwht discord.py
thanks for helping me out Robin
And yeah don't use requests in an async application, you can use aiohttp
so how to do sub commands with spaces?
!d discord.ext.commands.Bot.group
@group(*args, **kwargs)```
A shortcut decorator that invokes [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.group "discord.ext.commands.group") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
Do I literally just replace requests with aiohttp or do i have to do more.
A bit of more
@client.command()
async def help_moderation(ctx):
see i want to get rid of the underscore
ill try requests anyway
Check the client quickstart in their docs, I think you will get what you need to change
i just have to attach my existing program to it.
so how to get rid of underscore?
i hope my ipad doesnt explode in my face.
nice
Make a help command group and make moderarion its subcommand
how to do that?
Although you'd better sublcass the help
how to make a sub command?
idk how to explain it but is it possible to make the emoji the thumbnail?
like this
searched everywhere just for you
copy the url of the emoji
its not 1 role
"just for you"
theres multiple roles
@bot.group()
async def git(ctx):
if ctx.invoked_subcommand is None:
await ctx.send('Invalid git command passed...')
@git.command()
async def push(ctx, remote: str, branch: str):
await ctx.send('Pushing to {} {}'.format(remote, branch))
this?
huh?
well yes
that is an example
still dont get it
?
embed.set_thumbnail(url=emoji.url)```
Basically
If I understand correctly, each role has a linked emoji or smth
!d discord.Emoji.url
property url```
Returns the URL of the emoji.
ic
Forgor that url is a kwarg
theres like 8 different teams and each team has a different emoji to it
so i want the thumbnail to be the emoji i put
so i do
@client.group()
async def help(ctx):
pass
@git.command()
async def moderation(ctx):
pass
like that right?
HOLY [curse word] IT WORKS! I think?
no
then?
i have to test it first
since your command is named help it's @help.command()
also i suggest looking into subclassing help
https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96
k
Store them in key-value structure or a database if you know how to and get emoji id based on role id
nope doesnt work. I guess i do need aiohttp
whats the issue?
how do i make it so when a specific user talks it gives them a role
use the on_message event and fetch/get the role and assign the messager the role
TypeError: on message () takes O positional arguments but 1
was given
show your on_message constructor
All of them dont have anything in () though but ok
elif isinstance(error, Unregistered):
channel = self.bot.get_channel(ctx.channel)
await ctx.send(f"You must be registered to use this command. Register in {channel.mention}")
elif isinstance(error, discord.ext.commands.errors.CheckFailure):
print(f"User {ctx.author.name} brought up {error} with the command {ctx.command}.")
How come my error handler is defaulting to the bottom one
bottom one?
def registered():
async def predicate(ctx):
result = await ctx.bot.db.find_one({"_id": ctx.author.id})
if result is None:
raise Unregistered("Not registered!")
return True
return commands.check(predicate)
The bottom isinstance
async def on_message():
txt = message.content
x = re.search("http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", txt)
link = (requests.get(x).text)
def runAlg():
everything below that is the defined algorithm for my thing
Well, not EVRYTHING but you know what i mean.
the event takes a message argument which acts as a discord.Message object
but it says 0 arguments are needed….
and defining a function every message is a waste of resources, and making it synchronous....?
read the error again
TypeError: on message () takes O positional arguments but 1
was given
takes 0 positional arguments u
But one was giving
async def on_message(message):
...```
!d discord.on_message
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
pass an argument to the on_message function
like on_message(message)?
yes
I'm very confused. For some commands, an unregistered user brings up my Unregistered error, and other times, it just brings up the CheckFailure error
can you show what Unregistered is?
class Unregistered(commands.CheckFailure):
pass
Some commands it works, some it doesn't
well
For example this command:
@in_game()
@registered()
@commands.command(aliases=["hl", "highlow"])
async def high_low(self, ctx, bet: int):
...
Brings up the error properly.
@registered()
@commands.command()
async def beg(self, ctx):
...
This one brings up CheckFailure
indentation is right tho
all i have to do is check all paths and i should be….relativly good
i think that the order is wrong
uh sorry, so i can ask something about discord bot development here?
yes, but the return value of one decorator is passed into the other
Interesting...
Because with my command with in_game() and registered(), both of them work
but with the other one, it doesn't
yeah the return type of one deco gets passed to the other
!e ```py
def foo(obj):
print(obj)
def bar(func):
print(func)
return "Hello world"
@foo
@bar
def test():
pass```
@lament mesa :white_check_mark: Your eval job has completed with return code 0.
001 | <function test at 0x7f985cce4ca0>
002 | Hello world
the string "Hello world" has been passed into foo
never understood decorators
How come it works for this then?
@in_game()
@registered()
@commands.command(aliases=["hl", "highlow"])
async def high_low(self, ctx, bet: int):
...
just function wrappers
i know that
hmm
Im making a discord music bot, from this tutorial https://www.youtube.com/watch?v=jHZlvRr9KxM
TODAY we’re making a budget Rythm as easily as possible. Enjoy!
Thanks (for non copyright music):
🍪 Soundcloud : https://soundcloud.com/lukrembo
⭐️ Twitter : https://twitter.com/LuKremBo
😀 Instagram : https://www.instagram.com/lukrembo
✉️ Email : Lukrembo@gmail.com
----------------...
!ytdl cant help
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
normally the check decorators come first
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/infraction/infractions.py#L185-L186
bot/exts/moderation/infraction/infractions.py lines 185 to 186
@command(aliases=["mute"])
@ensure_future_timestamp(timestamp_arg=3)```
dunno if that changed in v2.0
just functions that wrap other functions which they change the decorated functions behaviour which they get executed from bottom to top
the last version i used is 1.7
Yeah, I thought they came first
wdym
I just updated to 2.0, but I still had this issue in 1.7
Uhh i know but nvm i barely used decorators in any of my programs
hey
Even if I switch the order it still doesn't work
am back
ytdl breaks youtube's TOS
can someone help with the subcommands
await outside of asyn function
which if you break a platforms tos on discord youre breaking their tos
So i need to use what?
you cant await a coroutine outside of one
This tutorial is so bad
^
he doesn't even explain what the code does
This is so wierd
if it works it works™️
who needs an explanation? \s
like any tutorial
yeah, im just copying
idk if you can
alright so big brain i just deleted the
I'm so confused as to why the Error handler works for commands in one file only
await
i forgot that rythm down cuz of youtube
hmm, try implementing the logic of both of those decorators in one
thats true, why waste time for explanation when you can get the code
yes yes
but still, he isthe only one other than carberra i found to be using mongoDB for levelling purposes
me :
imagine refactoring and optimizing code
just kidding, learning new code is cool
But like, the decorators work fine for one command
no
For one command, they bring up Unregistered as the error
and for another, they bring up CheckFailure and CheckFailure sends the error Not registered
def registered():
async def predicate(ctx):
result = await ctx.bot.db.find_one({"_id": ctx.author.id})
if result is None:
raise Unregistered("Not registered!")
return True
return commands.check(predicate)
new code isnt a thing, its all the same thing but at a different level
Like that's what this does... but it's bringing up CheckFailure and not Unregistered
Ah, well, it doesnt work…..
I put in a link. Send message. No errors pop up in bot. But nothing happens either….
Ran the debugger. It looks like it goes to
elif isinstance(error, Unregistered):
...
and then it jumps down to
elif isinstance(error, commands.CheckFailure):
...
So wierd
both elif statements are executing?
No. It goes from the top one and jumps to the bottom one
In the command where it does work, it executes the top one and doesn't go down
this is what im trying to run. But instead of doing printing things in the console. It messages discord as output
wtf is this
it scans videos if they’re rick rolls or not.
thats what ive been trying to do with my bot this entire time.
Oh no I was saying wtf to my errors
ill make another bot in the process while i virtually beat tf out of other bot for not working properly.
Screw you…..my…bot
Are you trying to check if their level is higher than 60 or 70?
Higher than 60 and lower than 70?
Okay
elif lvl_end > 60 and level_end < 70:
...
It should be like this then
if lvl_end > 60 and lvl_end < 70:
...
FUCK
lmao
lol
lmao
I swear I was typing with one hand
if lvl_end in range(60, 70): ...

ugh
Okimii coming here beating us with their code
I'll just leave until okimii leaves

bingo
go sleep
i dont know how to store variables online yet though…
i need to shower i have no life
Tetris, 2048, Candy Crush
I literally cant do anything with a visual ui. Only text
2d multiplayer game
even then. I kinda need to learn
better get to learning how to subclass View
You can make a game with multiple choices and endings with only text
That's easy to code but takes a shit ton of time
that's not what they were talking about
i need to first figure out
just do it then, most games on discord are text based (maybe some images included) anyway
he said he couldn't do anything with stuff related to uis a game with no ui seems boring
if your (user) show data for this user
I just need to know how to get a bot to store information for anyone who plays it. And shows only THEIR data for when that user gets on.
still, not what they were talking about visual ui != ui.View
use a database
hes making a discord bot bro what else would you use🗿
what if……lets say i have x = 10 for the most basic example. But everytime the bot runs again….it
theres nothing to set variable again.
it only changes what already exists.
would it still revert to x equalling 10?
pardon?
can i get an example on what you mean exactly
i dont know how to explain any further
do you mean on each runtime a variable has a value that will always reset?
!e
x = 10
print(x)
x = 5
print(x)
you cant revert it back ig
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 10
002 | 5
really depends on the scope of the variable
if that is what you meant
yeah that too
the exact opposite actually. It originally sets a user’s variables to whatever it
Itll be in the beginning. But after that. It doesnt reset whenever its run
a database.
ok so…..i just have to make one…
yes
is this it?
sorry but, discord.js is a discord api wrapper for javascript
so….what do i do.
use a database...
where…
https://www.tutorialspoint.com/sqlite/sqlite_python.htm SQL's Database
https://www.mongodb.com/basics/mongodb-atlas-tutorial Json-Based Cloud Database
https://www.postgresqltutorial.com/ - SQL's Database
Time to start cramming knoledge…
you can choose any of those
I prefer learning SQL since its really helpful
okay so im trying to verify my bot and it says i need a All apps must have a Terms of Service. Add one here. is what it says .
you need to have tos for your bot
uhhh….ill stick with a normal server bot for now 🤯
but like on where .
probably in the applications info
it takes me to this tho
yeah?
you have to create a webpage listing your bot's TOS and host it somewhere
sighs alright
so um i wanna make my bot play an audio
it is what it is, you gotta do what you gotta do 😔
lmao
!d discord.FFmpegPCMAudio you could use this
class discord.FFmpegPCMAudio(source, *, executable='ffmpeg', pipe=False, stderr=None, before_options=None, options=None)```
An audio source from FFmpeg (or AVConv).
This launches a sub-process to a specific input file given.
Warning
You must have the ffmpeg or avconv executable in your path environment variable in order for this to work.
https://stackoverflow.com/questions/63036753/discord-py-bot-how-to-play-audio-from-local-files this is pretty much what you would want
Stack Overflow
Basically the title. I installed ffmpeg and discord.py[audio] already. I just need to learn how it works. couldn't find any tutorial for local audio files. and I cant understand anything from
um so it like plays an audio from my bot files?
yeah...
depends if they are using replit....?
um how do i find the location of the audio from a repl ;-;?
me = dumb
just like normal paths
ah ic
yeah
idk why my repl.it logs me out every time ;-;
yea
its hard to use repl.it on phone
desktop
cogs/
events.py
moderation.py
ext/
uwu.mp3
new.mp3
bot.py
./ext/uwu.mp3 will be the path here
nah
lmao uwu/mp3
btw how do i download
||never gonna give u ☝️ put by sir rick astley||
isnt that illegal?
breaks youtube tos 🤷
it depends what you do with the downloaded video
it could possibly be illegal
ill just play rick roll 24/7 in my server lol
technically, the creator could sue for loss of earnings
since you're downloading there video which leads to less watch time etc..
i dont think anyone gonna hear to rick roll for that long
your bot wouldnt be online 24/7 with replit
yeah ik but i am using stuff
stuff
idk why do ppl use uptime robo
uptimerobot
when they can self host
everybody cant self-host
they don't wanna burn there pc


