#discord-bots
1 messages · Page 613 of 1
Not really🤷♂️
so what should be the first thing i do?
you couldn't be any more wrong
I suggest learning about dpy first
and python itself
unfortunately that is not what i am looking for. thank you though!
Unfortunately if you dont you will not be able to know or code your bot!
I'm very confused on what you want.
i wish to intergrate a github command into the bot. thats all.
Ctrl c and ctrl v
like what will you even code without knowledge of the language
ctrl c and v what and where to exactly?
thats why we need to know the language
Like the git console?
idk man, kids these days want everything done for them without them actually even learning what they need to know in order to do it themselves
Learn python first 
I recommend getting this -> https://desktop.github.com
😔
a person doesn't learn an entire language to become a native speaker just to learn how to say "bless you"
They dont understand good things come with struggle
i just wish to do a simple thing, thats all
ikr
sure
Who talking about that
no but they learn at least the basics
never said you need to get a master degree of python
^^
Could you guys please stop arguing and calling him out?
Ik this is rlly simple lol but for some reason i cant get what im doin wrong ive done images with embeds never regular thats y im lost
You have to know everyone here doesnt know python completely but are very good and knowledgeable of it
So I put everything in db.put() correctly and user outside the curly brackets but in the function but it shows bad request error can you help?
it's ok, my request is a little orthodox after all. i'll just do step by step whatever you guys tell me to do. the github download is almost done
You cant learn pyhon completly
i suggest a quick read of this
show the code
data.put({"name":username,"time":time,"quote":message},user)```
You can also download just git but it's not really user friendly.
oh well
either way you still have to log in.
what is user
i'll assume its just clone a rep
tbh i sometimes can't help it, i don't usually go out of my way to call them out and shit, i just don't help and ignore them
convert it to a string and try
auth failed 
Same i dont call out anybody i just suggest it for a better general experience
what should i do here exactly? can't clone
same 😂
How do you mean can't clone?
i dont see a way to help this person, this server is about the people who are learning python, what she wants is "learning discord.py" now how do we help her with it?
Me seeing the basic syntax errors like: 
You could tell me step by step on how to intergrate it? okimii said it was just a copy paste so it would be possible to just show me where to paste it?
That seems to work but my command to show quote doesn't here is the code
@client.command()
async def showquote(ctx, discord_id:int=None):
res = data.get(discord_id)
embed= discord.Embed(title="Quotes", color=0x00FFFF)
for item in res.items:
yes2 = item["time"]
yes1 = item["name"]
yes3 = item["quote"]
embed.add_field(name=f"{yes2}", value=f"Quote by:{yes1}\nQuote:{yes3}", inline=True)
await ctx.send(embed=embed)
You have to learn python first......
Says Authentication Failed
by ignoring and moving on tbh, let the people that wanna help people like that help, at least that's what i do, it's easier to just ignore and not bother with it
thats not learning python which i think this server is all about
Gives me "quote_from_bytes() expected bytes" error
I think you do need to login, sorry.
weren't you supposed to install git
git is used from the command line
i'm just following instructions. i was sent this link
which link 🤔
you typehinted it to int and discord.py converted it to int and i said to convert it to str
Im not calling anyone out. I do read that frequently to remind myself of the beliefs of the community. I remember coming in here the first time being fully aware of my deficiencies in the language and intimidated by the sheer knowledge this server's members contain. 😅 || still intimidated, tbh lmao||
how to make cooldown reset on command groups?
oh
i've never used that personally
i always use the CLI
how do i make cooldown reset on group command```py
@cryptomine.command(aliases = ["i"])
@commands.cooldown(1,150,commands.BucketType.user)
async def idle(ctx)
await ctx.reply(embed = buyem)
idle.reset_cooldown(ctx)
Is Atom good?
or how do i do that
for the copy pasting
Your IDE has nothing to do with cloning.
yes, lets just do that
Agree
^^
Yeah sorry fixed that now it gives that "builtin_function_or_method object is not iterable" error
Do i start copying from here?
@client.command()
async def showquote(ctx, discord_id:str=None):
res = data.get(discord_id)
embed= discord.Embed(title="Quotes", color=0x00FFFF)
for item in res.items:
yes2 = item["time"]
yes1 = item["name"]
yes3 = item["quote"]
embed.add_field(name=f"{yes2}", value=f"Quote by:{yes1}\nQuote:{yes3}", inline=True)
await ctx.send(embed=embed)
hi everyone. friendly reminder that no one here is ever obligated to help. unless you are willing to invest the time to help someone, please refrain from commenting at all with any disparaging messages. please read this for a primer on expectations for what help should look like in this community: https://www.pythondiscord.com/pages/guides/pydis-guides/helping-others/
The staff's take on how to help others in our community.
items is a dict method you have to call it
are you trying to install discord.py?
i was told that i should copy paste from github to my dpy
so i'm just trying to figure out which parts to copy
How can i set a timeout for my wait_for?
Wouldn't data.get() do that?
okay, so its a package and comes with a prebuild. You can follow set instructions in the docs that will help you get everything you need installed (i would explain it myself but it would get extremely confusing real quick 😂 ) let me get the exact link for you 😄
Sure thank you very much!
it will give you the dict and it did its job. what you're doing is using a method with it (items), where you didnt call the method
mhm, we already came to that conclusion ¯_(ツ)_/¯
^^ help
https://discordpy.readthedocs.io/en/stable/intro.html
Also as far as code editors Atom works, There is also PyCharm and Visual Studio Code (VSCode) for short. I personally prefer VSCode.
ctx.command.reset_cooldown(ctx)
But I did set a variable for data.get() as res so I'm confused
thank you very much! Altough i have to admit i sort of don't understand what's being said, sorry. Am i supposed to type
"python3 -m pip install -U discord.py" in bot.py?
explain
like this? : idle.cryptomine.reset_cooldown(ctx)?
!e
d = dict(hello='world')
print(d) # deta gave you this
print(d.items) # this is something you do not deta. items is a method and you have to call it.
print(d.items())```
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
001 | {'hello': 'world'}
002 | <built-in method items of dict object at 0x7f914b426a40>
003 | dict_items([('hello', 'world')])
Yes you need to use CMD for this.
No in cmd
whilst the pip install discord.py is correct, i will tell you to rename that file, because it can conflict with commands.Bot and solving naming conflicts can be super annoying
ctx.command will return you the Command object, which has the method reset_cooldown which takes in a Context object as the parameter, it's literally in the docs
time2 = datetime.now().strftime("%p") how can i find days?
what does python3 -m pip install -U discord.py do in the first place? i'd like to know what im doing before typing anything in cmd
!d discord.ext.commands.Command.reset_cooldown
reset_cooldown(ctx)```
Resets the cooldown on this command.
is days %d
i'll try to rename it but i fear it will cause a conflict somewhere else
It won't unless you explicitly capitalize it iirc
so i haven't touched any of the parts i was given
A quick reference for Python's strftime formatting directives.
python3 > start python
-m > start a module
pip > python package install tool/module
install > install a package
-U > update if already installed
discord.py > package to install
how can i subtract 30 days from today?
i see. it did not like that
assuming you use datetime, you can subtract a timedelta from a datetime object
How can i set a timeout for my wait_for reaction_add?
!d datetime.timedelta
on windows it's just python, or py
class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to `0`. Arguments may be integers or floats, and may be positive or negative.
Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
from datetutil.relativedelta import relativedelta
from datetime import datetime
now = datetime.now()
subtracted = now - relativedelta(days=30) # You can also do months=1 instead
Omg I feel so dumb now but just one more thing it says tuple indices must be integers or slices not str on the time I have stored how do I show that
thanks ill try that out
oh god
lot of things happened
that can work with premium_since right
that just gives you a datetime object
member.premium_since(subtracted)
no
You have it already
you successfully installed it
again you have to show the code
nice :)
so now that we got python, what should the next step be?
Dpy*
uhhh yeah that
so you have python and discord.py, do you have a code editor?
@client.command()
async def showquote(ctx, discord_id:int=None):
res = data.get(discord_id)
embed= discord.Embed(title="Quotes", color=0x00FFFF)
for item in res.items():
yes2 = item["time"]
yes1 = item["name"]
yes3 = item["quote"]
embed.add_field(name=f"{yes2}", value=f"Quote by:{yes1}\nQuote:{yes3}", inline=True)
await ctx.send(embed=embed)
Got atom and Notepad++. i'm more comfortable in N++
then should i do member.premium_since(now - relativedelta(days=30))?
member.premium_since is a property which is of type datetime, so you that's what you subtract the days
@slate swan a full bot tutorial https://vcokltfre.dev/
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.
Does this cover how to do a remind me function?
oh wow N++ i don't think i've ever used that 😂
Yes it gives you the knowledge
member.premium_since - relativedelta(days=30)
oh i'll check it out then!
OHHHH
that makes more sense
cant seem to see it
Its for knowledge*
!e
x = dict(one=1, two=2)
print(x.items())
for y in x:
print(x[y])```
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
oh sorry thats not what i'm looking for right now. i'll check it out at a later time though!
why not use .items
@slate swan do you want to learn dpy or do you just want to get spoobfeeded?
If there was a tutorial on how to do a remind me function, i'll gladly learn with that
theyre using it the wrong way
!e ```py
x = dict(one=1, two=2)
for key, value in x.items():
print(f'the key is: {key}\nthe value is: {value}\n\n\n')
Uhh this is something new I just saw it's overwriting the data like it's not making new field just writing on the data that was already there it makes new fields for others but if you have a new quote to add it would just overlap the last one
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | the key is: one
002 | the value is: 1
003 |
004 |
005 |
006 | the key is: two
007 | the value is: 2
💀
actually i found one i'll check this one out
https://www.youtube.com/watch?v=tQvzuVQPNyQ
In this video of Discord.py Advanced, I will teach you how to make a remind command.
Make sure to join the Discord if you need help with anything Discord.py related! https://discord.gg/N9Hdcz6r5W
Function code:
def convert(time):
pos = ['s', 'm', 'h', 'd']
time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600*24}
unit = time[-1]
if unit no...
idk if youre sharing information or problem
Ok so in the database on the website it's overwriting the already written quote by me instead of making another field and saving it there
Code:
data.put({"name":username,"time":time,"quote":message},user)
what youre looking for then is a list of dict
Yeah
The Deta library is the easiest way to store and retrieve data from your Deta Base. Currently, we support JavaScript (Node + Browser), Python 3 and Go. Drop us a line if you want us to support your favorite language.
it should append to a list
so with this py if member.premium_since - relativedelta(days=31): i can check if someones been boosting for over a month right? or do i have to do something to see if theyve been boosting for less than a month
instead of going through all this pain, you could keep the dict like this,
{unix_time:{}, unix_time_2:{}}```
and limit the command to be used once in a sec
using cooldowns
409 error and for displaying it just shows the same error "quote_from_bytes() expected bytes" here is the code
for item in res.items():
yes2=res[item]["time]
print(yes2)```
items() returns a list of tuple, each tuple's first value is the key and second value is the value of the key
item is (key, value)
any way to see what the cmd window says on an unsuccessful bot bootup?
^
closes too quickly for me to read
run in the terminal/cmd
how can i run a py through cmd? i always just clicked on it to run it
cd to the path, then py bot.py
cd? i thought you meant just copy paste the path
> cd path/to/the/folder
> py bot.py```
cant really read that
I have a variable How can I get that variable somewhere else?
Example:
while True:
if lol:
msg = await ctx.send("this is a test")
elif lel:
await msg.delete()```
set it as an sttribute of the Bot instance
think it doesnt like how one of my folder is .pics
okay this is the solution to the extreme dumb ones,
click that and type cmd then hit enter
How/where can I do that?
what is your Bot instance called
thank you very very much! i'm in now
now type py bot.py
I'm sorry I'm still confused I put a variable for data.get as res then I did a for loop for key and value in res.items() but it shows the same error "quote_from_bytes() expected bytes"
bot.name = ''
print(bot.name)```
its an error from the code that you couldnt see, hence i succeeded
Yeah I put dict as data.get(dict(discord_id)) still doesn't work
yes! thank you very much
idk how else to help you, im feeling like im doing the code of your bot, you should lookup the stuff you dont understand now because i have explained what i needed to
wait is that seriously the problem
sets the attribute name
So what do I put in the ''
thats the value of the attribute, put what you want it to give you when you use it?
Can you give me an example with this ^
I need a name for a bot
which variable
msg
Does that really relate to discord bots?
Well yea?
Wait nvm
had a lot of issues but this is the first one i can't figure out . Any idea? formatting looks the same as in the tutorial
bot.name_of_the_attr = msg
print(bot.name_of_the_attr)```
@slate swan
It has to be Asyncio
oh yeah my bad. what would i need to modify again?
Try creating a async function for it
Probably the long way around im terrible at shortcuts
there's one at the top
You have to do async def convert
the code theyre showing isnt even the actual code that is causing the error
@sullen shoal Yesss it worked!! Thanks
i'll send the entire thing i added
@commands.command()
async def remind(self, ctx, time, task):
def convert(time):
pos = ['s', 'm', 'h', 'd']
time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600*24}
unit = time[-1]
if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2
return val * time_dict[unit]
converted_time = convert(time)
if converted_time == -1:
await ctx.send("Incorrect time format")
return
if converted_time == -2:
await ctx.send("Intiger time")
return
await ctx.send(f"Started reminder for **{task}** and will last **{time}**.")
await asyncio.sleep(converted_time)
await ctx.send(f"{ctx.author.mention} your reminder for **{task}** has finished")
Yeah you have to do async def convert
did exactly the same as the tutorial 
You may have to do async def convert
you didnt
Is the solution async def convert?
it should work if they indent the await stuff to the actual function instead of the nested one
Sorry I am just super dumb and forgot to add ID to make it work but now it gives me some other error "dictionary update sequence element #0 has length 1;2 is required" can you please help me
tbh i never saw that error
Ok
We may sound mean, but we are just trying to help you. Please google the problem first.
Yeah I understand thanks for all the help
That looks like the same exact thing
It’s ok
added convert to the first line
doesnt the tutorial youre following include the entire thing they did in the description
compare it with your own
only a snipper
There should be a GitHub
In this video of Discord.py Advanced, I will teach you how to make a remind command.
Make sure to join the Discord if you need help with anything Discord.py related! https://discord.gg/N9Hdcz6r5W
Function code:
def convert(time):
pos = ['s', 'm', 'h', 'd']
time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600*24}
unit = time[-1]
if unit no...
When creating a economy bot I compared my code to his if I experienced any errors
so youve decided to jump straight to the advanced ones i see
It was a super helpful technique, everything working well
just trying my best to get this one specific function working
Don’t they release the code anywhere? Discord? GitHub?
From Google it just says dict() doesn't like str and deta doesn't like int so any help
Refrain from copying and pasting. They don’t solve any errors.
uh okey i wont copy paste
unfortunately that bad tutorial didnt bother to include the code
What’s your problem again? I cannot see
I hate tutorials like that.
At least share code on GitHub or something 
the only other tutorial on this subject as is ee is this https://www.youtube.com/watch?v=REJ_k3c0jpM
Discord: https://discord.gg/5XvVpGBw3B
Code in video:
who copies 3 lines of code. T_T
Check out this guy if you want lol: https://twitch.tv/CyberneticSky
#clvrk #python #discordpy #coding
but it only works for seconds when i want a true reminder
I just need a name for an economy bot my creativity is a size of a peanut
What’s a reminder again?
Well I'm trying to get data stored in deta database but I need to save the key value in deta as ctx.author.id and only way to do that with deta is str but dict() doesn't like str and it doesn't work so I have to use int to get the data stored there
I do not understand discord
basically just want my bot to be able to do
.remind 5h 30m "Bake beans"
Try using a dictionary
and in 5h 30m it pings me to say
@slate swan Bake beans
i just watched some parts of that tutorial and im not going to lie, that kid's code is straight up crap

Just use date time
uh whats that?
That is what I'm doing unless you mean something else
lmaoooo
!d date time
date
For datetime fields, casts the value as date. Allows chaining additional field lookups. Takes a date value.
Example:
Entry.objects.filter(pub_date__date=datetime.date(2005, 1, 1))
Entry.objects.filter(pub_date__date__gt=datetime.date(2005, 1, 1))
``` (No equivalent SQL code fragment is included for this lookup because implementation of the relevant query varies among different database engines.)...
none of the tutorials seem to help though
Source code: Lib/datetime.py
The datetime module supplies classes for manipulating dates and times.
While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.
How do I make a command to add, remove things?
oh god 2000 lines what is so long in this thing
What things?
what things
Example:
!add hello
Could you elaborate why the code is crap exactly?
Then when I do !list it shows hello
bare try-except, not following the pep8 styleguide, nested long functions and some stuff could be improved
but it should work, right?
if he has the confidence to upload it on youtube, it should work
although not the best practice
Sorry but can no one help with my issue?
Read the docs
that's good enough for me. I can make a better one when i'll have a good grasp on python
its not good to start with bad practices
I agree but i'm stuck between a rock and a hard place, so i'd just like to get this method out of the way first
i just wanna know why it doesnt work 
It uses asyncio.sleep, if the bot restarts it will cancel the unmute process making the user muted forever
And they are hosting on repl.it which isn't recommened
And after watching a bit of the youtube link you sent, I can see they barely understand it
oh damn that's pretty major. thankfully i dont use the bot to mute
The code they show off it copy pasted as well seems like??
The time conversion part at least..
replit is public. you could grab the url in the address bar to see their code if they havent deleted the project
aight i'll type that in
seems to be stuck in a loop of waking up
AIGHT GOT IT
got the exact command
what....
Use either tabs or spaces
Oop copiers curse
Not both
haha
i just copied the entire command 
Checks out
especially, its coming from replit
I don't understand why repl.it makes the default tab space 2 spaces
Makes no sense to me
so what should i do exactly? rewrite all tabs?
it also has weird whitespace bugs that cant be seen but python gives that error
i've used various languages and in all its 4 spaces (1 tab) at least that is what i've always done
way to make invisible characters visible in atom?
i dont think so
so..... what am i to do now 
render white space under view tab?
Re-indent the code you copy and pasted
and its hard to explain what i did to fix it
basically this
Indent with whatever you were indenting with before, be it spaces or tabs
But not both
?
HAHAHAHHA thank you all so so so much for helping and not giving up on me and my unorthodox request!
Well done!
How can i use client.allowed_mentions?
Read the docs pls 
!d discord.AllowedMentions
class discord.AllowedMentions(*, everyone=True, users=True, roles=True, replied_user=True)```
A class that represents what mentions are allowed in a message.
This class can be set during [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") initialisation to apply to every message sent. It can also be applied on a per message basis via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for more fine-grained control.
on quick question though, if i set a reminder,, then i shut the bot down but restart it before the reminder would have expired, would it still "remember" the reminder?
and if yes, would it have kept track while it was shut down?
No
i dont think that kids code does that
so if the bot goes down its rip 
Well if you turn the bot off then…
It doesn’t work
that's not what i was asking
You’ll have to make your bot 24/7
But if you want to remember it you can make a dict
but still, lets go
o? could you elaborate?
Make a key called the name of the reminder and then the value would be the time remaining
You can change that each time (like every second)
uhhhh
And when you turn it off it stops
And then if you re run it…it doesn’t work anymore but at least it’s saved
so its useless anyways
you can make it work with some knowledge
Do dictionaries work?
for?
Do we have a steps to starting a project message in here?
(With the value of course)
not recommended but yes
Yes I always do the long way (but sometimes it’s the most obvious way and I follow the zen of python)
Yes. 1. Post the error and include code. 2. There is no 2.
that isn't starting a project thats asking for help 😂
future: <Task finished name='Task-112' coro=<Player.check_queue() done, defined at /music.py:24> exception=IndexError('list index out of range')>
Traceback (most recent call last):
File "/music.py", line 26, in check_queue
IndexError: list index out of range```
Can anyone help me find the issue please kind of stuck
I do not the understand
What do you mean by starting a project
Index is out of range and pls include code
We can’t help you if you don’t have code
you are accessing a list that does not have the amount of information in it you think it does. Lists start at 0 so if you want the first item make sure your index is [0]
They have not provided the code and that answer may be incorrect
We will never know until they do reveal the code
Hey @safe depot!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Hi thank for the reply this is my code https://paste.pythondiscord.com/keputamiba.py
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

youtube_dl in your project breaches the terms of service of YouTube, and therefore we can't help you.
Yes I think he’s right
oh sorry forget i asked 😭

Yes
Do you have any names for a economy bot
My creativity is the size of a waterbear
Winconomy
Never mind

I'm in fact still searching for a bot name, been around 2-3 days
Not the best when it comes to creativity :p
Yes
i lookup the english dictionary for names
I guess that’s what programmers lack
I sleep on it for days and sometimes I use a generator or I ask Reddit
It’s been a day nobody replied
One of my posts got taken down apparently it broke the rules
Oh yeah your GitHub stuff is pretty cool I’m still looking through it
nice
@sullen shoal Can I only have 1 Attribute in my Bot? Because I have 2 now. The first one works, but the second one doesn't.
the arrchived ones are crap
you can have as many you want but dont replace the ones which are part of the class
the archived one are old, they might still work but the code is dumb
Attributes?
Oh
yes
the Bot class
Client.command?
they want to access variables from everywhere
Oh
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Oh
That one
I thought that was basic stuff
Right I’m gonna leave tommyinnit server annoying
I CANT LEAVE
WTH
i gotta go and enjoy my life now, gn
Starting a new Command or bot project?
Thats great! Don't just jump in an go. I know it may not be fun but there are a few crucial steps that should be considered before even starting your project. Let's take a look at some of the crucial things you should work out before starting your command or bot project.
1. What is it?
I think every developer agrees that knowing exactly what it is that you want to create before you create it is a crucial step. Albeit obvious but crucial nonetheless. Sit down and think about what type of bot or command you will create. Is it a utility bot or command, maybe moderation.
2. How will it function?
How will your command or bot work. This can be one of the more complicated parts. For bot projects it may be best to open up google docs to hash this out, otherwise just stating the concept would work for a command (unless complicated). Write out exactly how you want your command to function, from user input to code flow, storage, and lastly execution & return. Why is this important? If you know what you are making, and how you would like it to work, you are more likely to figure out ways to complete this while working these things out.
3. What do I need for this to work?
This is usually a broad topic as it can be as specific as a particular package or as complex as having to learn about a whole new concept of Python that you have never needed or even considered before. Whatever it is, this is where you are creating those building blocks to get yourself ready to code your project.
4. Executing your plan
Finally! We are creating our project! We have installed the packages we need and know exactly how we want it to work. Researched topics that we were unfamiliar with and have a great grasp on where to begin, plus we've created the steps to follow to complete our project.
Why do I say all of this? I say this because not only does it help you. But it helps the Community of developers you may be asking for help if you get stuck. We can easily identify what you need and where you may need it, If you know ahead of time what you are looking to do, how you expect it to work, and have a general idea of what you need in order for it to work.
In conclusion, I know its extremely hard to take a step back and think before diving right in, but having a plan ahead of time may just keep you motivated to continue if it gets frustrating.
Happy Programming!
it doesnt look like you have a ) on your ctx.send in line 49
i'd be lying if i said that isn't a normal occurance 😂
Inattention mistakes can always happen 
Yes
Everyone made at least one, if not much much more
I agree much
for me every line, of every code, i write every day. ||not really but happens more than i care to admit||
When is it never a normal occurrence 😂
When you create new code, I swear to god there must be more than 100 errors
That’s normal
It’s programming 😭😭
Every meme is about errors
Allow me to introduce myself:
Normal. Actually that’s way too small, what are you doing
lmfao i only listen to errors that stop my code from running 😂
I get an average of 2000 per line, your code is god level code (don’t ask how ok)
When I get really lucky my entire code adds up to 10000
That's why I love coding my entire programs in one single line
😂😂😂
Oh yeah, totally
no its not, is it really?
*sarcasm intended *
I was experiencing ok 
Nah man, you were doing the best. An average expert has around 1000 errors as well
Maybe we’re scaring away beginners
🤔
you have to code blindly for that many errors tbh
just remember my 10 steps to success 🤣
How? I made a whole bot and was getting 5 errors max and they would stop my whole program lmao
Sarcasm intended
In the end, we just need 3/4 keys as developers
Which are:
- Ctrl
- A
- C
and finally - V
Too little
hold up? A?
😂😂😂😂😂😂😂😂
Select all
For GitHub raw content
oh lmfao
You use windows?

mac
Roses are red, violets are blue, CTRL C, CTRL V, I took your code
But that's an expensive keyboard, cheaper ones only have Ctrl, C and V
👍
Roses are red, violets are blue, your code works in my bot too 🤣
😂😂😂😂
As dani would say, hippity hoppity your code is now my property
Roses are red, my tears are blue, your code doesn’t work in my code boo
Yes 😂
🤣
lmao py
Literally every software engineer: haha CTRL v go brrr
You gotta admit most of your code was copied
Its not copying if you try to understand it
True true
That’s the point of tutorials innit
my code is 100% ||not|| mine
||me too||
gonna be honest, making a package for python right now. ||100% got some other dev concepts in there||
As my last message for today, I'd like to give a minute of silence to all bot developers that have this situation and come here.
Please take some time for them 
now what
lmfao
||search more cuz why code it urself||
||didn't copy that just now||
https://www.youtube.com/watch?v=fg3LrzlmENw
this is me when i wanna add a new feature to my bot
Dani saying: "Hippity hoppity your code is now my property".
The source can be found here:
https://www.youtube.com/watch?v=nR9UfOueJPU
I have no clue why this is happening AGAIN
fixed it nvmd
one thing after another omgggg
and they are all loaded
where is your help command?
is there any import for collection ?
collection?
do you have a help cog?
did you remove the default help command and not replace it with anything?
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'collection' is not defined```
what is the command its referring to?
afk
can you show it?
yes
omg this templates so messed upppppppppppp i only use it cuz im lazy and i used it before but now its being stupid and now it aint got a help command
but its mixed with other things, im going to send it in parts
also like none of the commands are working
like the on message in another part
template?
@bot.command()
async def afk(ctx, *, reason=None):
embed = discord.Embed(timestamp=ctx.message.created_at, color=0x87CEEB)
embed.set_footer(text="something")
post = {
"member": ctx.message.author.id,
"reason": reason,
"date": str(ctx.message.created_at)
}
if reason == None:
collection.insert_one(post)
embed.add_field(name=f"{ctx.author.name} is now AFK", value="Reason: No reason specified.")
await ctx.send(embed=embed)
else:
collection.insert_one(post)
embed.add_field(name=f"{ctx.author.name} is now AFK", value=f"Reason: {reason}", inline=False)
await ctx.send(embed=embed)```
It's in fact using slash commands
@bot.event
async def on_message(message):
if message.mentions:
results = collection.find({"member": message.author.id})
for result in results:
collection.delete_one(result)
if message.content == result:
await message.channel.send(f"This person is currently AFK, Reason? {reason}")
await bot.process_commands(message)
else:
await bot.process_commands(message) ```
Let me send a screenshot of my server automated answers
what does collection have to do with it?
WHAT
like where do you get collection from/
saw an example to see how to do it, no idea what collection is
There you go.
xd
that's ur bot?
yes
going to try something else bc i dont know how to use that
oh no i mean winrar.
oh
Collection looks like its referring to mongodb. and im assuming you don't have that set up? i would recommend postgreSQL or SQLite3
going to see
tnx for help
np, good luck
thanks! <3
This is just to log in the console when, where and by who a slash command has been executed.
ngl i know nothing about slash command with Python. I've only used discord.js for slash commands.
Take a look at the two embeds I've sent.
i've never had it take an hour though. Usually if you reinvite the bot it automatically adds the slash commands 😄
Hold a second Win did you actually create that template?
Anyways, im off to actually complete some work tonight 😂

DUDE IM sorry if i said anything like its trash its really not ive been using it for like the past 10 months maybe
Well, I take every critical opinion in a very good way. It's a way to improve it so that everyone can be happy about it :)
i was looking for a python bot template thats lightweight and easy to setup so i can just have it on a rasberry pi running 24/7
and i found yours omg i didnt know you were the creator untill i looked at your username
¯\_(ツ)_/¯
How can i set a timeout for my wait_for reaction_add?
Dude ill show you what i did to your template before my rasberry pi overheated gimme a sec
im back. Procrastination level 1000
kwarg timeout in bot.wait_for
ah, ty

like await bot.wait_for('reaction_add', check=mycheck, timeout=30.0)
Sorry didn't mean to out you like that :/

Is there any one who i can dm that could help me make a command that i want my functioned bot to do? If that make sense
Sorry it took so long i had to edit out the links @slate swan
your literally the start of me learning python
Glad to hear that :D
I edited the weather command to have a custom background, I saw the website that u used for it and i was like WOAH thats alot of more stuff i can add i added a minecraft achievement, meme generator, a lot of other stuff wow holy
Is there any way i can still use a prefix with your bot tho
if not ill just stick to / commands
You can always make normal commands
This will be made when I'm moving everything to disnake
I cant believe i was asking for help with the template
then the literall guy who made it
helps me

literally got nothing done today 😂
https://github.com/Discord-Guardian-System/PyGuard/blob/main/src/PyGuard/PyGuard.py
i at least created the repo 😂
Better than nothing 
Its a learning process. Never attempted it before. Im on a mission to challenge myself 😂
Oh well, just like my projects
Attempting things I've never tried in the past and hope for the best
yessir. I realized almost all of my knowledge is discord lib based. And outside of it i had no idea where to begin. so where better than a webserver, api and some packages 😂
Yeah, but in the end it won't be wasted time. So it's worth the hassle
The way i see it, is its all projects i can present to a potential employer in the future.
Exactly
hey, when i run this code, and type 'test', the bot spams the output until it gets rate limited, is there a way i can prevent that?
change it to contains() or .startswith() or make it a bool by checking if the content.lower() == "test"
if message.content.startswith("test"):
... more code
or
if message.content == "test":
... more code
how to handle multiple reactions? (using await bot.wait_for("reaction_add"))
thank you :)
if you have more than one reaction on your message you can use if/elif/else to check if the reactions are the ones you want:
if str(reaction.emoji) == '🔗 ':
... do stuff
how do you know the emoji that i will put??
I get it

wait is that the emoji you wanted? im slightly confused. or are you asking how you can code the bot that it can anticipate any emoji?
nono
just... you guessed the emoji I'm going to put
Ladies and gentlemen, we have a seer
oh lol ||it was one of my recents||
🤣
but, in this case i don't will use bot.wait_for, yes?
||imagine not having winrar||
You probably want to use the event
!d discord.on_raw_reaction_add
discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
What a shame
Yup
are you just trying to put it so whenever someone reacts to a specific message it triggers or is it a specific message for a specific set time?
then i would use a wait_for personally since its a set time until it should time out (usually)
Aqua name. Love it!
7-zip moment
How can I ignore all errors that happen in my script? I'm not talking about using try-statements
what do you mean exactly
like an error handler?
If somewhere an error happens. I want to ignore that error and not print it anywhere. Just like for the try-statement but for the whole script
Yes maybe
on_command_error event
Hi I am trying to make it so someone who is hosting the discord bot can send a message in their terminal and make the bot say something whilst also being able to read messages that people are saying. I found a way to asynchronously check for input from a user on python but I am not sure where to put it.
userInput = await aioconsole.ainput() < This is the code I dont know where to put
await message.channel.send(userInput)
that i dont know, Im pretty sure there is some type of keyboard interrupt or something not related to discord.py you could look into. where it would go in your code i have no clue.
Or use a web solution instead :D
How do I know if someones roles have updated? E.G they had no roles, now they have X role?
is there an on_role_change event?
!d discord.on_member_update
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change:
• nickname
• roles
• pending...
How to download a pic
wat
Download a image
in d.py?
Yup OFC
async for ... in channel.history()
tysm
@bot.event
async def on_member_update(before, after):
if len(before.roles) < len(after.roles):
newRole = next(role for role in after.roles if role not in before.roles)
if newRole.name == "RolesRemoved":
#Remove all of their roles.
How would I remove all of the users roles from this? on_member_update only takes those 2 parameters.
You want to remove all roles from the user after it detects RolesRemoved role in the member?
yep
You can do await after.edit(roles=[])
👍
await after.edit(roles=[])
if I wanna give them 1 role instead of none, can I just put the ID or name inside of roles=[] because i'm getting this error: AttributeError: 'int' object has no attribute 'id'
You need to pass a snowflake object
Basically a object that has an id attribute
yuh I have the ID of the role: 910800167664488508
class discord.Object(id)```
Represents a generic Discord object.
The purpose of this class is to allow you to create ‘miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.
There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.
x == y Checks if two objects are equal.
x != y Checks if two objects are not equal.
hash(x) Returns the object’s hash.
Once you create it, just add it to the list and pass to roles kwarg of edit
alr lemme try
@bot.event
async def on_member_update(before, after):
temp = discord.Object(910800167664488508)
if len(before.roles) < len(after.roles):
newRole = next(role for role in after.roles if role not in before.roles)
if newRole.name == "BannedFromTrading":
channel = bot.get_channel(910793779508838401)
await channel.send("user has been given bannedfromtrading")
await after.edit(roles=[])
await after.edit(roles=temp)
returns TypeError: 'Object' object is not iterable
You didn't pass a list, you passed an object
You should be passing [temp]
And it makes no sense to have two edit calls, your just making two API calls
Just have the one where you pass [temp]
await after.edit(roles=[temp])
And it will remove all roles and add temp
instead of 2
Mhm
ty again <
I have a question
So you guys know bots can put a link inside of a word? How do I get my bot to detect something with on_message from that link inside the word?
Lets say the word says “american” but the link inside has the word “indian”, how do I detect the word indian? Because it will show american
How to make so if anyone dm the bot it responds to the user on the bot's dm?
show code
I'm sry idk
https://github.com/Sheepposu/discord.py/blob/master/examples/receive_vc_audio.py
Can someone explain me this
How do I get my bot to print the link in the hyperlink?
this is a big asf music bot or something
Not a music bot exactly
hey u can make message hyperlink in embeds but not in normal messages
if isinstance(ctx.channel, discord.channel.DMChannel):```
Yeah ik
for invite in invites_before_join:
if invite.uses < find_invite_by_code(invites_after_join, invite.code).uses:
returns this error (sometimes)
AttributeError: 'NoneType' object has no attribute 'uses'```
can someone explain to me why this happens and how I fix it
Anyone know how to use regex here?
to do that u need to make a embed
embedOrki = discord.Embed(title="Orki's error fix", description="You can visit about the error [here](link)")
await ctx.send(embed=embedOrki)
If a check is false the coroutine stops right?
How to stop auto-packaging on repl
u can't lul
if the if function is false is false the code will be executed under it
wait what u askin
You gave me 5 strokes
Never its a basic check
Nice
I started 1 microsecond ago :)
oof
ur watching that replit based YouTube guy bot maker.
?
beau carnes
I am not watching anyone
hmm
hmm
Bro why are reactions and roles so damn confusing in docs
@commands.command()
async def role(self, ctx, choice):
if choice == 'create':
await ctx.message.delete()
await ctx.send('Spamming role creation..')
await ctx.send('Please wait...')
print('Spam role creating procession has begun!')
for i in range(1, 25):
await ctx.guild.create_role(name=f'testing role')
elif choice == 'delete':
await ctx.message.delete()
await ctx.send('Spamming role deletion..')
await ctx.send('Please wait...')
print('Spam role deleting procession has begun!')
roles = ctx.guild.roles
roles.pop(0)
for role in roles:
if ctx.guild.me.roles[-1] > role:
await roles.delete()
else:
await ctx.send('There was an error while deleting the roles.')
else:
await ctx.send('Not a valid option.')
For some reason I am being rate limited, it wasnt doing it yesterday though.
Any reasons it could be?
They make 0 sense
Mention me if you know: #discord-bots message
Not sure the cause, maybe add a small delay between each action? Could be triggering something because it sends messages too fast
But which messages, because all I'm trying to make it so it mass deletes all the server roles. The Create function works, just not the delete function
@slate swan Excuse me good sir sorry for the ping but is this correct
For troubleshooting purposes, I would just add a sizeable delay to everything to see if it is even a feasible solution
alright
Gotta go for a while, you can msg me while im gone and ill look after
👍
for invite in invites_before_join:
if invite.uses < find_invite_by_code(invites_after_join, invite.code).uses:
returns this error (sometimes)
AttributeError: 'NoneType' object has no attribute 'uses'```
anyone know why i'm getting this error and or how to fix it
Find invites by code is returning None
@bot.command()
@commands.has_permissions(administrator=True)
async def dd(ctx):
print(ctx.author.web_status)
print(ctx.author.mobile_status)
print(ctx.author.is_on_mobile())
try:
if ctx.author.is_on_mobile():
await ctx.send("true")
if not ctx.author.is_on_mobile():
await ctx.send("false")
except Exception as e:
print(f"ERROR: {e}")
await ctx.send("Error")```
why is that not working
Error message?
do you have the Presences intent? @slate swan
OO
its needed to get this info
anyway I can add roles via their role name? For context I have a ton of roles that are just 1 number increasing, and member’s roles ascend in numbers the more they interact. I can add a role based on their current role number + 1
2021-11-22T03:08:03.270644+00:00 app[worker.1]: Traceback (most recent call last):
2021-11-22T03:08:03.270665+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py", line 350, in _run_event
2021-11-22T03:08:03.270665+00:00 app[worker.1]: await coro(*args, **kwargs)
2021-11-22T03:08:03.270667+00:00 app[worker.1]: File "/app/main.py", line 92, in on_message
2021-11-22T03:08:03.270667+00:00 app[worker.1]: await self.commands[cmd](msg)
2021-11-22T03:08:03.270677+00:00 app[worker.1]: File "/app/main.py", line 10, in get_vc
2021-11-22T03:08:03.270677+00:00 app[worker.1]: await func(self, msg, vc)
2021-11-22T03:08:03.270684+00:00 app[worker.1]: File "/app/main.py", line 104, in start_recording
2021-11-22T03:08:03.270684+00:00 app[worker.1]: vc.start_recording(discord.Sink(encoding=encoding, filters=filters), self.finished_callback, msg.channel)
2021-11-22T03:08:03.270686+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/voice_client.py", line 790, in start_recording
2021-11-22T03:08:03.270687+00:00 app[worker.1]: self.decoder = opus.DecodeManager(self)
2021-11-22T03:08:03.270696+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/opus.py", line 437, in __init__
2021-11-22T03:08:03.270696+00:00 app[worker.1]: self.decoder = Decoder()
2021-11-22T03:08:03.270697+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/opus.py", line 352, in __init__
2021-11-22T03:08:03.270698+00:00 app[worker.1]: _OpusStruct.get_opus_version()
2021-11-22T03:08:03.270707+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/opus.py", line 290, in get_opus_version
2021-11-22T03:08:03.270707+00:00 app[worker.1]: raise OpusNotLoaded()
2021-11-22T03:08:03.270724+00:00 app[worker.1]: discord.opus.OpusNotLoaded```
role = discord.utils.get(guild.roles, name=str(int(role) + 1))
``` @stone moon
Can someone help please
Opus is Not Loaded
idk
thanks I never thought of using discord.utils
:DDD
And how do I solve that👀
all parameters are needed right
how so
Tell me a guwd answer😩
Lemme see
How to add it
Can't figure out
Heroku isnt bad
It is but is the best option for being a free option

am i wrong tho?
i think im stupid but
this is my code
client.run(token) bot=True)
somone give me the real one
client.run("token")
Remove the bot=True thing
@slate swan actually add your token add dont add it like i said cuz its replit
Idk why but bots are getting ratelimited more nowadays on replit
when i put the old one it worked for me
you shouldnt its replit its public
and when i put the token it gave me alot of erros
it was working prefcetly fine 2 minutes ago
iirc its client.run(os.getenv(token))
so i just say client.run(os.getenv(token))
why cant i just send u the replit in dms
so tired rn
no actually make a .env file and store your token to a var and use the method
so wahts actually the whole code
dont use replit and i dont help in dms
bro im on chrombook i have to use replit
dont use replit
im on chrombook i have to
alr i never said anything about it ?
man im nerver gonna make my bot online ervery again 😭
@brittle ingot why cant people download other ides i dont quite understand cuz of the os?
what should i click on @brittle ingot
go to settings > advanced > developer on your chome book and press enable linux beta
Chromebook only allows apps from the google playstore essentially.
ripppppp
Hey @tiny ibex!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
!code @tiny ibex
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
yeah. so you have to enable linux beta and download the .deb version of vscode.
that works too
guys i put my bot token at like next to the token but when u scroll down in main py it says client.run(token, bot=True) SOMONE TELL ME THE RIGHT CODE HERE
What's the issue?
the issues is
as said dont put your token in your main file in replit
my bot is working preficetly find like 5mintues ago and i think i click on something wrong my code rn is client.run(token, bot=True) idk why it gives me erros it was the same code but i click on smthing '
i put it on the main file and it worked prefcetly find
Show the error please
yes ofc it will but its public your token is leaked
IM ON CHROMBOOK
It's rate limiting you
omg man
hes using a chromebook
How does that even matter
wydm how it matter
he cant download a other ide bruh
He can use heroku for hosting
oh god no.
i swear your giving me strokes each second
Heroku is better than replit
nah
they're both bad
vs is
They are but they are free

so is self-hosting
And that's the thing normal hoomans like me want
Imagine
free doesnt mean good
not a flex lmfao
If you have VSCode you can self-host and not use repl or heroku. ||my bots have always stayed online with vscode||
how with keep-alive or do you just run it
I don't want my PC to run 24/7
The CPU perfomance will go down
Alec and Halloween? Hmm
It kinda will
weird to see you here but hello
Hehe
Me who also has VSCode but don't self host bots: 😐
so those this guy know whos he talking too👀
it's weird to see me here? lol
Lmao
Actually no
Yup
At least use heroku instead of replit
I am using heroku sir
repl is ewww
@tiny ibex alec is the creator of this tutorial https://vcokltfre.dev/
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.
Alec! Long time no see! Congratz on moving up!
Moving... up?
hes the goat
Oh!
well helper 😄 and i thought project lead for a bit
why do i feel like im out of the loop on myself lol
What is this correlation between vsc and self-hosting your bot. You write code in vsc, you don’t use it to selfhost a bot 🤔
You referring to the mirrored command prompt you get in vsc?
i mean i don't use it to self-host but its certainly a free option if you want to use it like that.
do you guys mean selfhosting as running your code yourself?
yeah
you run it from the terminal in VSC.
Yeah
selfhosting doesnt need to be a local device
ok i was right
But you can also run it from a regular un-mirrored terminal.
yeahp
wdym?
a separate terminal?
Like a pi?
a pi can be used yes, but that doesnt have a relation to whats being replied to
vsc's terminal in prorgram is mirrored essentially its your regular terminal but inside the program. un mirrored would be your regular one im assuming?
Didn't really understand what they meant
A better way of putting it I think would be that VSC has an integrated terminal, and the point being made is that it's fine to run it from a regular terminal, not just the integrated VSC terminal
yeah thanks 😄
Does that even matter -,-
no
not really, but if you were going to put it on your PC then running it not in VSC would reduce memory usage by quite a lot
really?
since VSC is essentially a chromium instance
Oooooooooo
oh wow
wow thats cool
I never used VSc terminal
never new it was a thing
|| i never use regular terminal || 😂
VSC (and discord, and slack, and insomnia, and a ton of other apps) is basically just a single tab chrome instance with extra steps
I don't even know how it works
the same as a regular terminal but inside the program
:0
Its nice, cause you don't have to switch screens
what if you have 4 screens 
Hmmm
me with 1 like: 
Cool
wtf
a very good question
bruhh for what 😂
why😭
calculator.
your joking right
how i do maths:
ctrl + alt + t (opens a terminal) -> python3 -> type maths
I mean it do be that way with electron apps
yup
i think the most i ever have its like 2 if im running a bot in the background to test coding for my web server 🤷♂️
my most i have is 1 cuz if i do 2 laptop go BOOM
oop
i may have problems
lmfao
fun
go to the dev portal's oauth tab, there's a switch for it
Alec you see the new text input feature discord is going to release?






pays for 


