#discord-bots

1 messages · Page 1036 of 1

frozen patio
#

Good 🙂

paper sluice
#

~~yes, ~~no wait its self.add_view if u subclassing

nimble plume
#

Ryuga thanks for help

forest bramble
#

so if I want another command, should I do @bot.command() again or once is enough?

frozen patio
placid skiff
#

You know that you've already called them only by saying that word D_D

slate swan
#

hi

paper sluice
#

sup brad

quaint epoch
# slate swan again

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?

slate swan
frozen patio
#

Rickroll kek

quaint epoch
forest bramble
quaint epoch
forest bramble
velvet compass
# paper sluice sup brad

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

slate swan
quaint epoch
frozen patio
#

Really nice to use and such

slate swan
#

..

paper sluice
slate swan
#

bot too

forest bramble
#

@slate swan @frozen patio

slate swan
#

pip install nextcord

#

goto shell

forest bramble
placid skiff
frozen patio
#

Breh

forest bramble
frozen patio
#

I know Sparky

spring flax
frozen patio
#

I am trying to make a flask API while learning data structures

slate swan
#

.

quaint epoch
#

ig, im missing the context

paper sluice
slate swan
placid skiff
#

Welcome to discord bots channel, where people think that they can develop a bot using a python package without knowing python D_D

spring flax
#

oh okay

spring flax
forest bramble
#

so nvm

frozen patio
#

Also

paper sluice
frozen patio
#

Why are you using repl

slate swan
pallid meadow
forest bramble
placid skiff
slate swan
frozen patio
forest bramble
forest bramble
pallid meadow
forest bramble
#

so now

frozen patio
spring flax
slate swan
forest bramble
slate swan
forest bramble
forest bramble
#

all the time

slate swan
placid skiff
forest bramble
slate swan
#

smh

frozen patio
#

XD

forest bramble
#

@slate swan no how do I do kick and ban and mute cmds with this code?

slate swan
forest bramble
#

I just need to understand it

frozen patio
#

We can't spoonfeed you

slate swan
#

what's a PPS supposed to mean....

forest bramble
frozen patio
slate swan
unkempt canyonBOT
#

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.

forest bramble
frozen patio
#

It plugs into a VPS

slate swan
#

makes sense

paper sluice
forest bramble
frozen patio
placid skiff
forest bramble
frozen patio
forest bramble
#

ok

forest bramble
slate swan
#

why host a bot which is not good enough to pay for :0

frozen patio
#

I bought it so I can have my bots on

pallid meadow
forest bramble
placid skiff
forest bramble
#

not with coding

frozen patio
#

well very similiar

slate swan
pallid meadow
#

Disnake is where it’s at

frozen patio
#

eh

slate swan
frozen patio
#

I need to learn disnake

slate swan
#

since they are rewriting everything

frozen patio
pallid meadow
slate swan
frozen patio
#

I am into Flask tho kek

placid skiff
frozen patio
paper sluice
slate swan
frozen patio
#

I am making an API in flask

pallid meadow
slate swan
placid skiff
# pallid meadow Not really no

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

slate swan
#

in addition they added ActionRows which you don't really need to use

#

anyways, ot

spring flax
#

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
frozen patio
#

You might be indenting the button wrong

pallid meadow
frozen patio
#

You usually don't nest it

paper sluice
pallid meadow
#

Nextcord has load_extensions() right?

frozen patio
#

Yes

spring flax
#

oh so i do add_view() on the func?

placid skiff
#

Cogs are universal

heady sluice
#

in an arg

pallid meadow
spring flax
placid skiff
paper sluice
pallid meadow
#

Not extension

placid skiff
#

Oh

#

nvm

pallid meadow
frozen patio
#

Yes

#

I use it alot

pallid meadow
#

No Ik

spring flax
pallid meadow
#

I was just referencing my message

frozen patio
#

Oh

paper sluice
spring flax
#

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

heady sluice
#

pass weapon to it as an arg

#

can't you do that

spring flax
#

not sure

paper sluice
#

!d disnake.ui.Button

heady sluice
#

like weapon=weapon

unkempt canyonBOT
#

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.
heady sluice
#

async def confirm(..., weapon=weapon)

slate swan
#

disnake 2.0?

heady sluice
#

what

slate swan
#

new in version 2.0

spring flax
spring flax
slate swan
heady sluice
#

you do whatever you want with it

placid skiff
slate swan
paper sluice
#
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

spring flax
# paper sluice ```py for weapon in _all: button = discord.ui.Button(label=..., style=...) ...

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

unkempt canyonBOT
paper sluice
#

global?

spring flax
paper sluice
#

!d disnake.ui.View

unkempt canyonBOT
#

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.
paper sluice
#

like lambda *args(what ever args u want): asyncio.run(send_build(weapon))

spring flax
spring flax
kind scaffold
#

how to make discord bots?

paper sluice
heady sluice
#

make the whole thing an async function and run it

slate swan
#

depends on the situation

heady sluice
#

or just use the previous method with the arg

paper sluice
spring flax
slate swan
paper sluice
#

wait... its a lambda inside a function why the fuck does it need self, can u show the full traceback?

spring flax
kind scaffold
forest bramble
#

How do I create an event in this code @slate swan?

#

The code is working

slate swan
paper sluice
#

like

class Confirm(disnake.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
    def method(self):
         _all = asyncio.run(get_top_weapons())
         ...
placid skiff
spring flax
#

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
paper sluice
#

just await

slate swan
slate swan
#

lmao why that emoji

#

@slate swan miru doesnt support modals 😔

placid skiff
slate swan
heady sluice
paper sluice
#

stop with the spoilers

forest bramble
#

I'm dying trying to catch up to Nextcord

forest bramble
#

@placid skiff What have I done to u eh? Trying to mess my experience

slate swan
#

install it from git

heady sluice
placid skiff
heady sluice
#

he indeed sounds like raging

#

sarcasm

placid skiff
slate swan
# slate swan ohh ic

yay, and you may probably need to install sadru's pull request branch too ( the commands are in miru channel's pins)

forest bramble
slate swan
#

like an embed of the preview of the message

austere gust
#

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

placid skiff
austere gust
#

yes

exotic maple
austere gust
#

like this

austere gust
exotic maple
austere gust
placid skiff
# austere gust yes

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

exotic maple
#

so

if reaction

elif reaction

austere gust
#

like this?

placid skiff
austere gust
placid skiff
#

and the parameter of the deco should be a string

#

bot.listen("on_raw_reaction_add")

austere gust
#

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?

placid skiff
#

yeah
to be sure name the two functions differently

austere gust
#

ok

#

Thaaank you so muuuch 😄

placid skiff
#

np

austere gust
#

Can I ask help with an other thing?

placid skiff
#

of course

austere gust
#

It is bigger 😄

placid skiff
#

let's see if i can help

full valley
#

hey guys

#

whats the best replacement for dpy

rapid knoll
#

how to I fix ModuleNotFoundError: No module named 'typing_extensions' ?

placid skiff
#

depends what you prefer
I use disnake

full valley
placid skiff
full valley
#

and are there modals, buttons, selects etc.

austere gust
#

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

placid skiff
placid skiff
full valley
#

damn, very nice

rapid knoll
placid skiff
austere gust
placid skiff
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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...
full valley
placid skiff
edgy mantle
#

Is there a way to detect when a user's nickname is chhanged?

placid skiff
#

because for the event he will need some parameter that he will not have untill the command is cast

placid skiff
austere gust
austere gust
#

I know

#

but this is too big for me

full valley
#

read the docs and look how it is used

austere gust
#

it shows on_message

#

bruh

full valley
#

yeah well u dont have to copy that bit

austere gust
#

bruh I have totally no idea help me pls 😄

full valley
#

Ok so you put the wait_for under the command that you want to be reacted to

full valley
#

show your code

austere gust
#
@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():```
full valley
#

ok so no, you dont need an event listener

austere gust
#

uh?

full valley
#

the wait_for is not event, its incorporated into your rang command

#

should be incorporated*

austere gust
#

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?

full valley
#

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

austere gust
full valley
#

right

austere gust
#
@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?
full valley
#

no, look how wait_for is used in the examples

slate swan
#

Does mimo is a good app to learn python?

full valley
#

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('👍')
placid skiff
# austere gust bruh I have totally no idea help me pls 😄
@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

slate swan
austere gust
full valley
#

no that is your rang command

#

the same format

sick birch
#

That's a good starting place, to see if people have ever heard of it

slate swan
austere gust
slate swan
full valley
# austere gust what to put #your_stuff? the command?
@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

slate swan
#

yea, there's another easter egg related to it too

#

which replaces tenor with txnor

#

yes?

#

My bad.

full valley
#

thats exploiting the api

rancid aspen
#

I want to understand each topic one by one, so for now I have to understand the repetition of work 😅

slate swan
#

i learned a bit with it but its explaining and everything is garbage

fast musk
#

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

full valley
#

@placid skiff question regarding disnake if i may, can you make a command both message(prefix) and slash?

sick birch
#

Especially since one VPS can host multiple bots

spring flax
#

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?

sick birch
#

I don't believe you're creating views corretly

austere gust
#
@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?

sick birch
#

If you want buttons, use the disnake.ui.button decorator

spring flax
sick birch
#

Then you probably want a more dynamic approach, in which case you should subclass discord.ui.Button AND discord.ui.View

fast musk
spring flax
full valley
#

does that not look wrong to you

sick birch
#
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

austere gust
full valley
#

ok but who would the author be?

austere gust
#

idk

spring flax
sick birch
#

A single button and its callback

#

If each button has to be different, you can take in the needed information from the constructor

spring flax
#

so the callback would be a function

sick birch
#

Yes, and it has to be async def callback(...):

spring flax
#

oh no i mean that the callback i want for the button is an already made function

sick birch
#

Migrate that into the new callback

austere gust
sick birch
#
class Button(discord.ui.Button):
  def __init__(...):
    ...

  async def callback(...):
    ...
spring flax
#

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)
full valley
spring flax
austere gust
#

ye I know but I am too dumb for me

full valley
#

which in this case is the bot

sick birch
full valley
#

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

austere gust
full valley
spring flax
austere gust
full valley
#

why not?

sick birch
full valley
austere gust
#

yes it is

#

oh I understand

sick birch
full valley
#

so, what would you need to change for your check

austere gust
#

in the code user = author

full valley
#

and...

austere gust
#

I understand it now lol

full valley
hybrid ravine
#
@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?
sick birch
#

It has to be an integer

austere gust
sick birch
#

Not a string

austere gust
#

not the bot

hybrid ravine
slate swan
#

I want to make a command with spaces but it says command "antibot" is not found? How could i make a command with spaces? shy_duck

hybrid ravine
slate swan
fast musk
#

commands.group

sick birch
#

Or you're just looking for the boolean typecast

#
async def antibot(..., status: bool):
  ...
#

!antibot on -> status = True
!antibot off -> status = False

hybrid ravine
hybrid ravine
sick birch
#

hmm

fast musk
#

ids are integers, not strings

hybrid ravine
fast musk
spring flax
# sick birch `super().__init__(label=..., color=..., ...)`

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:
sick birch
#

According to the documentation, get_user should return a discord.User

#

I suspect it's because you're doing it inside on_ready?

full valley
#

strange, cant say ive ever tried a dm in on_ready

sick birch
#

I would refrain from sending any API requests on_ready

fast musk
#

Is that id you are passing it @hybrid ravine to your bot?

hybrid ravine
fast musk
#

what is yours? Your user or your bots?

full valley
#

he said its his id

sick birch
fast musk
#

Yeah, but people can be wrong.... to Robin's point, this is an unexpected return type

#

I'm checking in another server

spring flax
sick birch
#

Then do your data fetching inside the command and pass it to your view

spring flax
#

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(
sick birch
#

Close but not quite

fast musk
#

I don't work with views often, but I suspect callback expects a coroutine

#

and not the result

spring flax
#

yeah it is a coro got cut off

fast musk
#

but you are awaiting it

#

can't call back something that has been invoked to a literal

sick birch
#
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, ...)
fast musk
#

920051517514453022 @hybrid ravine

#

that is your id

#

which is not what you were passing in

sick birch
#

I suspected as much

fast musk
#

even the discord.py server is like "wtf it shouldn't return a ClientUser"

sick birch
#

You're probably passing in your bot's ID which may be why it's returning a Clientuser

hybrid ravine
sick birch
#

Yeah that sounds about right

fast musk
#

haha

#

good lesson
Are you sure its your id?
Ok, but are you positive?
Ok I get that... but did you cheeeeccckkkk?

#

😄

hybrid ravine
#

😭🤣

austere gust
rapid knoll
#

how do you get bots to add roles to users

frozen patio
frozen patio
austere gust
rapid knoll
river kindle
#

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?

frozen patio
river kindle
# fast musk 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)```
frozen patio
#

Why are you deleting?

river kindle
river kindle
frozen patio
#

Okay then

austere gust
# rapid knoll yes
@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}")```
frozen patio
#

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

spring flax
river kindle
full valley
river kindle
full valley
#

ctx.channel.send(embed=embed, mention_strings)

austere gust
rapid knoll
frozen patio
river kindle
full valley
#

just replace what I said

austere gust
#

event are like on_member_join, and so on

austere gust
full valley
rapid knoll
exotic maple
#

Does anyone know why the role id doesnt get sent to the SQL database?

full valley
#

have the mentioned user in the check instead of the author

austere gust
full valley
#

ok so where do u get that from

austere gust
#

like this?

full valley
#

ctx.author is an object

austere gust
full valley
#

ctx.member.mention is not, so no

austere gust
#

oh yeah its action

#

simple ctx.member exist?

full valley
#

no

austere gust
#

ow

full valley
#

but remember your command arguments

austere gust
#

.rang @ member @role

full valley
#

yes, so your member arg is a member object

#

would it be appropriate to use that perhaps?

austere gust
#

so simply member?

full valley
#

yes

austere gust
#

user == member

full valley
#

yes

austere gust
#

ok

slate swan
#

I joined with my alt account that i just created and it didnt get kicked?

austere gust
full valley
#

send code

austere gust
#
@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)```
full valley
#

ok so u are adding your reactcion_added under your timeout error?

#

reaction*

austere gust
full valley
#

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

slate swan
#

I pay a person who helps me for me discord bot in python

full valley
#
    except asyncio.TimeoutError:
        await ctx.send("it took to you long enough?")
    else:
        ...
austere gust
full valley
#

do you understand try and except statements

austere gust
#

wait

slate swan
heady sluice
slate swan
heady sluice
#

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

austere gust
slate swan
slate swan
unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

river kindle
#

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```

slate swan
#

i paid yesss

full valley
slate swan
austere gust
slate swan
# slate swan why

in this server we encourage everyone to get better or learn python as its a very helpful skill especially in our generation

austere gust
#

like this?

full valley
#

yeh

slate swan
#

but i have the right to pay someone to help me

spring flax
#

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
slate swan
#

plus you can still ask for help as allot of regulars here doing for their own pleasure

#

ok

vale wing
spring flax
#

should I do asyncio.run?

slate swan
#

can you even use it? with 2.0

spring flax
#

disnake

slate swan
#

same startup really

spring flax
#

ah okay then yeah i think i can let me check

slate swan
#

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

vale wing
austere gust
vale wing
#

Idk why'd you need an alternative

slate swan
#

yeah and making a new loop seems like it should be your last option

vale wing
#

Wtf for do you need to involve loops into that

#

It is simple encapsulation

slate swan
#

yup

full valley
vale wing
#
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()```
slate swan
#

if the object is a callable ofc

vale wing
#

__call__ is responsible for making an object callable

slate swan
#

yup

spring flax
#

so pass it into the init?

vapid grove
#

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)
vapid grove
#

but that just sends out when there is an command error

slate swan
#
@bot.event
async def on_command_error(ctx, error):
    await ctx.send(error)
#

wrong arguments...

vapid grove
#

and i already implemented that

slate swan
#

!d discord.on_error

unkempt canyonBOT
#

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)")...
slate swan
#

never see that event

#

that doesn't take a "context"

#

check the function name

slate swan
#

use try/except in your events if you want to handle their errors

spring flax
austere gust
#
@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)```
lethal moat
#

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?

lethal moat
#

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

frozen patio
#

Well maybe do better upkeep on tickets

lethal moat
#

well what can I say, the client is bitching about it and theres really no answer I can give him

frozen patio
lethal moat
#

alright ima tell him that

frozen patio
#

You can't bypass the limits

slate swan
river kindle
#

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?

austere gust
heady sluice
austere gust
heady sluice
#

I myself am

austere gust
#

you are hungarian?

full valley
pliant gulch
austere gust
heady sluice
#
    else:
        if str(reaction_added.emoji) == ":white_check_mark:":
            await ctx.add_roles(role)
austere gust
#

ohh there

austere gust
heady sluice
#

yes

full valley
slate swan
unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

austere gust
slate swan
#

wait...

heady sluice
full valley
#

oh wait

heady sluice
#

yeah it's member.add_roles

full valley
#

yeah wtf

slate swan
heady sluice
#

didn't even notice

full valley
#

LMAO

heady sluice
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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.
full valley
#

no ur not

heady sluice
full valley
#

i had the fattest mind blank

austere gust
#

so I change to member ?

heady sluice
#

straight up hates u

heady sluice
slate swan
heady sluice
#

is what

craggy cloak
#

Is there something like: @commands.has_id()?

heady sluice
#

what even should I take this for

austere gust
#

still not

slate swan
heady sluice
#

meh

craggy cloak
#

hmm

slate swan
full valley
craggy cloak
austere gust
heady sluice
craggy cloak
cloud dawn
unkempt canyonBOT
#

@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...
slate swan
#
def has_id():
      async def inner(ctx):
          if ctx.author.id == ....:
                return True
          return False
      return commands.check(inner)

@has_id()
@bot.command()
...
craggy cloak
#

Thx! ❤️‍🔥

austere gust
full valley
#

SEND CODE

#

woops caps

slate swan
heady sluice
#

that's exactly why I hate it

slate swan
heady sluice
#

and it even cost time writing it

heady sluice
slate swan
#

lmao tf

slate swan
heady sluice
#

what an own goal

quaint epoch
#

(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

unkempt canyonBOT
slate swan
#

uh?

full valley
#

im going to sleep

austere gust
full valley
#

shhow code

slate swan
cloud dawn
maiden fable
cosmic pine
#

What are the best libraries to make a bot in Python?

austere gust
# full valley shhow 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("✅")
    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)```
maiden fable
slate swan
sick birch
slate swan
#

robin wants his helper role taken awaylemon_glass

cosmic pine
#

Tell me everyone who has it (only those who support Slash Commands and Interaction)

maiden fable
slate swan
maiden fable
slate swan
#

a uncooked api

#

😳

sick birch
#

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

cosmic pine
slate swan
slate swan
cosmic pine
sick birch
#

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

slate swan
#

Though ill still insist you to have a look at hikari

maiden fable
sick birch
#

🤐

slate swan
#

ill donate 69,420 cents😳 😏

maiden fable
#

That is like 70 USD

slate swan
#

okimii is rich

#

doesnt care

#

!e print(69,420 / 100)

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

69 4.2
slate swan
#

😳

maiden fable
#

Well

slate swan
slate swan
unkempt canyonBOT
slate swan
vale wing
#

ot

slate swan
#

how can I make an optional option (discord interactions)

full valley
#

@austere gust I did it myself and it works

cloud dawn
#

!pypi discord-interactions

unkempt canyonBOT
full valley
#

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

cloud dawn
full valley
full valley
cloud dawn
slate swan
slate swan
cloud dawn
austere gust
#

?

slate swan
flint isle
#

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"))
full valley
austere gust
#

it should add immidiately

full valley
#

why would it add it 3 mins later

austere gust
flint isle
# flint isle code: ```py @bot.command(name="lnk") async def lnk(ctx, link): print(Fore.YE...

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'
full valley
#

what errors is it giving?

austere gust
austere gust
full valley
#

thats hard to believe

#

do u want to get in a call quickly and show me

#

ok nvm them im sleeping

austere gust
#

bad af

#

terminal empty

cloud dawn
austere gust
#

wdym

#

the bot is running

full valley
#
@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

austere gust
full valley
#

no

austere gust
#

eh

#

I do use 2.0

full valley
#

well well well

cloud dawn
#

'it took to you long enough'

terse coyote
#

how to fix?

full valley
#

so either ur looking in the wrong place, or something idk

cloud dawn
terse coyote
#

im tried

flint isle
full valley
#

I dont know 2.0 so cant help much sorry

austere gust
#

ok

flint isle
exotic maple
exotic maple
terse coyote
# flint isle can you paste the code here?
@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)
flint isle
flint isle
slate swan
flint isle
exotic maple
#

i found it on stackoverflow while trying to find out how to embed a animated emoji

terse coyote
full valley
#

embed.set_image() ? @exotic maple

flint isle
slate swan
flint isle
full valley
exotic maple
slate swan
flint isle
full valley
#

not an emoji

slate swan
terse coyote
exotic maple
#

i got it working now tho as an emoji

#

animated

full valley
#

Ok well i’ll actually sleep now then 💀

flint isle
slate swan
terse coyote
#

1 min

flint isle
#

someone else will have to help ig. i dont understand json much myself ¯\_(ツ)_/¯

maiden fable
#

U gotta move those inside another list

slate swan
#
    @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?
fast musk
#

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

slate swan
#

Where could I host my bot 24/7 free or really cheap? And also that no one can look at the code?

exotic maple
#

for animated emojis.. Why in other guilds does it just show this instead?

terse coyote
#

how to make the bot create a role and immediately get it id to give out a user?

slate swan
exotic maple
#

it just shows :emojiname:

fast musk
slate swan
fast musk
slate swan
#
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

slate swan
#

bro

#

or dont use python and go outside and have a familylemon_glass

stone beacon
#

Touch grass? I think not

slate swan
#

tell that to yourself, okimi

#

touch grass guys!

slate swan
terse coyote
#

how to make the bot create a role and immediately get it id to give out a user?

slate swan
#
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

unkempt canyonBOT
#

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...
slate swan
#

😧

#

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😔

stone beacon
#

I need suggestions on motivation

#

I'm doing too much at once tbh. I should just stop programming and focus more on exams

slate swan
#

no

#

forget exams and fail😳

stone beacon
#

hell naw

#

If I screw this up I can kiss uni buh bye

slate swan
#

be like me fail school but not python😭

#

python > school

stone beacon
#

Imma study physics until i accept that I don't like it

slate swan
#

i hate physics

stone beacon
#

I find higher level mathematics significantly easier than mere Physics

#

Just built different

slate swan
#

math🤮

#

still havent used algebra or geometry in my life 😋

fast musk
#

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

full lily
#

Maths teaches problem solving

full lily
pliant gulch
#

You’ll eventually need math when programming. Mostly related to algorithms

scarlet aurora
#
@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?
pliant gulch
#

But I’d say the most important thing really is the concept

#

It comes in handy

slate swan
full lily
heady sluice
#

cuz programmer

pliant gulch
full lily
full lily
heady sluice
#

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

scarlet aurora
# full lily is this all of the error that you get?
  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```
sick birch
heady sluice
#

well I'm gonna choose it anyways

full lily
#

But later down the line you might find a use for python if you go into a science field

heady sluice
#

yes

slate swan
sick birch
#

Full traceback please

scarlet aurora
#
@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)```
slate swan
#

Also, never saw a xkcd kwarg

pliant gulch
#

Looking at the persons GitHub, they seem to be quite the selfbot developer

sick birch
#

That's enough

slate swan
#

🏂

sick birch
#

This is a bit of a gray zone

scarlet aurora
#

🏂

#

that's not bad

#

or a "privacy breach"

sick birch
#

Discord's developer policy does mention things about explicit permisison

scarlet aurora
#

man is waffling

#

creating server invites ARE NOT A PRIVACY BREACH

full lily
#

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

slate swan
#

it seems sus as hes saving the invites tho

sick birch
#

Generating invites for servers in itself is not that bad

#

What are you planning on doing with the invites, anyway?

scarlet aurora
#

everyone agrees with me

slate swan
#

making invites isnt bad at all but saving them???

scarlet aurora
#

assume

sick birch
#

I mean, making invites in itself you could consider a violation because it's not like your bot can use them

scarlet aurora
#

and what do they say about people who assume??

slate swan
#

just saw that

slate swan
#

thats even worse

scarlet aurora
#

🏂

#

thanks, you too Krpyton

sick birch
#

I would personally argue this is in violation of Discord's developer policy

scarlet aurora
#

ye gg bro no re

slate swan
#

hes going through all guilds and making invites for all guilds and idk why would discord allow that anyways?

sick birch
#

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;

scarlet aurora
#

idk everytime i come here someone thinks i'm trying to ABUSE THE SYSTEM

slate swan
scarlet aurora
#

i do my stuff for educational purposes, therefor it's not in violation of anything

sick birch
full lily
#

In general, since I think it's not fully clear what the intention of the person is, rule 5 applies

scarlet aurora
#

well back to my original question, why was i getting that error?

pliant gulch
sick birch
full lily
#

And that should be the end of that

slate swan
heady sluice
sick birch
scarlet aurora
#

but it isn't?

slate swan
heady sluice
#

invite other people

sick birch
scarlet aurora
#

YE BRO, GONNA GO INTO MY VAN AND GET KIDS AND DEAL THEM SOME DISCORD INVITES

heady sluice
#

I'd be happy about that 😄

sick birch
#

Fine text isn't going to cut it

scarlet aurora
#

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

full lily
#

A server invite isn't "user data"

scarlet aurora
#

@slate swan just wants to put a bounty on my head

pliant gulch
scarlet aurora
#

dunno what i did to him

sick birch
#

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

pliant gulch
slate swan
#

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

sick birch
scarlet aurora
#

only my server uses it

sick birch
scarlet aurora
#

u think it's funny?

slate swan
#

then why looping through all guildslemon_glass

scarlet aurora
#

as i said, i'm testing stuff