#discord-bots

1 messages · Page 1125 of 1

sonic flax
#
  channel = channel[0]
  for channel in guild.text_channels:
    if channel.name.startswith("mm-"):
      await channel.delete()
      await ctx.send('Channel deleted')
      channel = discord.utils.get(ctx.guild.channels, name='priv-logs')
      embed=discord.Embed(title="Logging", description=f'[LOGS] Middleman channel closed by <@{username}>', color = random.choice(colors))
      await channel.send(embed=embed)
dusky pine
sonic flax
#

so

shrewd apex
#

wait a sec

#
  for i in guild.text_channels:
    if i.name.startswith("mm-"):
      await i.delete()
      await ctx.send('Channel deleted')
      channel = discord.utils.get(ctx.guild.channels, name='priv-logs')
      embed=discord.Embed(title="Logging", description=f'[LOGS] Middleman channel closed by <@{username}>', color = discord.Colour.random())
      await channel.send(embed=embed)
sonic flax
upbeat gust
sonic flax
upbeat gust
sonic flax
#

nvm not that

sonic flax
# upbeat gust where's your old code

what do i add to

  for i in guild.text_channels:
    if i.name.startswith("mm-"):
      await i.delete()
      await ctx.send('Channel deleted')
      channel = discord.utils.get(ctx.guild.channels, name='priv-logs')
      embed=discord.Embed(title="Logging", description=f'[LOGS] Middleman channel closed by <@{username}>', color = discord.Colour.random())
      await channel.send(embed=embed)
#

then

upbeat gust
#

Only check if ctx.channel starts with it

shrewd apex
#
    if ctx.channel.name.startswith("mm-"):
      await ctx.channel.delete()
      channel = discord.utils.get(ctx.guild.channels, name='priv-logs')
      await channel.send('Channel deleted')
      embed=discord.Embed(title="Logging", description=f'[LOGS] Middleman channel closed by <@{username}>', color = discord.Colour.random())
      await channel.send(embed=embed)
#

how would u do ctx.send

#

if channel is deleted

upbeat gust
#

so much spoonfeeding here smh

cloud dawn
slate swan
thin raft
cloud dawn
#

You basically talked Minecraft enchantment language to him if your comment was a bit more beginner friendly I'd agree.

thin raft
#

If a channel is deleted you can't send smt there

shrewd apex
#

did i say something wrong👀

#

he did ctx.send()

thin raft
#

How would you di ctx send if channel is deleted

maiden fable
cloud dawn
shrewd apex
#

after deleting channel

thin raft
#

But

cloud dawn
shrewd apex
#

bro🥲

thin raft
#

To another channel or to deleted channel?

shrewd apex
#

to the deleted channel

thin raft
#

Smh

shrewd apex
#

scroll up and see

upbeat gust
thin raft
#

How are you going to send something to a channel it doesn't exist 🙂

cloud dawn
#

Ash he/she is getting a new channel.

shrewd apex
#

y are u telling me💀

#

tell the guy

thin raft
#

Oh

#

I thought you were asking

shrewd apex
#

...

thin raft
#

My bad

shrewd apex
#

😭

cloud dawn
thin raft
#

If they don't know python they need to learn python not Discord.py

#

It'll lead to nothing

maiden fable
thin raft
#

If you don't know py how are you going to use dpy

#

It makes no sense

cloud dawn
#

Anyone is allowed to ask questions here, regardless of their skill level.

maiden fable
cloud dawn
thin raft
#

:v

maiden fable
#

So yea. I can safely say that many people can learn and excel in Python, while learning it with discord.py

thin raft
#

Welp

shrewd apex
slate swan
#

pygame

#

good for OOP practice

#

imo

shrewd apex
#

yes sprite classes

slate swan
#

even ursina

shrewd apex
#

mhm

slate swan
#

is good but nvm

cloud dawn
slate swan
#

that too

slate swan
maiden fable
#

Also, for me, pygame < arcade

maiden fable
shrewd apex
#

totally not me

maiden fable
#

I learnt that way

shrewd apex
maiden fable
#

Nice, I never used a rpi

slate swan
#

yes, and I know im weird

maiden fable
#

It was a fun way 🤷‍♂️
Idrc what anyone thinks about the same, what matters is that I know enough Python to make projects

slate swan
maiden fable
#

I did...

shrewd apex
#

👀

#

sounds like a story

maiden fable
#

Wym

#

I mean, I was the one who told the other person what's type casting, yesterday or smth

slate swan
#

Hun bun 😔

maiden fable
#

I mean, I don't know enough terms, but at least I was able to devise the meaning.

slate swan
#

still

shrewd apex
#

ic

maiden fable
#

Well, there's always some deficiency when u don't learn programming professionally in school, but u don't need to use those types of terms when u r writing the program itself, but nvm

shrewd apex
maiden fable
#

Same. I'm still learning what are lists and if statements

dusky pine
#

if (condition):

maiden fable
brazen raft
#

These are not Pythonic code snippets

#

Except Hunter's

maiden fable
paper sluice
#

fuck school python

maiden fable
#

But it's OT

dusky pine
shrewd apex
#

thats what every cbse school teaches👀

dusky pine
#

hmmm... "unpythonicity"

shrewd apex
brazen raft
#

Python't

dusky pine
#

pythonot

paper sluice
#

more like python ot

#

!ot

unkempt canyonBOT
dusky pine
#

damn you ryuga, smooth but aughhhh

slate swan
#

Heyo 👋

slate swan
paper sluice
slate swan
deep osprey
#
@bot.event
async def on_member_join(member):
  role = 468197591176183809
  await member.add.roles(role)```
#

Why doesn't that work?

#

oops

#

still doesn't work

upbeat gust
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
upbeat gust
#

Actually

#

add_roles can just take snowflakes

#

so discord.Object(id= 123)

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/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
deep osprey
#
@bot.event
async def on_member_join(member):
  role = member.guild.get_role(468197591176183809)
  await member.add_roles(role)``` still doesn't work.
deep osprey
#

@slate swan python intents = discord.Intents.default() intents.members = True

#

@upbeat gust When someone joins, No role assigned to him

potent spear
#

that's... default...

alpine cove
upbeat gust
alpine cove
upbeat gust
deep osprey
alpine cove
#

!d discord.Object

unkempt canyonBOT
#

class discord.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create ‘miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

x == y Checks if two objects are equal.

x != y Checks if two objects are not equal.

hash(x) Returns the object’s hash.
iron sorrel
#

ok so i have this view, and it has buttons, and when the user clicks the buttons, even tho im editing the embed, and changing it, it still says inter failed. i remember i have to do something extra here, but what exactly?

upbeat gust
iron sorrel
#

yes, im editing the embed, ouuu i could use defer yeah

#

how would i do that

heavy folio
#

You have to respond to the interaction

#

!d discord.InteractionResponse.defer

unkempt canyonBOT
#

await defer(*, ephemeral=False, thinking=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
iron sorrel
#

ahh thanks

#

i needed that

#

!d disnake.InteractionResponse.defer

deep osprey
#

@alpine cove python @bot.event async def on_member_join(member): role = discord.Object(468197591176183809) await member.add_roles(role) ?

unkempt canyonBOT
#

await defer(*, with_message=..., ephemeral=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

Changed in version 2.5: Raises [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") when an interaction cannot be deferred.
dull knot
#

Is Disnake better that nextcord? Should've asked thid a while ago

iron sorrel
#

yes disnake is better than nextcord

dusky pine
#

hi, anyone know why this is raising 'function' object has no attribute 'callback'? these decorators seem to be the cause

@lightbulb.implements(lightbulb.SlashCommand)
@lightbulb.set_help(docstring=True)
@bot.command()
async def ping(ctx: lightbulb.SlashContext) -> None:

(iusehikaribtw)

dull knot
#

Damn, guess I'll switch to thatHamptonSensei rhx

dusky pine
cloud dawn
dusky pine
#

oh-

#

sorry i'm used to dpy

#

thanks

cloud dawn
#

np I saw that yesterday and thought it was weird that's why I know.

slate swan
#

it's not weird 😔

deep osprey
#
@bot.event
async def on_member_join(member):
  role = discord.Object(468197591176183809)
  await member.add_roles(role)``` Should be this?
dusky pine
dusky pine
#

is the order incorrect

deep osprey
#

Still doesn't work..

dusky pine
dusky pine
glad cradle
slate swan
upbeat gust
slate swan
#

..?

#

why dumb huh

dusky pine
#

why not just one decorator

upbeat gust
glad cradle
slate swan
upbeat gust
glad cradle
upbeat gust
iron sorrel
upbeat gust
#

ok cool

paper sluice
dusky pine
paper sluice
#

its more expressive

#

thats the best i can explain

vocal plover
dusky pine
#

okay i get it, but what's the difference between lightbulb's deco and BotApp's deco

real grail
#

I'm making a decorator for the on_message() event, how can I pass an argument to the function that the decorator refers to? For example, when working with a command, I pass ctx: commands.Context

indigo dagger
#

guys what r cogs

brazen raft
#

The callable that is returned from the decorator needs to have the arguments of the function

brazen raft
#

You need subclass the Cog class to create your own cog

#

Setting it up depends on where it is written

indigo dagger
#

ok

brazen raft
#

Typically you would have one cog per file, separated from the main bot file and separated from each cog file, and load them as extensions

indigo dagger
#

didnt understand

#

andi have another doubt

brazen raft
indigo dagger
#

like i have a my school friends server in that i added a bot and in that bot i am trying to add a game

#

for that game i need to input from user

#

like user : $<game> bot : xyz user : this is the input which i need

real grail
# brazen raft What is not understood?

How to write an argument to the function that the decorator refers to when processing on_message(). Similar to ctx: commands.Context when calling a command

brazen raft
#

What are trying to do with a command context in an on_message event

indigo dagger
cloud dawn
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.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
indigo dagger
real grail
indigo dagger
#

then

brazen raft
#

I mean, on_message already has its intended argument: The received message

real grail
#
def allowed_rewards_from_messages():

    async def func( here ):

        if message.channel.id in [839244428271026196, 839228777174401034, 842798995146801202]:

            return False

        else: 

            return True
            
    return commands.check(func)```
(decorator)
brazen raft
#

That here is the message that is received

#

It's supposedly message

real grail
jaunty glacier
#

are there any discord.py sink extensions? Like voice recv for d.py. I dont want to use pycord…

real grail
maiden fable
brazen raft
real grail
brazen raft
brazen raft
alpine cove
#

and kinda bad

real grail
brazen raft
#

Then you should be able to understand that the parameters of the function returned by the decorator are supposed to match the parameters of the decorated function

#

What do you want to do after checking the channel the message was sent in

real grail
# real grail Yes
def allowed_rewards_from_boosts():

    async def func(message: discord.Message):

        if message.channel.id == 957877880065499196:

            if message.type == discord.MessageType.premium_guild_subscription:

                return True

            else: pass

        else: 

            return False
            
    return message.check(func)```
New weird bug in another block of code (return message.check(func)
NameError: name 'message' is not defined)
brazen raft
#

You should be returning func, not message.check(func)

#

But what are you trying to do with this

#

It will simply not execute the on_message event's function

real grail
# brazen raft But what are you trying to do with this
@bot.event
@Element_permissions.allowed_rewards_from_messages()
async def on_message(message):

    await bot.process_commands(message)

    if message.author.bot == False:

        balance_member = Element_connections.sqlite3_SELECT(0, message.author.id)

        reward = int(random.choice("12345"))
        balance_member += reward

        Element_connections.sqlite3_UPDATE(balance_member, message.author.id)

        print(f"Member {message.author.name} was rewarded for message: {reward} brilliants.")

    else: pass```
(I will also transfer the check for the bot to the decorator)
modern fiber
#

How do I make it for member argument first, then after for it to look for reason?

#

Because if I don't state member, it will say "You have to specify a reason"

modern fiber
#

Not sure why it highlites me this?

brazen raft
modern fiber
#

What do you mean

#

This is what happens

real grail
brazen raft
modern fiber
#

command lol?

brazen raft
modern fiber
#

OH

#

Ty bro

modern fiber
brazen raft
#

I wonder if it has type conversions for command arguments like discord.py

#

Because you could do it really easily then

maiden fable
modern fiber
#

idrk whats wrong

brazen raft
#

Try

async def kick(ctx: disnake.Context, member: disnake.Member, *, reason):
    ...
#

The arguments should be automatically type converted and reason should be a string

#

This lets you rid of the ifs you have

#

And it's also recommended because if the arguments are wrong you can handle them with whatever disnake's command error handling system is

modern fiber
#

Wait what?

brazen raft
#

Remove the try-except thing

#

Also fun fact: You can use ctx.send instead of ctx.channel.send

modern fiber
#

So just this huh?

brazen raft
#

I think so.

modern fiber
#

Mmm

brazen raft
#

Yeah I don't know where it is at in disnake

paper sluice
#

commands.Context

brazen raft
#

Yep

modern fiber
#

bet lemme try

brazen raft
#

How did you ran the command

modern fiber
#

p!kick

#

Trying to get an error

#

message

brazen raft
#

So the neat part is you can handle this exception with a command error handler

modern fiber
#

tbfh never used it huh ;-;

#

Working, but just that error handler..

brazen raft
#

I don't know how it goes in disnake, but if it's a fork of discord.py then it must be similar to

@kick.error
async def on_kick_error(ctx: commands.Context, error):
    if isinstance(error, commands.errors.MissingRequiredArgument):
        ...  # handle this specific error
#

This is specific to that command

#

You could have a global error handler

slate swan
#

Hey, does anyone know how to create a channel upon interaction of a button?

#

I can get it working with a command, but I'm not sure how to with a button

brazen raft
# modern fiber

Also fun fact: because you are using these type things, the member argument can be a mention, an ID, a username or a nickname (in quotes if it has spaces)!

modern fiber
brazen raft
#

It is converted for you by the fact you used type hinting

#

member: disnake.Member will always be a disnake.Member object, or an error will be thrown and you would need to handle it (it's commands.errors.BadArgument if I am not mistaken)

brazen raft
#

I don't know

slate swan
#

Ok

#

(Using nextcord btw)

brazen raft
#

I'm a dinosaur fossil from before the alternative wrappers when discord.py has died for months

#

I know nothing about anything new

slate swan
#

Ok

#

Oh*

brazen raft
#

I should probably try to

slate swan
#

Yeah

deep osprey
#
@bot.command()
@commands.has_role("Server Owner")
@commands.has_permissions(kick_members=True)
async def kick(ctx, user:discord.Member, *, reason="No Reason Given"):
    try:
        await user.kick(reason=reason)
        embed = discord.Embed(color=discord.Colour.red(), title="",description="")
        embed.add_field(name="Kicked:", value=f"""
        The member **{user}** has been kicked, Reason: **{reason}** """,inline=True)
        await ctx.reply(embed=embed)
        await user.send("You have been kicked from the server!") ******
    except:
            embed = discord.Embed(color=discord.Colour.red(), title="",description="")
            embed.add_field(name="Kicked:", value=f"""
            Error""",inline=True)``` That doesn't send the message to the user.
brazen raft
#

You're using it in the reply

#

Oh I thought you meant the embed

#

Try kicking after sending the message.

#

Also the user might simply have disabled DMs

deep osprey
#

i tried that but it doesn't even kick or send the message.

brazen raft
#

What does it do then

deep osprey
#

nothing

brazen raft
#

An error might have been thrown

deep osprey
#

oh wait that worked now, idk how that didn't work before

plain crow
#

So Im Trying To Make My Bot And I Have Lost 1200 Lines Of Code... Is Replit Suddenly Broken Or Something? All Im Seeing Is The Outline Of The Boxes

modern fiber
#

How do I get guild name? (public bot)

plain crow
brazen raft
#

That depends on where you get the guild from

brazen raft
modern fiber
brazen raft
modern fiber
brazen raft
#

ctx has a guild attribute

#

It's the guild the command was run in

#

I don't know what it is for private messages

brazen raft
#

Probably None or something

plain crow
#

!replit

modern fiber
#

!heroku

brazen raft
#

Hold on

#

Anyway, replit is a terrible host. I mean, it is not meant to be.

deep osprey
#

How to say the server name in the message?

#
await user.send("You have been kicked from the server! **{guild.name}**")``` ?
paper sluice
plain crow
deep osprey
#

@paper sluice i get this error "guild" is not defined

plain crow
paper sluice
brazen raft
slate swan
#

Chromebooks can't run python?

plain crow
paper sluice
#

huh?

slate swan
#

i believe they have a linux based kernel

plain crow
#

Wdym?

paper sluice
deep osprey
#
@bot.event
async def on_member_join(member):
  await member.add_roles(468197591176183809)``` that doesn't set the role
plain crow
slate swan
#

and linux comes with python pre-installed since its heavily dependent on it.

plain crow
paper sluice
slate swan
deep osprey
#

@paper sluice it doesn't set the role

slate swan
#

enter python -V -V/python3 -V -V there

plain crow
modern fiber
#
@client.event
async def on_guild_join(guild: disnake.Guild):```

How do I make it so bot makes a channel on-join? (custom name) 
Also is there a way so It gets the ID of same so I can use it for logs, instead of using the name of the channel?
plain crow
slate swan
#

anybody know how to create a text channel upon an interaction of a nextcord button? I can create channels with the command but not with the interaction, and its pretty pointless if it only creates it on command if its for a server ETC.

paper sluice
modern fiber
#
@client.event
async def on_guild_join(guild: disnake.Guild):```

How do I make it so bot makes a channel on-join? (custom name) 
Also is there a way so It gets the ID of same so I can use it for logs, instead of using the name of the channel?
slate swan
void kite
#
import requests
import json

def channel_messages(channelid):
    headers = {
        'authorization': 'TOKEN_HERE'
        
    }
    r =requests.get(f'https://discord.com/V9/channels/{channelid}/messages', headers=headers)
    jsonn = json.loads(r.text)
    for value in jsonn:
        print(value, '/n')
        
channel_messages('')```

i am trying to get json output but it just gives an error
slate swan
#

pffttt

brazen raft
unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
paper sluice
slate swan
#

You know how to make an channel upon interaction of a button anyone? nextcord btw

plain crow
brazen raft
slate swan
plain crow
void kite
deep osprey
paper sluice
slate swan
#

Anyone know how to create a channel upon interaction of a nextcord button? (A ticket bot is what im talking about)

brazen raft
slate swan
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
modern fiber
void kite
deep osprey
slate swan
#

I know that but I'm not sure how to do it with a nextcord button

brazen raft
#

What are you trying to do

slate swan
#

And nextcord buttons and discord.py buttons work the same??????

plain crow
modern fiber
#

Trying to get that channel for logs purpose

brazen raft
#

It's channel

paper sluice
modern fiber
slate swan
slate swan
brazen raft
# modern fiber

Well where do you intend to save the fact this guild now has this channel

slate swan
#

Let me try

brazen raft
#

You need to manage a database or something

deep osprey
slate swan
modern fiber
#

but I am trying to get that channel with the ID

plain crow
modern fiber
#

incase it is renamed afterwards or smth

paper sluice
deep osprey
brazen raft
paper sluice
deep osprey
paper sluice
#

someone joined the guild and they didnt get the role?

modern fiber
deep osprey
#

@paper sluice yes

modern fiber
#

oh nvm..

paper sluice
#

and there are no errors in ur terminal?

deep osprey
#

yes

paper sluice
#

try

member.add_roles(member.guild.get_role(id))
brazen raft
void kite
brazen raft
#

Try printing r.text

#

It should be JSON I think, so r.json() should have worked, I think

modern fiber
brazen raft
#

It's good that you learn it now then

modern fiber
paper sluice
deep osprey
#

yeah

brazen raft
#

I mean a database can be a simple txt file

void kite
paper sluice
deep osprey
#

even I gave the bot all permissions via the server

brazen raft
#

and replace r.json() there with print(r.json()) and tell me what you get

#

I am not sure whether this will even work for you, because using Discord API is supposed to involve a websocket or something, I think

void kite
brazen raft
#

I thought you wanted to get all messages in a channel

slate swan
brazen raft
void kite
brazen raft
#

By the way version 10 supposedly exists so you can use v10 instead of v9

slate swan
# void kite i didn't understand

if your token is nevergonnagiveyouup , this is how your headers should be -> ```py
{
"Authorization": "Bot nevergonnagiveyouup"
}

void kite
#

okay I'll try

#

still doesn't work

brazen raft
#

@void kite Do you have a bot user? You need to use its token

slate swan
brazen raft
#

Can you show what you get from printing r.text

void kite
# slate swan error?

raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

slate swan
#

whats the endpoint you used?

brazen raft
#

Are you using this URL https://discord.com/api/v9/guilds/{guild_id}/channels

void kite
#

yes

brazen raft
#

Well you need to change your function to accept a valid guild ID of a guild that the bot user is in

slate swan
#

you're missing all the requirements arguments to provide

brazen raft
#

Actually I don't think the bot user needs to be in said guild

slate swan
deep osprey
#

How to send a random message from messages list?

void kite
#

i am really confused since i have negetive experience in coding

brazen raft
slate swan
brazen raft
#

!paste @void kite share the code here and also send a screenshot of the exception traceback

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
brazen raft
void kite
brazen raft
#

Wait I ain't

slate swan
paper sluice
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

slate swan
#

also, thats the reason why "Bot token" was failing

brazen raft
#

!d random.choice

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
brazen raft
swift pumice
#

it stops the command working, yes but if i do it again it will send nothing in the chat

paper sluice
#

its just alex.error

potent helm
#

Please don't post things with the r word. It's ableism and not welcome here.

swift pumice
potent helm
#

Thanks 😄

potent helm
potent helm
tepid dagger
#

What does this mean?

paper sluice
#

those functions are inside a class right?

tepid dagger
#

Yeah

paper sluice
#

they must take self as the first argument

#

and u call them using self.function-name(args) inside ur function

tepid dagger
#

Could I do await log(self,ctx)?

paper sluice
tepid dagger
paper sluice
#

await it

#

await self.log(ctx)

quaint epoch
#

heyo

#

wassup

#

anything new goin on

deep osprey
#

How can I make the bot read from txt file and send a random line from that file?

quaint epoch
paper sluice
# tepid dagger

if u want to invoke a command from a different command, use commands.Context.inoke

quaint epoch
#

!pypi pastebin

unkempt canyonBOT
quaint epoch
#

@deep osprey

#

you need to have an api key on your dev page though

#

and to scrape pastebins you also need to have a premium membership

deep osprey
#

are there any free websites?

tepid dagger
kindred epoch
tepid dagger
#

Too lazy to change it to commands now

quaint epoch
#

bruh

#

i gtg

paper sluice
slate swan
#

Hello, i have VPS hosting, and when i turn off my pc my bots going offline. and how i can fix 27/7 ?

#

?

#

??

#

What VPS is that?

iron sorrel
#

1:11:11

swift pumice
slate swan
#

||modified clients are against tos||

swift pumice
#

nice

slate swan
#

you're importing random twice in the same line

deep osprey
#

thanks, fixed it.

iron sorrel
slate swan
#

yes very Scared

deep osprey
#
@bot.event
async def on_member_join(member):
  await member.add_roles(member.guild.get_role(468197591176183809))``` Why doesn't that set the role?
sick birch
#

When you joined your server with an account, it didn't give it the role?

sage otter
#

Got intents?

deep osprey
sage otter
#

Got errors?

deep osprey
#

nope

heady sluice
#

do you run bot

deep osprey
#

yes

slate swan
#

do you have another on_member_join event?

deep osprey
#

nope

slate swan
#

!paste can you paste your complete code here

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

PS: Hide the token if it's in plain text

#

is it possible to get channel id by input?

robust fulcrum
#

Guys how can we make a comamnd that
When i reply to a message
And in reply i type >translate <language name> so it translate the message to which I replied
How can I do that?
(Pls help me everyone insult my bot and say it useless so i wanted to make something new)

slate swan
slate swan
#

yes

unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

robust fulcrum
slate swan
# slate swan yes

you can typehint that command argument as discord.TextChannel and then use argument.id

async def command ( context, channel : discord.TextChannel):
    id = channel.id
slate swan
#

see the id variable there....

#

but-

#

oh

#

!d discord.TextChannel.last_message for the last message in that channel

unkempt canyonBOT
#

property last_message```
Retrieves the last message from this channel in cache.

The message might not be valid or point to an existing message.

Reliable Fetching

For a slightly more reliable method of fetching the last message, consider using either [`history()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.history "discord.TextChannel.history") or [`fetch_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.fetch_message "discord.TextChannel.fetch_message") with the [`last_message_id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.last_message_id "discord.TextChannel.last_message_id") attribute.
paper sluice
#

does lightbulb.SlashContext store the message?

robust fulcrum
#

Guys how can we make a comamnd that
When i reply to a message
And in reply i type >translate <language name> so it translate the message to which I replied
How can I do that?
(Pls help me everyone insult my bot and say it useless so i wanted to make something new)

slate swan
slate swan
#

you can ctx.message.reference to see the message which it was replied to

paper sluice
robust fulcrum
slate swan
paper sluice
#

ah ok

robust fulcrum
#

Why is hikari better

slate swan
robust fulcrum
slate swan
# robust fulcrum Why is hikari better

is mercedes better than audi?
bot [but] beyond that it's a personal preference

  • Emzi0767#1837

Better cache, everything is built so you can make your own impl of each part if you want. Customizable cache as well as working well with intents, doesn't break if discord adds a new field to some object (something that d.py has done in the past). Hikari will support cython speedups for the base impl, which is basically python compiled to C, which makes it run on steroids. Overall, faster than d.py and built to last and be extendable

  • davfsa#7026

Consistency, strictness, strong typing, modularity, composition and cache independence is what makes Hikari better than d.py

  • vicky5124#2207
tepid dagger
#

What is this...

slate swan
#

your dictionary does not have that key

slate swan
robust fulcrum
#

Ye

slate swan
#

!e ```py
d = {}
print(d["non existent key"])

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 'non existent key'
robust fulcrum
#

Like uppercase

slate swan
#

woah

robust fulcrum
#

Or lowercase

slate swan
#

integers have punctuation cases

robust fulcrum
robust fulcrum
#

Not its value

rain olive
#

the key name here is an integer, there is no upper or lower case

paper sluice
slate swan
robust fulcrum
#

Ok

slate swan
rain olive
#

tbh if you cant handle d.py as is, hikari will be worse

slate swan
#

^

mighty jay
#

Can anyone help me out with my problem in #help-chocolate ? its about trying to log slash commands

slate swan
#

but hikari FTW im biased

rain olive
silk shoal
#

hey yall, I am working on my server's bot. I'm thinking of creating a cache for some of the commands where bot needs to poll a slow loading site.
but I'm kind of unfamiliar with how to call cogs.
example.py:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# In this case, discord import is not needed, in some cases it may be.
# import discord
from discord.ext import commands


class ExampleCog(commands.Cog):
    """The ping to your pong"""

    def __init__(self, bot):
        """Save our bot argument that is passed in to the class."""
        self.bot = bot

    @commands.command(
        name="ping",
        help="The pong to your ping, let's you know that the bot is alive.")
    async def ping(self, ctx):

        await ctx.send("Pong")


def setup(bot):

    bot.add_cog(ExampleCog(bot))

and my bot.py looks like this:

@bot.event
async def on_ready():
    #set playing status
    await bot.change_presence(activity=discord.Game(name='Wengerball'))
    print('Logged on as')
    print(bot.user.name)
    print('----')

try:
    f = open('token.txt')
    token = f.readline()
    f.close()
    load_cogs()
    bot.run(token.rstrip())
    get_fixtures()
except Exception as e:
    print(getTimestamp() +"setup error\n")
    print(e)
    sleep(5)
#

should i create a cog called "cacheMaker" or something?

#

and how could i tell my bot to call the "ping" command internally?

maiden fable
robust fulcrum
#

Ye

rain olive
tepid dagger
slate swan
#

yes

robust fulcrum
maiden fable
paper sluice
tepid dagger
rain olive
paper sluice
tepid dagger
paper sluice
#

do you know how dicts work?

tepid dagger
#

No

paper sluice
#

.rp dict

paper sluice
blazing kettle
#

my bot isnt recognizing its prefix help

velvet compass
# paper sluice https://discord.com/channels/267624335836053506/607247579608121354/9913605740573...

This is probably a good intro article from that: https://realpython.com/python-dicts/
Also it makes me happier than it should that someone else used the .rp command

In this Python dictionaries tutorial, you'll cover the basic characteristics and learn how to access and manage dictionary data. Once you have finished this tutorial, you should have a good sense of when a dictionary is the appropriate data type to use, and how to do so.

paper sluice
slate swan
#

how to get current channel id

#

id of a channel where the message is sent

blazing kettle
#

right click

#

copy id

paper sluice
slate swan
#

in code

paper sluice
slate swan
#

okay

blazing kettle
# paper sluice can you show your code?
client = commands.Bot(command_prefix='.') 

@client.event
async def on_ready():
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="One Piece"))
    print("ready")```
paper sluice
blazing kettle
blazing kettle
#

yep

blazing kettle
paper sluice
blazing kettle
#

alright lemme test

blazing kettle
paper sluice
#

👍

mighty jay
#

if I want to get the arguments that I pass to a slash command, what am I supposed to add to the ctx.command? ex: \pick choices: 1 2 3 I want it to print that, but its only getting \pick

paper sluice
#

what library are you using?

slate swan
#

slash commands dont even start with a backslash

slate swan
paper sluice
mighty jay
#

I'm sorry yea I meant /

mighty jay
paper sluice
slate swan
#

already referenced ryugA

mighty jay
#

mhm Ashley suggested too

slate swan
#

Ryuga

paper sluice
paper sluice
mighty jay
#

just asking, why though? just curious to know what discord.py 2.0 offers over the d-p-s-c

slate swan
#

snake case ofc not

paper sluice
mighty jay
#

yes I did go through that 👍 though I'd have to rewrite everything...

slate swan
#

RuntimeWarning: Enable tracemalloc to get the object allocation traceback

#

ctx.send(msg.jump_url)

paper sluice
mighty jay
#

well, if I'm outdated, guess I gotta upgrade anyways

paper sluice
slate swan
#

ohhhhhhhhhhhhhhh

#

i forgor sorry

robust fulcrum
#

Guys how can we use discord.Message.reference?

paper sluice
robust fulcrum
#

Replied message

robust fulcrum
paper sluice
#

!d discord.Message.reference

unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

paper sluice
robust fulcrum
robust fulcrum
#

So it will work?

paper sluice
#

it should

robust fulcrum
#
@commands.command()
async def get(self, ctx):
    reply = message_object.reference(ctx.author)
    await ctx.send(reply)

Will it work?
@paper sluice

slate swan
quaint epoch
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

maiden fable
#

Makes much more sense when u cythonize games

paper sluice
#

and it an attribute, so you can't call it

slate swan
#

who makes games in python anyways

paper sluice
paper sluice
robust fulcrum
paper sluice
robust fulcrum
paper sluice
#

do reply.content

robust fulcrum
maiden fable
paper sluice
slate swan
paper sluice
slate swan
#

Bluecord spotted

#

Or better discord

maiden fable
#

What's that

#

Where tho

slate swan
#

Mod

#

plugin*

#

Whatever

#

idr if bluecord is a mod or plugin

maiden fable
#

Nice

paper sluice
shrewd apex
slate swan
#

Screenshot

#

oh it's a mod

slate swan
slate swan
#

Plugins are extensions

#

damn sparky, you're so intelligent

paper sluice
#

smartky

slate swan
#

pffttt

slate swan
slate swan
maiden fable
#

Is it just me or the nicknames ya'll give do suck?

slate swan
#

For wasting ur time on me

slate swan
slate swan
#

indeed

maiden fable
#

I knew that was gonna come up one day

slate swan
#

😭

#

I'll just shift to my middle name instead

#

Hi

#

ash ketchum ley

shrewd apex
#

hello

slate swan
shrewd apex
maiden fable
slate swan
heady sluice
#

this u?

shrewd apex
#

ic Ash ley

paper sluice
slate swan
shrewd apex
slate swan
#

.....I was sure this was gonna come up one day

#

just like Hunter

heady sluice
shrewd apex
#

u people do fortune telling 💀 👀

slate swan
#

and I'm surely leaving if you guys continue

maiden fable
#

!ot <-- better channel

unkempt canyonBOT
blazing kettle
#
async def on_message(ctx):
    if ctx.author.id == 912769756082352150:
        print("nah jit trippin")
    else:
        for bad_word in bad_words:
            if bad_word in ctx.content.lower():#.split(" "):
                bad_word_embed = discord.Embed(title = "Link Sent", description=f"{ctx.author.mention}, Do not send that.", color = discord.Color.blurple())
                await ctx.channel.send(embed=bad_word_embed, delete_after=10)
                member = ctx.author
                role = discord.utils.get(member.guild.roles, name="Timeout")
                await member.add_roles(role)
                channel = client.get_channel(991353012360597574)
                await channel.send(f'{ctx.author.mention} has been put into timeout. Feel free to remove the role whenever.')
                await ctx.delete()``` i have a banned words thing the filter works its just the message doesnt send when the user id is exactly that
maiden fable
#

Thanks

slate swan
blazing kettle
slate swan
#

btw, if someone sends a paragraph full of your "bad_words" list, this is gonna send a message for each time

blazing kettle
#

well that sucks

slate swan
blazing kettle
slate swan
blazing kettle
#

could i add like await ctx.send(ctx.message.content)?

slate swan
#

where do you even get the ctx from

slate swan
swift pumice
#
@bot.command()
@commands.cooldown(1,5, commands.BucketType.member)
async def invite(ctx):
    if ctx.channel.id != 984872910961405963:
        em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
        await ctx.send(embed=em,delete_after=8)
    else:
        link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
        await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")``` hi i just did this, how can i make that if i type my commands in an different channel the if ctx.channel.id statement will be ignored?
#

like only if I type it in another channel

shrewd apex
#

write in the else:

#
if cond:
    ...
else:
    ...
swift pumice
#

what

#

i dont understand, could u show it in my code?

slate swan
#

so do your stuff in the else

#

or just return the first ctx.send easy

#

Dear. threw the folder with the bot the bot does not work. what else needs to be done?

#

threw the folder?

maiden fable
#

probably he means uploaded the folder

slate swan
#

I transferred it to hosting

slate swan
deep osprey
#

Is there any way to keep my bot alive for free?

maiden fable
slate swan
deep osprey
indigo pilot
slate swan
#

thats not even a host

indigo pilot
#

theres a few free hosts out there but the support is either bad or machines are bad

indigo pilot
slate swan
#

if you have a credit card you can get free vps hosting for 3 years

mighty jay
#

people have recommended me to switch from discord-py-slash-commands to just discord.py, but just wondering which is better between that and disnake?

heady sluice
#

I prefer dpy

#

sarth prefers hikari

#

I don't even know who rehold is

slate swan
heady sluice
#

what do you prefer sparky

slate swan
mighty jay
#

lmao

slate swan
#

i'd say Disnake too, for reasons.

heady sluice
#

not sure if ryuga said he preferred disnake or just guessed that sparky was gonna say it

slate swan
#

Ryuga prefer nextcord

heady sluice
#

ew

paper sluice
slate swan
#

Jk

#

hikari over everything lipbite ||totally not based||

paper sluice
#

i prefer not making discord bots if you want to know

mighty jay
#

like refactoring to discord.py seems a bit of work, but apparently if I'm moving to disnake I'd have to change way less than I would have to for dpy

heady sluice
#

ryuga says dpy, he my man

still swan
#

is the @everyone role always = guild.roles[0]?

heady sluice
#

and at the end of the day it's gonna be a discord bot anyways

heady sluice
still swan
#

thx

paper sluice
slate swan
#

im thinking of writing a getting started with hikari guide because the old one got deleted

slate swan
#

the author deleted their github so yeah

#

oof

paper sluice
#

ah sad

heady sluice
slate swan
#

hikari is easy ngl

slate swan
heady sluice
#

meh

mighty jay
#

offtopic, when did you guys get into coding?

paper sluice
mighty jay
#

ah I see

slate swan
#

Shi* WiFi

#

6 years ago cause school, i had no interest in the start
i started self learning 2 years ago

heady sluice
#

I made my raspberry light up an LED yesterday

slate swan
#

we were taught java at school in 6th standard cryIgnore

mighty jay
slate swan
#

i forgot html 💀

mighty jay
#

lmao

#

how does that happen

paper sluice
#

my html knowledge
<tag> some stuff <tag/>

mighty jay
heady sluice
slate swan
slate swan
paper sluice
slate swan
mighty jay
#

so uh yall just good in py or other langs too

slate swan
#

I taught my friends python (with OOP) one night before the exam

mighty jay
#

pro

slate swan
#

just good in js

limpid thicket
#

Why does this not work?

elif not isinstance(channel.type, (discord.ChannelType.text, discord.ChannelType.voice)):
elif isinstance(channel.type, (discord.ChannelType.text, discord.ChannelType.voice)):
TypeError: isinstance() arg 2 must be a type or tuple of types
slate swan
slate swan
paper sluice
slate swan
#

How can i add color to code block in my code?

limpid thicket
#

a

slate swan
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

limpid thicket
#

thx

paper sluice
frozen patio
#

I made an anti nuke/raid bot

paper sluice
#

nice 🎉

frozen patio
#

It works too

slate swan
frozen patio
#

No

paper sluice
frozen patio
#
```py
Like this
slate swan
slate swan
frozen patio
#

No

#

Backticks

frozen patio
slate swan
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

paper sluice
#

when vim for discord 😔

slate swan
slate swan
slate swan
#

Kind of

paper sluice
slate swan
#

css..?

grim oar
#

I am something of a css myself

slate swan
#

my command is not working

#

Nice

paper sluice
grim oar
#

Erotic indeed

slate swan
#

Sad

#
@bot.command()
async def search(ctx, *, word: str):
  ch = await ctx.channel.history(limit=500).flatten()
  await ctx.send('searching through old messages...')
  for msg in ch:
    h = msg.content
    if h.startswith('-search'):
      continue
    else:
      if word in msg.content:
         await ctx.send(msg.jump_url)
         break
      else:
        continue
    if word not in msg.content:
      await ctx.send("didnt find anything")
paper sluice
slate swan
slate swan
slate swan
slate swan
paper sluice
slate swan
slate swan
#

prefix is - , i typed -search hello ,didnt send anythin

paper sluice
slate swan
paper sluice
#

god i suck

slate swan
#

L

grim oar
#

sauce bro

idle laurel
#

i know there will be some bias opinions but are there any real differences between nextcord and discord.py?

slate swan
#

anyone know da issue

frozen patio
#

What are you trying to import?

slate swan
#

Import "discord.ext" could not be resolvedPylancereportMissingImports

frozen patio
#

That doesn’t help

paper sluice
frozen patio
#

Also

slate swan
#

yeah

frozen patio
#

Had to

#

from discord.ext import commands

slate swan
frozen patio
grim oar
#

install dpy bro

slate swan
#

ok

idle laurel
slate swan
#

same issue

frozen patio
#

Install dpy

#

..

slate swan
paper sluice
slate swan
#

no

frozen patio
#

Install it omg

idle laurel
#

you imported "discord.ext" is it not just import discord

#

then from discord.ext import ...

heady sluice
#

you don't need to import discord for that...

slate swan
frozen patio
#

Hi

idle laurel
#

i've always done it that way 😄

frozen patio
#

Same

#

If it ain’t broke don’t fix it

idle laurel
frozen patio
#

It’s a good rule to live by

slate swan
#

hello, im currently working on a ticket system for a server, how do i make sure only administrators can only see the ticket?

idle laurel
#

with the ui buttons, can you hide specific roles from seeing certain buttons?

frozen patio
#

set channel overwrites with admin

slate swan
#

ok

frozen patio
#

The permission administrator

#

Hope that helps

slate swan
#

Let me try

frozen patio
#

K

slate swan
#

Is there a way to just make a private channel though?

#

Lemme check docs

#

Not sure really where to put the admin thing?

#

Could you type it up?

#

TypeError: Object of type Member is not JSON serializable

#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Object of type Member is not JSON serializable

frozen patio
#

Yea

slate swan
warped mirage
#
@client.tree.command(description="Mute a specified username")
@app_commands.checks.has_permissions(ban_members = True)
async def mute(inter: discord.Interaction, member: discord.Member, *, reason=None):
    guild = inter.guild
    mutedRole = discord.utils.get(guild.roles, name="Muted")

    if not mutedRole:
        mutedRole = await guild.create_role(name="Muted")

        for channel in guild.channels:
            await channel.set_permissions(mutedRole, speak=False, send_messages=False)
    await member.add_roles(mutedRole, reason=reason)
    em = discord.Embed(title="Mute Action", description=f"{member.mention} has been muted for {reason}", color=0x00008B)
    await inter.response.send_message(embed = em)
    await member.send(f"You have been muted in {guild.name} for {reason}")```
#
self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 380, in _extract_parameters_from_callback
    raise TypeError(f'parameter {parameter.name!r} is missing a type annotation in callback {func.__qualname__!r}')
TypeError: parameter 'reason' is missing a type annotation in callback 'mute'```
slate swan
#

parameter 'reason' is missing a type annotation in callback 'mute'

paper sluice
#

annotate it with reason: typing.Optional[str]
or reason: str | None if ur on python 3.10+

void kite
#

how can i make a bot command to get all the channel ids from a guild's id

slate swan
#

!d discord.Client.get_guild

unkempt canyonBOT
#

get_guild(id, /)```
Returns a guild with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
slate swan
#

!d discord.Guild.channels

unkempt canyonBOT
dull terrace
#

on a scale of 1 to 10 how bad practice is it to try and make everything fit on single lines like this

void kite
dull terrace
#

this is the other option

#

blacken makes it take up like 5 lines 😤

slate swan
#

I'd opt for the second option without hesitation. I don't like to set a value to multiple variables in one line if the value is not always the same, it's a personal choice I guess.

shrewd apex
dull terrace
#

it's physically painful to take up extra lines like that but it does seem a tiny bit more readable

shrewd apex
shrewd apex
paper sluice
shrewd apex
#

ic

slate swan
shrewd apex
#

does something happen if u cross pep8?

#

or any pep in general

slate swan
#

pep8 is just a styling guide

#

other peps, yeah sure

paper sluice
dull terrace
shrewd apex
#

ic so pep8 bad ❌ 😔

slate swan
#

noone likes the horizontal scroll bar, do you

dull terrace
pliant gulch
#

PEP8's line length is kind of out of date, It was there so that everything fits in the screen but now we don't have low res monitors on that level

delicate torrent
#

i make qqguild bot

pliant gulch
#

People won't care if you break the 79 line length rule

#

Most of my projects are 120 or 90 line length anyways

dull terrace
paper sluice
slate swan
pliant gulch
#

But line length is really negligible, hell just zoom out your buffer in whatever code editor

dull terrace
#

coding on a horizontal monitor is gross

paper sluice
#

what is the use of vertical monitor other than taking less desk space?