#discord-bots
1 messages · Page 1036 of 1
~~yes, ~~no wait its self.add_view if u subclassing
Ryuga thanks for help
so if I want another command, should I do @bot.command() again or once is enough?
again
For every new command you need that decorator
You know that you've already called them only by saying that word 
hi
lmaoooooo
sup brad
Best question so far 
would ```py
c = bot.command
def let():
pass
def give():
pass
def you():
pass
def up():
def down():
pass
let()
you()
down()
@c()
async def never(gonna) -> give:
you()
up()``` work?
you cant call the same func twice
Rickroll 
no
kek
ok
now?
-_-
Not a whole lot really, had a small raid that was quite interesting to deal with earlier. The rest of the morning has been quite nice with coffee and donuts.
Now I'm just chilling and playing around with sqlite3
give, you, up
are not defined
sqlite3 the best database XD
engineer by day, brad + coffee and donuts at night
nice
Really nice to use and such
..
python is interpreted so for it rn only give is not defined 😔
bot too
@slate swan @frozen patio
ok

You never installed it
Breh
-_-
I know Sparky
wait so would I need to be subclassing disnake.ui.View or disnake.ui.Button? second one right?
sublcassing the View
I am trying to make a flask API while learning data structures
.
ig, im missing the context
add_item is a method of View so first one
go to the packages option and install nextcord,or type poetry add nextcord in the shell
pip install nextcord is useless in replit since its gonna get cleared in every next session
Welcome to discord bots channel, where people think that they can develop a bot using a python package without knowing python 
oh okay
Yeah
to be honest i'm a little confused do you mind giving an example?
mhm
i did pip
Average everyday
so nvm
Also
like self.add_item(the item u want to add)
Why are you using repl
refresh the tab and you'll be back with the same error during runtime again.
I would strongly recommend you become more familiar with python before continuing because won’t have a fun time if you don’t.
I don't want to do that
Ofc to keep his bot "online 24/7"
trust him, I've been through it and it isnt fun
Yeah I learned like that
Use a 20 line flask script then 
I'll just use a web server and a server pinger and kabooom. I won't need to do that another time
I will use that
it kills me that people don’t just buy a 5 dollar vps or even a raspberry pi
so now
Have fun coding it
🌟 your. wish. 🌟
and what would be the item here? It would be ```py
@disnake.ui.button()
async def func(...)
right?
uptime robot -> supports downtime
I already have the code 😉
its a small b for the decorator
I use uptime robot with flask code
i think yea,
all the time
no point in arguing, its the BEST
Nowadays they literally threw vps away, they're so cheap
also discord bots don't require a lot of memory
yes
smh
Exactly 
@slate swan no how do I do kick and ban and mute cmds with this code?
bro?
Learn it
I just need to understand it
We can't spoonfeed you
what's a PPS supposed to mean....
where?
Physical Private server
!d discord docs
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
-_-
It plugs into a VPS
makes sense
Positive Pay System
u need to pay for that
It's pretty fast
there are tutorial for that around the web 
just google 
There are even some examples in the github of every d.py forks
😂
Yep
ok
this is free
use these 😔
why host a bot which is not good enough to pay for :0
I bought it so I can have my bots on
We will be able to help you if you have a quick question but most people aren’t willing to walk you through the whole process. You need to help yourself to some extent and then we can help clarification questions or if you have an error
-_-
Now he will ask you how to do that, you know it right? 
yes
-_-
I'm good with discord

will die soon
not with coding
Nextcord is the same thing XD
well very similiar
I honestly don't get why people still make kick/ban slash commands
Disnake is where it’s at
eh
me too
dont think it would be same in 3.0
I need to learn disnake
since they are rewriting everything
Yeah 0-0 Ima heave to learn that
Why eh it’s literally nextcord just with a few differences?
same,, I literally just made a nice warn command that does both bans and kicks 😔
I am into Flask tho 
Bruh it's just a fork lol
if you know d.py you know disnake 
thats noice! hikari?
Not really no
i made ban command and left is after writting the signature
flask is easy, django is better and complex
yep
yeah prolly, but flask ain't bad to do
I am making an API in flask
The way they have implemented views and all of the new interaction stuff is very different to some extent
disnake has same views as any other fork
Of course not entirely because disnake is updated, so there are new features but the docs is simple to read and you can't get lost if you know d.py
but still, the amount of complexity django allows isnt offered by flask, plus the amount of builtins reduces the usage of third party libs
in addition they added ActionRows which you don't really need to use
anyways, ot
how do I do something like this? ```py
class Confirm(disnake.ui.Button):
def init(self, bot):
self.bot = bot
super().init()
_all = asyncio.run(get_top_weapons())
for weapon in _all:
@disnake.ui.button(label= weapon, style=disnake.ButtonStyle.blurple)
async def confirm(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
await send_build(weapon)
Trying to loop over a list and for each element make a button. right now i can't access weapon in the button
You might be indenting the button wrong
They make large complex button views easier to manage I think it’s a pretty useful feature
You usually don't nest it
no make a button object... dont use the decorator (i thought u were reffering to the callback b4)
Nextcord has load_extensions() right?
Yes
oh so i do add_view() on the func?
Every package has it 
Cogs are universal
pass weapon to it
in an arg
No… the new forks added that independently it wasn’t originally in dpy
then where do I set the colour of such of the button?
!d discord.ext.commands.Bot.load_extension
like in discord.py u can just do discord.ui.Button(label='...', emoji....) to create them ( then u can add call backs later )
Load_extensions
Not extension
.
No Ik
yeah i'm sorry i'm not following
I was just referencing my message
Oh
you just dynamically want to create buttons and add to the view right?
yeah
to do something like this ```py
for weapon in _all:
@disnake.ui.button(label= weapon, style=disnake.ButtonStyle.blurple)
async def confirm(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
await send_build(weapon) #use the current element in the list
not sure
!d disnake.ui.Button
like weapon=weapon
class disnake.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
async def confirm(..., weapon=weapon)
disnake 2.0?
what
okay yeah so what about the deco then?
it even says that in the bottom
you do whatever you want with it
disnake latest version is 2.5.1
no i dont mean that
for weapon in _all:
button = discord.ui.Button(label=..., style=...)
button.callback = lambda*args: await send_build(weapon)
self.add_item(button)
for this u will need to subclass View
so ```py
class Confirm(disnake.ui.View):
def init(self):
super().init(timeout=None)
_all = asyncio.run(get_top_weapons())
for weapon in _all:
button = disnake.ui.Button(label=weapon, style=disnake.ButtonStyle.blurple)
button.callback = lambda: await send_build(weapon)
self.add_item(button)
this raises `self` isn't defined on the last line and also `"await" allowed only within async function` in the lambda func
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
wait where have u defined send_build?
global?
it's in another file but imported through from .utils.funcs import send_build
!d disnake.ui.View
class disnake.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.
asyncio.run send_build xD
like lambda *args(what ever args u want): asyncio.run(send_build(weapon))
this won't work? button.callback = asyncio.run(send_build(weapon))
also what about the self isn't defined from that last line
how to make discord bots?
ya thats what u need to take args, right now ur taking 0
make the whole thing an async function and run it
depends on the situation
or just use the previous method with the arg
it can ig, idk what send_build looks like, if it takes the appropriate args then sure, that works
this is what you mean? ```py
for weapon in _all:
button = disnake.ui.Button(label=weapon, style=disnake.ButtonStyle.blurple)
button.callback = lambda self, weapon : asyncio.run(send_build(weapon))
self.add_item(button)
A tutorial to help you make better Discord bots.
wait... its a lambda inside a function why the fuck does it need self, can u show the full traceback?
the self not defined is being raised in self.add_view line
ok ty
@bot.listen("event_name")
async def foo(...):
...
Thanks!
ic, im so lost right now, i though u were writting all that in the init function
so the code u have written is not in any function, so it doesn't have access to self
make a method and put that code in it and call that method
like
class Confirm(disnake.ui.View):
def __init__(self):
super().__init__(timeout=None)
def method(self):
_all = asyncio.run(get_top_weapons())
...
|| you should give him bot.event() so his commands would not work now and we could tell to him that replit broke his bot ||
ah okay
yeah so I have ```py
class TopFive(disnake.ui.View):
def init(self):
super().init(timeout=None)
async def func(self):
_all = asyncio.run(get_top_weapons())
for weapon in _all:
button = disnake.ui.Button(label=weapon, style=disnake.ButtonStyle.blurple)
button.callback = asyncio.run(send_build(weapon))
self.add_item(button)
let me check to see if it works
u can;t asyncio.run in async func iirc
just await
||I don't really care or like interfering with other people's lives as long as my life works out||
||
||
Why not? 
sorry
||or we could use @bot.event correctly after all this time we spent on dpy||
stop with the spoilers
I want the bot to check the messages for bad words and if it spots one, it has to delete it. How do I exactly do it?
I'm dying trying to catch up to Nextcord
-_-
how to do that?
@placid skiff What have I done to u eh? Trying to mess my experience
use the modals branch
An optional component handler for hikari, inspired by discord.py's views. - hikari-miru/modal.py at feature/modals · HyperGH/hikari-miru
install it from git
@bot.listen()
async def on_message(message):
if some_bad_word in message.content:
await message.delete()
Yo cool down dude
I was just jokin
tbh i'm workin on smth else so i've not touched any bot for a while
ohh ic
yay, and you may probably need to install sadru's pull request branch too ( the commands are in miru channel's pins)
that has been there for a long time
sheeeesh, ic
it would be cool for discord to display a preview of the message and author ngl
like an embed of the preview of the message
Hello
Why I cant have 2 on_raw_reaction_add events?
I have two with different id-s and emojis, but only one works
please help me
it is important
What is the decorator that you use for the event? bot.event?
yes
keep it in the same event but have two functions for each emoji
like this
I need both to give role
do an elif statement
what is that
Events are triggered only once, to have more function for a single event you will have to use a listener, the decorator is bot.listen(event_name) then you can call the function however you want
however, if you don't pass an event as parameter, the name of the function shall be the name of the event
keep it in one event but you can have two reactions
so
if reaction
elif reaction
async def on_raw_reaction_add(payload):
ourMessageID = 973603814055751741
if ourMessageID == payload.message_id:
member = payload.member
guild = member.guild
emoji = payload.emoji.name
if emoji == '👀':
role = discord.utils.get(guild.roles, name="|👀| Frakciót keresek")
await member.add_roles(role)```
like this?
yeah, you will have to use it in both events
EH?
ok ty
async def on_raw_reaction_add(payload):
ourMessageID = 964934552927756349
if ourMessageID == payload.message_id:
member = payload.member
guild = member.guild
emoji = payload.emoji. name
if emoji == '\N{WHITE HEAVY CHECK MARK}':
role = discord.utils.get(guild.roles, name="|🎮| Játékos")
await member.add_roles(role)
@bot.listen("on_raw_reaction_add")
async def on_raw_reaction_add(payload):
ourMessageID = 973603814055751741
if ourMessageID == payload.message_id:
member = payload.member
guild = member.guild
emoji = payload.emoji.name
if emoji == '👀':
role = discord.utils.get(guild.roles, name="|👀| Frakciót keresek")
await member.add_roles(role)```
so these will work now?
yeah
to be sure name the two functions differently
np
Can I ask help with an other thing?
of course
It is bigger 😄
let's see if i can help
how to I fix ModuleNotFoundError: No module named 'typing_extensions' ?
depends what you prefer
I use disnake
is it hard to convert from dpy?
it is saying that there is no package named typing_extension
and are there modals, buttons, selects etc.
Okay, so I have done this command. And I would like to make that, if the ✅ is pressed, the mentioned guy, will get the mentioned role. (The roles and the members will never be the same probably) I have no idea how should I do this
This is only an example about the member and the role
Nope, you will just have to change every discord into disnake
yup
damn, very nice
do you know where to get the package ?
you can use the wait_for method
Can you help me with the code? 😄
!d discord.ext.commands.Bot.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
or an event listener for an on_reaction_add
here in the docs there is some example
Is there a way to detect when a user's nickname is chhanged?
It is a command so wait_for is fine
because for the event he will need some parameter that he will not have untill the command is cast
i don't even know what it is 
Well, I have no idea. I know this would be a big favor, but can you help me with coding it? I am to dumb lol
You gotta learn somehow ahaha
read the docs and look how it is used
yeah well u dont have to copy that bit
bruh I have totally no idea help me pls 😄
Ok so you put the wait_for under the command that you want to be reacted to
Yes I have done it
show your code
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role:discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name =f'{ctx.message.author.mention}'" rang kérelme", icon_url = f'{ctx.author.avatar.url}')
rangembed.add_field(name= 'Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
bot.event
async def wait_for():```
ok so no, you dont need an event listener
uh?
the wait_for is not event, its incorporated into your rang command
should be incorporated*
oh
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role:discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name =f'{ctx.message.author.mention}'" rang kérelme", icon_url = f'{ctx.author.avatar.url}')
rangembed.add_field(name= 'Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
async def wait_for():```
like this?
wait_for is not a function, no
basically right, what you want, is to send the message from the command you have, get the message object to then use the wait_for to see if anyone reacts to that message
yea, the mentioned guy will get the mentioned role
right
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role:discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name =f'{ctx.message.author.mention}'" rang kérelme", icon_url = f'{ctx.author.avatar.url}')
rangembed.add_field(name= 'Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
wait_for():```
like this?
no, look how wait_for is used in the examples
this is the example given in the docs
@client.event
async def on_message(message):
if message.content.startswith('$thumb'):
channel = message.channel
await channel.send('Send me that 👍 reaction, mate')
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
try:
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await channel.send('👎')
else:
await channel.send('👍')
@commands.command()
async def wait_for_test(ctx: Context):
message = await ctx.send("this is a test")
await message.add_reaction(":white_check_mark:")
check_reaction = lambda reaction, user: user == ctx.author and reaction.message == message
try:
reaction_added, user = await bot.wait_for('reaction_add', check=check_reaction, timeout=180)
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
if reaction_added == ":white_check_mark:"
#your_stuff
should be like this
Can someone please answer the question :)
I add this to where? After rang command?
Never heard of it
That's a good starting place, to see if people have ever heard of it
not really thats too time consuming
what to put #your_stuff? the command?
https://www.learnpython.org/
https://www.w3schools.com/python/
are what i prefer
@bot.command()
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention}'" rang kérelme", icon_url=f'{ctx.author.avatar.url}')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
def check(reaction, user):
return user == member and str(reaction.emoji) == '👍'
try:
reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await ctx.channel.send('Timed out')
make sure u understand it
yea, there's another easter egg related to it too
which replaces tenor with txnor
yes?
My bad.
So hard

thats exploiting the api
I want to understand each topic one by one, so for now I have to understand the repetition of work 😅
w3 school is kinda trash imo
i learned a bit with it but its explaining and everything is garbage
Recently did a couple of side gigs (fivver, upwork etc) where I was building simple bots for people. Despite having python tags and discord, what I am finding is the clients aren't necessarily looking for the code, but just the running bot. Do you have them sign up with a VPS? Do you sign up, host, and resell at a monthly price? Just curious
@placid skiff question regarding disnake if i may, can you make a command both message(prefix) and slash?
You can include the cost of the VPS plus a little bit more as the monthly price so you can make a profit off of it
Especially since one VPS can host multiple bots
i have ```py
class TopFive(disnake.ui.View):
def init(self):
super().init(timeout=None)
async def func(self):
_all = await get_top_weapons()
for weapon in _all:
button = disnake.ui.Button(label=weapon, style=disnake.ButtonStyle.blurple)
button.callback = await send_build(weapon)
self.add_item(
and in slash command, i need to call that func right?
I don't believe you're creating views corretly
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention}'" rang kérelme", icon_url=f'{ctx.author.avatar.url}')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction("✅")
check_reaction = lambda reaction, user: user == ctx.author and reaction.message == message
try:
reaction_added, user = await bot.wait_for('reaction_add', check=check_reaction, timeout=180)
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
if reaction_added == "✅":
await ctx.add_roles(role)
Why is this not working?
If you want buttons, use the disnake.ui.button decorator
well i'm trying to iterate through a list and for each element, create a button
Then you probably want a more dynamic approach, in which case you should subclass discord.ui.Button AND discord.ui.View
Have you done this? Curious on how to handle billing
look at your check
so do everything in the discord.ui.button subclass and then in the view do self.add_item(button_class)?
does that not look wrong to you
class Button(discord.ui.Button):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
...
class View(discord.ui.View):
def __init__(self, ...):
for i in range(5):
self.add_item(Button(...))
For a very simple example
idk I have never used
ok but who would the author be?
idk
so then what would i put in the button subclass exactly?
A single button and its callback
If each button has to be different, you can take in the needed information from the constructor
so the callback would be a function
Yes, and it has to be async def callback(...):
oh no i mean that the callback i want for the button is an already made function
Migrate that into the new callback
how should I make it
class Button(discord.ui.Button):
def __init__(...):
...
async def callback(...):
...
basically here's what i had before ```py
class TopFive(disnake.ui.View):
def init(self):
super().init(timeout=None)
async def func(self):
_all = await get_top_weapons() #a database query which returns a list
for weapon in _all: #iterating through list
button = disnake.ui.Button(label=weapon, style=disnake.ButtonStyle.blurple) #add a button using the element
button.callback = await send_build(weapon)
self.add_item(button)
I know I sound harsh but I dont want to just feed u answers
i'll be honest i keep getting lost
ye I know but I am too dumb for me
currently ur check is checking the author of the message
which in this case is the bot
for weapon in _all:
self.add_view(Button(...))
you're not dumb you just need to read more
and understand what u are doing
because at the moment, you clearly dont understand checks, so see if you can figure out how the correlates to the wait for and what role it plays
and?
why would you wait for the bot?
yeah i got that but the Button is from the button subclass, and in the button subclass, not sure what I should there
I mean the author is not important
why not?
You would call the super().__init__() with all the arguments of a regular button
the author isnt important, but the user sure is
super().__init__(label=..., color=..., ...)
so, what would you need to change for your check
in the code user = author
and...
I understand it now lol
whats wrong with this?
@client.event
async def on_ready():
await client.wait_until_ready()
user = client.get_user("958449875064873010")
await user.send("Logged On")``` any idea why user is returning None?
It has to be an integer
the user should be who was mentioned in the message
Not a string
not the bot
correct
AttributeError: 'ClientUser' object has no attribute 'send'``` now its retyurning this
I want to make a command with spaces but it says command "antibot" is not found? How could i make a command with spaces? 
str(message.content).split(" ")[any index]
and where do i put this?
What you are looking are for subcommands
commands.group
Whose ID is that?
Or you're just looking for the boolean typecast
async def antibot(..., status: bool):
...
!antibot on -> status = True
!antibot off -> status = False
better than what i was gonna write do this ^
mine
hmm
ids are integers, not strings
ye i changed it
ClientUser also does not have send. Are you trying to DM?
https://discordpy.readthedocs.io/en/stable/api.html?highlight=clientuser#discord.ClientUser
yep
so would it be ```py
class Button(disnake.ui.Button):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
class View(disnake.ui.View):
def init(self, bot):
self.bot = bot
super().init()
async def func():
_list = await get_top_weapons()
for i in _list:
The problem is why is get_user returning a discord.ClientUser
According to the documentation, get_user should return a discord.User
I suspect it's because you're doing it inside on_ready?
strange, cant say ive ever tried a dm in on_ready
I would refrain from sending any API requests on_ready
Is that id you are passing it @hybrid ravine to your bot?
alr i wont
yh its mine
what is yours? Your user or your bots?
he said its his id
You don't need the func() at all
Yeah, but people can be wrong.... to Robin's point, this is an unexpected return type
I'm checking in another server
but i'm doing it so that i have an async func to do my await in
Then do your data fetching inside the command and pass it to your view
this is what i have right now, if i'm doing it right ```py
class Button(disnake.ui.Button):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
class View(disnake.ui.View):
def init(self, bot):
self.bot = bot
super().init()
async def func(self):
_list = await get_top_weapons()
for i in _list:
self.add_item(Button(label=i, color=disnake.ButtonStyle.blurple, callback = await send_build(
Close but not quite
I don't work with views often, but I suspect callback expects a coroutine
and not the result
yeah it is a coro got cut off
class View(discord.ui.View):
def __init__(self, *, data):
self.data = data
super().__init__(...)
for i in range(5):
self.add_view(Button(...))
@bot.command()
async def my_command(...):
data = await fetch_data()
view = View(data=data)
await ctx.send(view=view, ...)
920051517514453022 @hybrid ravine
that is your id
which is not what you were passing in
I suspected as much
even the discord.py server is like "wtf it shouldn't return a ClientUser"
You're probably passing in your bot's ID which may be why it's returning a Clientuser
bro i was passing my bots id in my fault😭
Yeah that sounds about right
haha
good lesson
Are you sure its your id?
Ok, but are you positive?
Ok I get that... but did you cheeeeccckkkk?
😄
😭🤣
ok how should I fix it?
how do you get bots to add roles to users
That's good code 👀 🤣
!discord.add_role
you want a simple /giverole command?
yes
Guys, I'm creating a command.
When I invoke this command, I have to mention 2 or more users so that they appear under the embed, do you know how?
do in a formatted string {member.mention}
What do you have so far?
async def soloVsoloreal(ctx, *, arg):
embed = discord.Embed(title=f"Nuova wager 1v1 realistic per {arg}", description=f"**Team 1 vs Team 2** ", color=discord.Color.green())
embed.set_footer(text=f"{ctx.guild.name} ")
await ctx.message.delete()
await ctx.send(embed=embed)```
Why are you deleting?
and I have to add this thing of the mention of users
the message
Okay then
@commands.has_permissions(ban_members=True)
async def giverole(ctx, member: discord.Member, *, role:discord.Role):
await member.add_roles(role)
await ctx.send(f"You added a(n) {role.mention} to {member.mention}")```
So I think you could put the role ID's as variables and them mention them in the embed not too sure
That's how I would do it
thank you for the help!
But last question i promise lol, even the callback that i want is async for the button so I put that in the init right?
uhm
just add it to when u sent th bot
I did not understand
ctx.channel.send(embed=embed, mention_strings)
can you help me continuin the .rang command
also what is the difference between bot.command, client.command, bot.event and client.event
Yeah I am not too sure on that one 😅
oooh
ummm
just replace what I said
client/bot is the same I think
event are like on_member_join, and so on
u didn't say anything
well u said it for me
ok so im using the wrong thing? i am using client.event
Does anyone know why the role id doesnt get sent to the SQL database?
have the mentioned user in the check instead of the author
ye I said I need to get the mentioned member
ok so where do u get that from
check_reaction = lambda reaction, user: user == ctx.member.mention and reaction.message == message
like this?
ctx.author is an object
yes, this is a command. client.command
ctx.member.mention is not, so no
no
ow
but remember your command arguments
.rang @ member @role
yes, so your member arg is a member object
would it be appropriate to use that perhaps?
so simply member?
yes
user == member
yes
ok
I joined with my alt account that i just created and it didnt get kicked?
still not works
send code
@bot.command()
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention}'" rang kérelme", icon_url=f'{ctx.author.avatar.url}')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction("✅")
check_reaction = lambda reaction, user: user == member and reaction.message == message
try:
reaction_added, user = await bot.wait_for('reaction_add', check=check_reaction, timeout=180)
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
if reaction_added == "✅":
await ctx.add_roles(role)```
it is like this now
do u see what u have done though
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
if reaction_added == "✅":
await ctx.add_roles(role)
if it times out, and the reaction is added, that makes literally 0 sense, they are counter intuitive
they contradict one another
I pay a person who helps me for me discord bot in python
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
else:
...
should I delete this part
do you understand try and except statements
wait
i think thats against the rules but i'm not sure
it's against the rules to hire someone here
no but i paid
what he does with his money outside of this server, I don't think we could care less
but yeah, to hire someone here is against the rules
kinda
!rule 9
I'm creating this command, I have to enter the argument (i.e. how much to win) and then the people who will play, only I find myself with this error: Command raised an exception: TypeError: soloVsoloreal() missing 1 required keyword-only argument: ' user '
Code: ```@client.command()
async def onlyVsoloreal(ctx, , arg, user: discord.Member):
embed = discord.Embed (title = f "New realistic 1v1 wager for {arg}", description = f "* Team 1 vs Team 2 {user} {user} **", color = discord.Color.green ())
embed.set_footer(text = f "{ctx.guild.name}")
await ctx.message.delete()
await ctx.channel.send(embed = embed)
What should come out of the command:
!soloVsoloreal 1dollar @user1 @user2
New realistic 1v1 wager for 1dollar @user1 @user2```
i paid yesss
follow this format @austere gust
its against the rules to offer a paid job btw
ok
why
in this server we encourage everyone to get better or learn python as its a very helpful skill especially in our generation
await ctx.send("it took to you long enough?")
else:
if reaction_added == "✅":
await ctx.add_roles(role)```
like this?
yeh
but i have the right to pay someone to help me
so i have ```py
class Button(disnake.ui.Button):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
class View(disnake.ui.View):
def init(self, *, data):
self.data = data
super().init(timeout=None)
for i in data:
button = Button(label = i, color=disnake.ButtonStyle.blurple)
button.callback = # here is the thing
For the `button.callback`, I want to put a async func that uses the `i` from the iterator
not in this server.
plus you can still ask for help as allot of regulars here doing for their own pleasure
ok
I would recommend making custom button class and making i the attribute of it so you can access it from callback
any alternative?
should I do asyncio.run?
can you even use it? with 2.0
disnake
same startup really
ah okay then yeah i think i can let me check
because they recommend to use asyncio.run so it takes ownership of its own loop so making another one would probably raise an error that theres already a loop running
How is that related to it
Still not
Assign i to your button object and access it in self of the callback
Idk why'd you need an alternative
yeah and making a new loop seems like it should be your last option
yup
send code & errors if u have any
class MyButton(Button):
def __init__(self, i, *args, **kwargs):
super().__init__(*args, **kwargs)
self.i = i
async def callback(self, inter):
self.i.do_something()```
if the object is a callable ofc
__call__ is responsible for making an object callable
yup
okay so the func i need requires an arg from the iteration i was doing
so pass it into the init?
Im trying to make it so that everytime an error happens my discord bot will send it out but it doesnt work what am I doing wrong? heres the code
@bot.event
async def on_error(ctx):
try:
1/0
except Exception as e:
print(e)
await ctx.send(e)
use on_command_error
but that just sends out when there is an command error
@bot.event
async def on_command_error(ctx, error):
await ctx.send(error)
wrong arguments...
and i already implemented that
!d discord.on_error
discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is
printed to stderr and the exception is ignored. If you want to
change this behaviour and handle the exception for whatever reason
yourself, this event can be overridden. Which, when done, will
suppress the default action of printing the traceback.
The information of the exception raised and the exception itself can
be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.10)")...
should not be played around with tbh
use try/except in your events if you want to handle their errors
@slate swan can you help?
sec
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention}'" rang kérelme", icon_url=f'{ctx.author.avatar.url}')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction("✅")
check_reaction = lambda reaction, user: user == member and reaction.message == message
try:
reaction_added, user = await bot.wait_for('reaction_add', check=check_reaction, timeout=180)
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
else:
if reaction_added == "✅":
await ctx.add_roles(role)```
hey so I see there is a limit of 50 channels per category in discord, this makes it difficult to use my ticket bot in a 70k user discord as it just throws exceptions because theres so many tickets, how can I solve this?
Not put them in a category?
the person who I made the bot for wants them to be in a category, specific to each type of ticket
and even If I dont, theres a hard 500 channel limit for servers I think
Well maybe do better upkeep on tickets
well what can I say, the client is bitching about it and theres really no answer I can give him
@full valley
He is gonna have to learn that he needs to do better upkeep
alright ima tell him that
You can't bypass the limits
make another category or something else
if reaction.emoji ==
I am creating a command, and when invoked I want it to create a channel in addition to what it did before, but private (between the users mentioned and a role) how can I do?
where is this
half Hungarian half English response tells me something's wrong here
it is just a test
how did you noticed that it is hungarian?
I myself am
you are hungarian?
for if reaction_added ==
Consider switching to Thread channels, you can have 1000 active ones at a time iirc, so double the 500 limit of regular channels. Plus they can end up being cleaner to implement
huh?
else:
if str(reaction_added.emoji) == ":white_check_mark:":
await ctx.add_roles(role)
ohh there
wait, so you are hungarian?
yes
does it work now?
!d discord.Member.add_roles
not ctx
No documentation found for the requested symbol.
no
wait...
it was converted to :white_check_mark: by itself
yeah it's member.add_roles
yeah wtf
....am I mad...
didn't even notice
LMAO
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to
use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list
of roles than the highest role of the member.
no ur not
this bot hates you
i had the fattest mind blank
so I change to member ?
straight up hates u
yes
im done, my evening is totally blessed today
is what
Is there something like: @commands.has_id()?
what even should I take this for
still not
sarcasm
meh
no?
hmm
you could make a custom check for that
yes, await member.add_roles()
Like this right?
if ctx.message.author.id == 541240296453832735:
done
please remove message
why?
!d discord.ext.commands.check
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").
These checks should be predicates that take in a single parameter taking
a [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event...
def has_id():
async def inner(ctx):
if ctx.author.id == ....:
return True
return False
return commands.check(inner)
@has_id()
@bot.command()
...
Thx! ❤️🔥
not works
wont make much of a difference, it just grabs the message object and gets its author
that's exactly why I hate it
I read it as you for some reason 😔
and it even cost time writing it
omg depri 😱
lmao tf
yeah
what an own goal
tf
(bri'ish accent) da foke, dis blody bot
it's messing with you, ya hear
that's the bri'ish foke
im not british doe
how'd you say it
eh, it's mid
!ot !ot !ot !ot !ot !ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
youre missing the function argument in the deco function
uh?
not works
shhow code
good nighto have a good sleep
And return for the commands.check

What are the best libraries to make a bot in Python?
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention}'" rang kérelme", icon_url=f'{ctx.author.avatar.url}')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
message = await ctx.send(embed=rangembed)
await message.add_reaction("✅")
check_reaction = lambda reaction, user: user == member and reaction.message == message
try:
reaction_added, user = await bot.wait_for('reaction_add', check=check_reaction, timeout=180)
except asyncio.TimeoutError:
await ctx.send("done")
else:
if str(reaction_added) == "✅":
await member.add_roles(role)```
disnake, the good ol discord.py, hikari
discord.py
hikari
is what ill suggest
None, use the Raw API 😉
robin wants his helper role taken away
Tell me everyone who has it (only those who support Slash Commands and Interaction)
I agree with u
me still wondering what a raw api is
like using aiohttp and manually sending requests to the Discord API
In all seriousness though I would really recommended working with the raw API just because it’s an excellent learning resource when it comes to dealing with APIs and requests
This discord.py is discontinued
thats nothing to do with an api being "raw", every api needs requests
nope, its back
😳
While we’re talking about APIs, we have a lil something for you all soon that you’re gonna like 😉 my lips are sealed so I can’t say more
u get the idea
😳 😏
Though ill still insist you to have a look at hikari
Gonna PayPal you 69 cents if u open that mouth of yours 👀
🤐
ill donate 69,420 cents😳 😏
That is like 70 USD
@slate swan :white_check_mark: Your eval job has completed with return code 0.
69 4.2
😳
Well
im so rich i bought discord😳
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.

ot
how can I make an optional option (discord interactions)
@austere gust I did it myself and it works
!pypi discord-interactions
wtf?
I did rewrite things to my preference but here:
@bot.command()
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention} rang kérelme')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
msg = await ctx.send(embed=rangembed)
await msg.add_reaction("✅")
def check(reaction, user):
return user == member and reaction.message.id == msg.id
try:
reaction, user = await bot.wait_for('reaction_add',timeout=180, check=check, )
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
else:
if str(reaction.emoji) == '✅':
await member.add_roles(role)
See what I changed and compare
What library?
u know they have a discord right
so use that code and tell me if it works
Why are most of the values cast to str? Library already does that for you.
wasnt me
discord.py (Rapptz)
ye#
Just make it a kwarg.
it will add mthe role 3mins later
?
thanks
code:
@bot.command(name="lnk")
async def lnk(ctx, link):
print(Fore.YELLOW + ctx.message.content + Fore.WHITE)
#assuming this is inside a command
# I recommend creating a single ClientSession and storing it in a botvar
async with aiohttp.ClientSession() as session:
image = await session.get(link)
async with aiofiles.open('image.png', 'wb') as f:
await f.write(image.content)
await ctx.send("image underneath", file=discord.File("image.png"))
what?
why would it add it 3 mins later
idk, not works for me 💀
the error:
Starting Bot
Connecting to Discord API.
Please Wait
Loading Developer Features cog
[✓][Developer Features Cog] Loading Complete
Connected!
Bot is ready!
Waiting For Commands
$lnk https://cdn.discordapp.com/attachments/798726720181633047/968876223637893210/unknown.png
Ignoring exception in command lnk:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 169, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 114, in lnk
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/aiofiles/threadpool/utils.py", line 45, in method
return (yield from self._loop.run_in_executor(self._executor, cb))
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
TypeError: a bytes-like object is required, not 'StreamReader'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/bot_base.py", line 570, in invoke
await ctx.command.invoke(ctx)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 920, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 178, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: a bytes-like object is required, not 'StreamReader'
does the bot have the right perms?
what errors is it giving?
yes
nothing
thats hard to believe
do u want to get in a call quickly and show me
ok nvm them im sleeping
my internet
bad af
terminal empty
Nothing is even executed yet
hmm idk what i did wrong
well idk man
@bot.command()
@commands.has_permissions(ban_members=True)
async def rang(ctx, member: discord.Member, *, role: discord.Role, reason=None, ):
await ctx.message.delete()
rangembed = discord.Embed(colour=0xfecb01)
rangembed.set_author(name=f'{ctx.message.author.mention} rang kérelme')
rangembed.add_field(name='Név: ', value=f"{member.mention}")
rangembed.add_field(name='Rang: ', value=f"{role.mention}")
rangembed.add_field(name='Indok: ', value=f"{reason}")
msg = await ctx.send(embed=rangembed)
await msg.add_reaction("✅")
def check(reaction, user):
return user == member and reaction.message.id == msg.id
try:
reaction, user = await bot.wait_for('reaction_add',timeout=180, check=check, )
except asyncio.TimeoutError:
await ctx.send("it took to you long enough?")
else:
if reaction.emoji == '✅':
await member.add_roles(role)
tested again, works perfectly fine
you using dpy 2.0?
no
well well well
'it took to you long enough'
how to fix?
should still give u errors
so either ur looking in the wrong place, or something idk
Put a comma between ][
ah yes valid grammar
have a look here https://github.com/Rapptz/discord.py/blob/master/examples/reaction_roles.py @austere gust
I dont know 2.0 so cant help much sorry
ok
can you paste the code here?
how do i add an animated emoji to an embed? https://cdn.discordapp.com/emojis/836234327016210482.gif?v=1
Mind if I steal that emoji lol
sure its not mine xd
@client.command()
async def accept(ctx, member: discord.Member = None):
role3 = discord.utils.get(ctx.guild.roles, id = 970137834583380009)
role4 = discord.utils.get(ctx.guild.roles, id = None)
channel = discord.utils.get(ctx.guild.channels, id = 970646657161134091 )
author = ctx.message.author
#json
toprole = author.top_role
data = [
{"Role": f'{toprole}'},
{"ID": f'{author.id}}
]
with open('jsons\\acceptes.json', 'a', encoding = 'utf-8') as write_file:
json.dump(data, write_file, indent = 4, ensure_ascii=False)
thx lol. idf you have any more like that feel free to dm them to me lol. wait are you uing better discord?
nope
its just a https link
you are missing a ' after f'{author.id}
howd you get the link lmao
right click on the emoji
ah
i found it on stackoverflow while trying to find out how to embed a animated emoji
it's all?
embed.set_image() ? @exotic maple
any ideas on how to fix this error lmao
good morning
u do <a:name:id>
seems like it
I’m addicted 
alright
no comments
fix that and try the code again
its a gif which is an emoji
(((
its not, its a animated emoji
i got it working now tho as an emoji
animated
Ok well i’ll actually sleep now then 💀
add the comma that was reccomended earlier and try again
a comma between ][ -> ],[
someone else will have to help ig. i dont understand json much myself ¯\_(ツ)_/¯
U can't have 2 lists inside a json
U gotta move those inside another list
@commands.command(name="rate")
@commands.cooldown(1, 20, commands.BucketType.user)
async def rate(self,ctx,member: discord.Member=None, rating=None, *, reason=None):
await ctx.message.delete()
with open("debug.stonks","r") as f:
debugchannel = int(f.read())
f.close()
debugchannel2 = self.bot.get_channel(debugchannel)
membermention = member.mention
pfp = member.avatar_url
guildicon = ctx.guild.icon_url
if member == None:
await ctx.send("Use -help to figure out params")
return
``` if you simply type -rate so that member is nothing it doesn't do anything, it doesn't send the message or send any errors.
how can i fix this?
your error is getting swallowed then, because you should absolutely get a AttributeError
but why make it None anyway as a default?
what you can do is check what member is. Perhaps its jumbling the args. The converter should handle this but I'm not sure if its different if you assign it a default value
the best practice is also to check for None equality with if member is None
Where could I host my bot 24/7 free or really cheap? And also that no one can look at the code?
for animated emojis.. Why in other guilds does it just show this instead?
how to make the bot create a role and immediately get it id to give out a user?
<a:name:id> is what you should use
Ive done that but in some guilds it wont allow it
it just shows :emojiname:
VPS are usually like $5/month. You might find one cheaper
your bot does not have external emojis permission in those servers
Need to run your bot 24/7? Get a cheap VPS.
https://www.scaleway.com/ EU https://www.linode.com/ US/EU/Asia
https://www.digitalocean.com/ US https://www.vultr.com/ US
https://www.ovh.co.uk/ EU/Canada https://www.hetzner.com/ Germany/US
https://www.time4vps.eu/ Lithuania.
Self-hosting: Free hosting: Kinda free:
Any computer. No. Not even heroku. GCP, AWS have one year free micros.
it does...
Traceback (most recent call last):
File "C:\Users\User\Desktop\discord bot\bot.py", line 6, in <module>
bot=commands.Bot(command_prefix="k.")
TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'```
hmmm
thx
not work
what it?C:\Users\User\Desktop\discord bot\bot.py:15: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(f"cogs.{filename[:-3]}")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
what to do?
how long do you have to wait?
Thx
?
=1
second
async def my_function(bot):
... # cog load stuff
bot.setup_hook = my_function
``` would work too
difficult, i want an older version
hmmm
ok, thx so much
or a task😳
or use hikari
bro
or dont use python and go outside and have a family
Touch grass? I think not
ew grass
how to make the bot create a role and immediately get it id to give out a user?
role = await Guild.create_role(...)
``` role.id would be its ID
await Member.add_roles((await Guild.create_role(...)))
```😳
curse you okimi
!d discord.Guild.create_role
await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") for the guild.
All fields are optional...
😧
key word args, and its name, not an id 🗿
i forgot
fixed it
😔go completely your wrapper.
no
i need suggestions on how to get better at making library abstractions😔
I need suggestions on motivation
I'm doing too much at once tbh. I should just stop programming and focus more on exams
Imma study physics until i accept that I don't like it
i hate physics
I find higher level mathematics significantly easier than mere Physics
Just built different
The only math I've used is basic math for excel magic
The rest I don't care about. Or is made up shit graphs and trendlines on context-lacking datasets that support a biased opinion
Tangent: The notion you can't argue data is arguably false
Maths teaches problem solving
I'm sure you've problem solved in your life before
You’ll eventually need math when programming. Mostly related to algorithms
@bot.command()
async def createInvites(ctx):
invites = []
for guild in bot.guilds:
for c in guild.text_channels:
if c.permissions_for(guild.me).create_instant_invite:
invite = await c.create_invite(xkcd=True, max_age=0, max_uses=0)
invites.append(invite)
break```
```discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers``` Can someone tell me why this errors?
how is that related to my statement?
luckily enough, that's not as true for python as for other languages
cuz programmer
Isn’t python the most popular language for like machine learning or data analysis?
Maybe you've not used it directly, but it's not like it's a waste of time like you make it out to be
Anyone?
Haha yes. I take it back
is this all of the error that you get?
I've got 4 courses in my school of which I gotta choose one, two of them are designing, one's some practical work thing and one's for science, will it come in handy for programming if I choose science?
off-topicn't I saw the dialogue and took my chance
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\llVll\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers```
I don't believe that error is pointing to that piece of code since I'm not seeing you indexing strings
no
well I'm gonna choose it anyways
But later down the line you might find a use for python if you go into a science field
yes
max_uses = 0, whats the point of creating that invite?
or is that even possible?
Full traceback please
@bot.command()
async def createInvites(ctx):
invites = []
for guild in bot.guilds:
for c in guild.text_channels:
if c.permissions_for(guild.me).create_instant_invite:
invite = await c.create_invite()
invites.append(invite)
break
print(invites)```
Also, never saw a xkcd kwarg
Looking at the persons GitHub, they seem to be quite the selfbot developer
That's enough
🏂
This is a bit of a gray zone
Discord's developer policy does mention things about explicit permisison
There's nothing to indicate that he's going to invite himself to servers where his bot has been invited
which is what I think this argument is about
otherwise, I don't see an issue in generating invites via the bot
it seems sus as hes saving the invites tho
Generating invites for servers in itself is not that bad
What are you planning on doing with the invites, anyway?
everyone agrees with me
making invites isnt bad at all but saving them???
assume
I mean, making invites in itself you could consider a violation because it's not like your bot can use them
and what do they say about people who assume??
just saw that
exactly
thats even worse
I would personally argue this is in violation of Discord's developer policy
ye gg bro no re
thats still pretty much creating a back door
hes going through all guilds and making invites for all guilds and idk why would discord allow that anyways?
I think people are misunderstanding what I said - if you're using your bot to create invites, it's most likely for yourself since invites are not necessary for a bot:
use Discord Data for any purpose other than as necessary to provide your application;
um why not
idk everytime i come here someone thinks i'm trying to ABUSE THE SYSTEM
because invites should really only be made from personal of the server
i do my stuff for educational purposes, therefor it's not in violation of anything
We want to err on the side of safety
In general, since I think it's not fully clear what the intention of the person is, rule 5 applies
well back to my original question, why was i getting that error?
Educational intent or not, it's still bordering on TOS violation
And that should be the end of that
reminds me of the indian tutorials that say its for educational purposes hahaha😭
but what can he do with the invites
Distribute them
but it isn't?
bro
invite other people
If I found out a bot in my server was collecting invites of my server, I would find that surprising
YE BRO, GONNA GO INTO MY VAN AND GET KIDS AND DEAL THEM SOME DISCORD INVITES
I'd be happy about that 😄
Fine text isn't going to cut it
if ur creating a discord invite, the owners / owner make it so that the server invites are public or that u can create one, it is fully concented
A server invite isn't "user data"
@slate swan just wants to put a bounty on my head

dunno what i did to him
use Discord Data for any purpose other than as necessary to provide your application;
An invite to every single channel of every single guild is not necessary to provide for your application
If the owner(s) don’t know, yes it’s TOS!!
thats like doing oh wow cool bot let me invite it to my server and then it makes a back door/unapproved invite and then it keeps them and does whatever with them
my bot is private
Which falls into the last bit, don't do anything that violates user's expectations
only my server uses it
yeah
Like bones mentioned, this does seem to be bordering on rule 5, and we can't be sure of your intentions so we can't really help you out
u think it's funny?
then why looping through all guilds
as i said, i'm testing stuff
