#discord-bots

1 messages · Page 25 of 1

cold tide
#

you dont understand lol

slate swan
#

I know you aren't paying for them legally

#

no you aren't

cold tide
#

its not illegal at all and discord doesnt diss allow that

slate swan
#

not sure on the context of the conversation but isnt that against tos of their platform? selling accounts?

#

are you sure? I've seen people receiving discord warnings for being in servers like your gen server

slate swan
cold tide
slate swan
#

you don't know me I know what you do

short relic
#

guys is the max amount of button u can put into a subclass view is 4 ?

slate swan
#

@slate swan check dms

cold tide
slate swan
#

either way if its legal or not account selling is against instagrams TOS so you would be breaching discords TOS as you're serving a service on their platform that breaks another platforms TOS which would break discords TOS, so please lets end the conversation and keep the comments to ourselves, please dont ask for further help on the topic as rule 5 exists, if the conversation keeps going on, i will and can contact moderators, please and thank you.

#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

slate swan
#

common okimii win

#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

slate swan
slate swan
#

bots already have nitro abilities

vocal snow
short relic
#

Traceback (most recent call last):
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 382, in _scheduled_task
await item.callback(interaction)
File "c:\Users\ADMIN\Desktop\bot discord\cat.py", line 16, in button_callback
await interaction.response.send_message(view=ORDER48)
File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 696, in send_message
payload["components"] = view.to_components()
TypeError: View.to_components() missing 1 required positional argument: 'self'
Whats this error 😭

slate swan
torn sail
slate swan
torn sail
#

U are just passing in the class

slate swan
short relic
#

i need ()

slate swan
slate swan
slate swan
#

dont bots have 4k char limits?pithink

blazing beacon
#

how do i run a command without it being invoked

slate swan
#

!d discord.ext.commands.Context.invoke

unkempt canyonBOT
#

await invoke(command, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Calls a command with the arguments given.

This is useful if you want to just call the callback that a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally.

Note

This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.

You must take care in passing the proper arguments when using this function...
blazing beacon
#

thanks

slate swan
#

bots need custom banner access sadJoegbh

slate swan
slate swan
#

read the error message

slate swan
#

simple

#

anya?

#

spy x family anya?

#

no

slate swan
#

anya forger

#

@slate swan is spyxfamily good it's on my planning

slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
#

shush, youre not even fully imported in the file,
typing.TYPE_CHECKING moment

slate swan
vocal snow
slate swan
#

what's going on here

#

maybe i dont have helper because half of my 44k messages are flirting, or maybe im just trash💀 pithink

slate swan
slate swan
#

idk

vocal snow
slate swan
slate swan
maiden fable
#

What's even happening here

slate swan
#

you gotta find out

maiden fable
#

Might wanna take this to an ot 👀

slate swan
vocal snow
#

this is an ot

slate swan
vocal snow
#

ot4-andy-copypasta-spam

slate swan
#

your a dude

slate swan
maiden fable
#

Well, I got more messages than both of u (:

slate swan
maiden fable
#

Almost 43k
So now shut

slate swan
#

you?

vocal snow
slate swan
maiden fable
slate swan
#

#bot-commands

#

check it lol

maiden fable
#

Ah, u talking about the whole server. I have 43k in this channel alone lol

vocal snow
#

jesus christ hunter

slate swan
#

hunter has never seen the outside world😭

drifting arrow
#

Is there a limit to how often a bot can update its status? or do I need to first clear the existing one before I update it?

slate swan
#

It's either 15 or 25 iirc

drifting arrow
#

Oh

slate swan
#

kay nvm

#

thats for the ratelimit of client dispatching of gateway events btw

drifting arrow
#

I'll just set it to update every 5 minutes. It's not necessary to update often.

slate swan
#

yeah thats fine

#

Sweet

drifting arrow
#

I wasnt sure which fix I needed to add

past spire
#

i am unable to install discord.py in pip
it says subprocess-exited-with-error

slate swan
#

@slate swan probably knows

#

currently googling how to cook an egg without burning it

vocal snow
past spire
#

python = 3.10.5

#

pip = 22.2.2

maiden fable
drifting arrow
#

5 minutes is fine

maiden fable
#

Cool

shrewd apex
#

message count dosent show on mobile😔

#

ok 19906💀

#

rip

silk fulcrum
#

hm.. i guess im finally done with all useful but borind stuff like db, bot subclass, e.t.c. and can finally make commands

slate swan
#
currentTime = currentDateAndTime
print(currentTime)


class Status(commands.Cog, name="Status"):
    def __init__(self, bot: commands.Bot):
        self.__bot = bot
        self.status_list = (
            nextcord.Activity(type=nextcord.ActivityType.watching, name=(currentTime.strftime("%H:%M"))),
        )
        self.current_status = random.randint(0, len(self.status_list) - 1)

    @commands.Cog.listener()
    async def on_ready(self):
        print("Status cog is ready!")
        self.status_loop.start()

    @loop(seconds=600)
    async def status_loop(self):
        """Loop to update status"""
        self.current_status = (self.current_status + 1) % len(self.status_list)
        await self.__bot.change_presence(activity=self.status_list[self.current_status])


def setup(bot):
    bot.add_cog(Status(bot))```

How do i make it so it updates the time continuously?
vocal snow
#

you can change presence 5 times every minute

slate swan
silk fulcrum
#

bruh, that stupid error happens to me, when it says "Unknown message" when trying to delete my ctx.message but my message exists

slate swan
vocal snow
#

no

silk fulcrum
#

so the answer is: not possible

slate swan
vocal snow
#

those aren't accurate

silk fulcrum
#

then they break rules I guess

#

Grabbing IP is illegal in any form iirc

slate swan
vocal snow
#

they don't break rules, but the way they detect alts is not accurate

vocal snow
vale wing
silk fulcrum
#

ohkay

silk fulcrum
slate swan
#

Btw what's use of ip?

silk fulcrum
vocal snow
vale wing
vale wing
vocal snow
#

anyways, ip based alt detection is bad

vale wing
#

Especially for mobiles

silk fulcrum
vale wing
#

Cuz their IPs are very dynamic

silk fulcrum
#

so if I send my IP here, nothing will happen?

#

cus you can't do anything with IP

vocal snow
#

there's some stuff that can be done

lone lichen
#

We can get ur approximate location and zip code

vale wing
#

We could determine your home city (unless it's a mobile network)

lone lichen
vale wing
small pawn
silk fulcrum
#

Oh, cus I was scared that revealing is really bad and something bad will happen

small pawn
#

how do

#

i do the thing

vale wing
silk fulcrum
#

So the only thing is location as I see

small pawn
#

newest

silk fulcrum
small pawn
#

i litterally tried everything

silk fulcrum
#

pip show discord

vale wing
#

But who tf would attack a home computer lmao

silk fulcrum
small pawn
silk fulcrum
small pawn
#

😭

silk fulcrum
#

install dpy

#

2.0

vocal snow
small pawn
lone lichen
#

Yes, thats what approximate location and zip code give u usually

silk fulcrum
#

gah

vale wing
#

Ok how do you do the import @small pawn

silk fulcrum
small pawn
#

from discord import ui

vale wing
#

You can't

small pawn
#

its from the docs

#

and discord.ui.View doesnt work either

silk fulcrum
#

from discord.ui import something

lone lichen
silk fulcrum
#

or just import discord

vale wing
silk fulcrum
#

and discord.ui.View

vocal snow
#

or a folder called discord

small pawn
#

no

vocal snow
small pawn
#

vsc python file

vocal snow
#

the Run button

#

or a command

small pawn
#

wdym

vocal snow
#

what command do you use to run it

small pawn
vocal snow
#

can you run it conventionally and see what happens

small pawn
#

how do I do that

silk fulcrum
#

😳 can bots have two factor?

shrewd apex
#

no ig not

vocal snow
small pawn
vale wing
small pawn
#

run start debugging in vsc

vale wing
#

I think dev portal requires you to enable it when you first sign up

vocal snow
#

either use the Run button or use the commandline

lone lichen
vocal snow
small pawn
silk fulcrum
#

oh my gosh, I completely forgot that I disabled 2FA when my phone broke

silk fulcrum
#

on server that requires 2FA for mods

vocal snow
#

bottom right, click the python version

lone lichen
# silk fulcrum deleting message

I think the server ur using this in has 2fa requirement for mods enabled and since you have it disabled the command wont work for you

small pawn
#

u mean this?

sterile osprey
#

python!!

vocal snow
small pawn
slate swan
vocal snow
slate swan
#

black beans

small pawn
#

Python 3.10.5

vocal snow
small pawn
#

uh it worked but now it says module 'discord.ui' has no attribute 'ButtonStyle' 💀

#

nvm

#

ty

short relic
#
async def order(ctx):
    vpsembed = discord.Embed(name="chon loai vps ban muon mua", description = "neu chon sai co the dung lai lenh de chon lai", color = 0x00FFFF)
    vpsembed.set_image(url = "https://media.discordapp.net/attachments/1001798328641654885/1004595123113439293/unknown.png")
    vpsembed.set_author(name = "Magic Shop")
    vpsembed.set_footer(text = "Made by kpt#3471")
    button = Button(label = "khong gpu", style = discord.ButtonStyle.success)    
    async def button_callback(interaction):
        await interaction.response.send_message(view = NOGPU())
    button.callback = button_callback
    button1 = Button(label = "co gpu", style = discord.ButtonStyle.success)
    async def button_callback(interaction):
        await interaction.response.send_message("fak u")
    button1.callback = button_callback
    view = View()
    view.add_item(button)
    view.add_item(button1)
    async def check(interaction):
        if interaction.user and interaction.user.id == ctx.author.id:
            return True
        await interaction.response.send_message('chit nhau thi dms em nhe', ephemeral=True)
        return False
    view.interaction_check = check
    await ctx.send(embed = vpsembed)
    await ctx.send(view = view)

when i use the command nothing happened but after i removed the embed the command works normally, whats the problem?

silk fulcrum
#

why aren't you sending embed and view in same message?

#

await ctx.send(embed=vpsembed, view=view)

short relic
short relic
# silk fulcrum no...
async def order(ctx):
    vpsembed = discord.Embed(name="chon loai vps ban muon mua", description = "neu chon sai co the dung lai lenh de chon lai", color = 0x00FFFF)
    vpsembed.set_image(url = "https://media.discordapp.net/attachments/1001798328641654885/1004595123113439293/unknown.png")
    vpsembed.set_author(name = "Magic Shop")
    vpsembed.set_footer(text = "Made by kpt#3471")
    button = Button(label = "khong gpu", style = discord.ButtonStyle.success)    
    async def button_callback(interaction):
        await interaction.response.send_message(view = NOGPU())
    button.callback = button_callback
    button1 = Button(label = "co gpu", style = discord.ButtonStyle.success)
    async def button_callback(interaction):
        await interaction.response.send_message("fak u")
    button1.callback = button_callback
    view = View()
    view.add_item(button)
    view.add_item(button1)
    async def check(interaction):
        if interaction.user and interaction.user.id == ctx.author.id:
            return True
        await interaction.response.send_message('chit nhau thi dms em nhe', ephemeral=True)
        return False
    view.interaction_check = check
    await ctx.send(embed = vpsembed, view = view)
#

still didnt work is there any problem in the embed part

#

because if i remove the embed it works normally

silk fulcrum
#

any errors?

short relic
silk fulcrum
#

no errors.. that's really weird

short relic
#

but i think the problem is in the embed part

#

but the embed part is just nothing wrong

silk fulcrum
#

oh there is

#

discord.Embed(name="...", ...)

#

it's not name, it's title

short relic
#

oh yea

#

lol didnt expect thank

tidal hawk
#

Can a normal bot see servers, where the user is in?

silk fulcrum
#

weird that it didnt give any error but np

tidal hawk
#

Like in authorization tab it shows Mee6 can see:

silk fulcrum
real grail
#

How can do filter of auto-mod which triggered on recurring messages? discord.py

silk fulcrum
#

also, not the bot knows what servers you are in, but application

tidal hawk
#

I thought viewing user servers are only possible through website oauth2?

silk fulcrum
real grail
tidal hawk
#

Well I thought that, the only way to view user servers - is to redirect them to a new website where they have to authorize it, and only then "web/server" sees user guilds (with oauth2 scopes)

silk fulcrum
real grail
#

To me needed filter of spamming

silk fulcrum
#

oh i see

#

hmm, I'm not sure what's the way, I'd create cooldown mapping and a Counter in a cog and in on_message get bucket of a mapping and check if bucket.update_rate_limit(message.created_at) (else: Counter.pop(author.id, None)), then add 1 to Counter[author.id], and check if Counter[author.id] >= limit_of_spam @real grail

limber bison
#

discord.ext.commands.errors.CheckFailure: The check functions for command pvc failed.
what dose this mean ?

silk fulcrum
short relic
#

how can i make it so that people can only press the create channel button once to avoid spamming tickets

silk fulcrum
#

like py @command() @has_permissions(administrator=True) async def pvc(ctx): ...

#

and user doesn't have admin permissions

#

then it would raise that error

limber bison
#
    def __init__(self , client):
        self.client = client
    
    
    def check_channel(ctx) ->bool:
         return ctx.channel.id == 999186452757872701
 

    @commands.command()
    @commands.check(check_channel)```
silk fulcrum
#

then the command was executed in wrong channel

short relic
limber bison
short relic
#

like i have a command to open the ticket gui and it has a cd of 5 mins but people can press the create ticket button multiple times so how can i avoid that

silk fulcrum
#

so like, everyone can press the button or only executor?

short relic
#

Only the executor

#

you helped me to make a check that if not the executor then they cant press the button dont u forget 🙂

silk fulcrum
#

then you can just delete the message when the button is pressed

#

or disable the button

#

or close the view

#

or remove the view

#

@short relic

past spire
#

if message.content.startswith('.'): if message.content == 'Hii':

is there a way i can split .Hii to make the second if work?

limber bison
#

?

lone lichen
#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

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

hash(x) Returns the message’s hash.
lone lichen
#

!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.

lone lichen
limber bison
lone lichen
unkempt canyonBOT
#

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

Edits the channel.

You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.

Changed in version 2.0: The `region` parameter now accepts [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") instead of an enum...
limber bison
#

i take name as input

#

🤔

lone lichen
#

Wdym

silk fulcrum
#

did not see context

lone lichen
#

Yea I realised 😂 dw

limber bison
lone lichen
silk fulcrum
#

!d discord.Guild.get_channel

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.

Changed in version 2.0: `channel_id` parameter is now positional-only.
fallow girder
#

hello I tried to improve my ticket system by putting a system to add and remove users, but the add a user button does not work....

#
class AddUser(nextcord.ui.Modal):
    def __init__(self, channel):
        super().__init__(
            "Ajouter une personne dans le ticket",
            timeout=300,
        )
        self.user = nextcord.ui.TextInput(
            label= "User ID",
            min_length= 2,
            max_length= 50,
            required=True,
            placeholder="Entrez l'ID d'un utilisateur."
        )
        self.add_item(self.user)

    async def  callback(self, interaction: nextcord.Interaction) -> None:
        user = interaction.guild.get_member(int(self.user.value))
        if user is None:
            return await interaction.send(f"Utilisateur introuvable, êtes-vous sûr que l'utilisateur se trouve dans le serveur ?")
            overwrite= nextcord.PermissionOverwrite()
            overwrite.view_channel = True
            await self.channel.set_permissions(user, overwrite=overwrite)
            await interaction.send(f"{user.mention} à été ajouté au ticket.")

class TicketSettings(nextcord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)

    @nextcord.ui.button(
        label=":heavy_plus_sign:︲Add User", style= nextcord.ButtonStyle.green, custom_id="ticket_settings:green"
    )
    async def add_user(self, boutton: nextcord.ui.Button, interaction: nextcord.Interaction):
        await interaction.response.send_modal(AddUser(interaction.channel))

    @nextcord.ui.button(
        label=":heavy_minus_sign:︲Remove User", style= nextcord.ButtonStyle.gray, custom_id="ticket_settings:gray"
    )
    async def add_user(self, boutton: nextcord.ui.Button, interaction: nextcord.Interaction):
        await interaction.response.send_modal(RemoveUser(interaction.channel))
silk fulcrum
fallow girder
#

there is no mistake

#

error

silk fulcrum
#

what error?

fallow girder
#

I don't see any error in my terminal

#

There is the remove user button but not the add user button

heavy folio
lone lichen
silk fulcrum
#

Modal

lone lichen
#

Ok

silk fulcrum
#

how is Modal Model

lone lichen
#

Idk nextcord, he might have made a typo

fallow girder
fallow girder
silk fulcrum
heavy folio
#

💀 if you insist that you only have 1 then sure, we've told you

fallow girder
#

OV M'Y BAD

#

You were right TIMoups

#

I have tow fonction

#

But

#

I have another problem

#

When I enter the ID of a user it does not add it to the ticket

#

In the Modal

lone lichen
# fallow girder

You get the user but u dont do anything else unless user is None

lone lichen
silk fulcrum
#

oh yeah

#

return

lone lichen
#

Ye

silk fulcrum
#

everything after it is unreachable

lone lichen
#

Return 😂

#

Cus It’ s supposed to be outside of if statement

silk fulcrum
#

yes'

fallow girder
#

Im very stupid and blind

lone lichen
#

Lmao dw it happens

fallow girder
#

😭 thanks you very much bro's

lone lichen
#

Np 😂 good luck

silk fulcrum
#

ohhhh, now i got what dw means, just needed understandable context

#

it's dont worry

lone lichen
#

Yes

#

What were u thinking?

silk fulcrum
#

['do what', 'dude what', 'something starting with d (duh, dude, etc) why']

#

oh! and don't want of course

lone lichen
#

Makes sense

#

Could be all that

fallow girder
fallow girder
silk fulcrum
#

🗿

#

show code

fallow girder
#
class AddUser(nextcord.ui.Modal):
    def __init__(self, channel):
        super().__init__(
            "Ajouter une personne dans le ticket",
            timeout=300,
        )
        self.user = nextcord.ui.TextInput(
            label= "User ID",
            min_length= 2,
            max_length= 50,
            required=True,
            placeholder="Entrez l'ID d'un utilisateur."
        )
        self.add_item(self.user)

    async def  callback(self, interaction: nextcord.Interaction) -> None:
        user = interaction.guild.get_member(int(self.user.value))
        if user is None:
            return await interaction.send(f"Utilisateur introuvable, êtes-vous sûr que l'utilisateur se trouve dans le serveur ?")
        overwrite= nextcord.PermissionOverwrite()
        overwrite.view_channel = True
        await self.channel.set_permissions(user, overwrite=overwrite)
        await interaction.send(f"{user.mention} à été ajouté au ticket.")
silk fulcrum
#

any errors?

fallow girder
#

No crainte

#
Ignoring exception in modal <__main__.AddUser object at 0x000001E2AE0BA2C0>:
Traceback (most recent call last):
  File "C:\Users\momoa\AppData\Roaming\Python\Python310\site-packages\nextcord\ui\modal.py", line 290, in _scheduled_task
    await self.callback(interaction)
  File "c:\Users\momoa\OneDrive\Documents\Time Is Money bot discord\main.py", line 501, in callback
    await self.channel.set_permissions(user, overwrite=overwrite)
AttributeError: 'AddUser' object has no attribute 'channel'
#

I just got this error

royal meteor
#

How to do pagination of embeds using interaction?

silk fulcrum
#

same, but instead of ctx use interaction

royal meteor
silk fulcrum
#

uhm, there are a lot of different ways

#

!d discord.ext.commands.Paginator

unkempt canyonBOT
#

class discord.ext.commands.Paginator(prefix='```', suffix='```', max_size=2000, linesep='\n')```
A class that aids in paginating code blocks for Discord messages.

len(x) Returns the total number of characters in the paginator.
royal meteor
#

Okay

heavy folio
silk fulcrum
#

ohh he meant button pagination?

past spire
#

how can i get message author id?

silk fulcrum
past spire
#

🥲 me noob, don't judge

silk fulcrum
#

i did not

past spire
#

if i want to add it in a variable?

silk fulcrum
#

variable = message.author.id?

past spire
#

🥲 i forgot to use that variable in next line, so it shows error

#

so, how can i use variables in embed title?
title = ?

silk fulcrum
#

title = variable_name

past spire
#

and i can use + to add text to that?

silk fulcrum
#

yes

#

if variable is str of course

past spire
#

ohkk

#

and if numbers?

silk fulcrum
#

use str(variable) to turn number into a string

past spire
#

ohk

#

and how to mention user in embed?

heavy folio
#

!d discord.abc.User.mention

unkempt canyonBOT
past spire
#

i can't understand 🥲

maiden fable
#

Show yr user object variable

past spire
#

just use example variables

#

in python

#

title = "User" and i want to print user name there

maiden fable
#

Uh?

#

That's not.... how it works

past spire
#

i know, that's why im here for help

maiden fable
#

Do u know about classes and objects?

past spire
#

yes

#

embedVar = discord.Embed(title = "Profile" and i want to show author name here

maiden fable
#

Then use the get_user method for commands.Bot class to get an instance of discord.User class, then use the mention property

past spire
#

🤔

cold sonnet
#

mention doesn't work in titles 👆

past spire
#

and in field?

cold sonnet
#

yes, also in descriptions

past spire
#

and, how can i do that?

cold sonnet
#

description=user.mention

past spire
#

it says user is not defined

cold sonnet
#

user = bot.get_user(id)
or
user = guild.get_member(id)

#

you need members intents for both

past spire
#

oh

slate swan
#

why doesn't my bot have a text about me in it even though I entered one?

past spire
#

from discord.ext import commands

client = commands.Bot(command_prefix = '.')

@client.command() async def ping(ctx): await ctx.send('Pong!')

#

it shows error 🥲

short relic
#

how can i get the channel id where the button interaction is detected

vocal snow
cold sonnet
#

that's the error

#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

short relic
#

is this the correct code to purge ```py
channelinteraction = interaction.channel
channelinteraction.purge(limit = 4)

past spire
vocal snow
cold sonnet
#

what did you do in discord

vocal snow
past spire
past spire
cold sonnet
#

😭

past spire
#

@bot.command() async def ping(ctx): await ctx.send('Pong!')
why won't this work? 🥲

cold sonnet
#

.

short relic
#
channelinteraction = interaction.channel
        channelinteraction.purge(limit = 4)

why is this not working 😭

robust fulcrum
#

Guys how we can edit message on button click?

vocal snow
unkempt canyonBOT
#

class discord.InteractionResponse```
Represents a Discord interaction response.

This type can be accessed through [`Interaction.response`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.response "discord.Interaction.response").

New in version 2.0.
short relic
vocal snow
vocal snow
short relic
robust fulcrum
short relic
vocal snow
#

why is it indented like that

#

and please send the error if you're getting one

vocal snow
robust fulcrum
#

Ok

cold sonnet
#

y'all gotta learn how to get help

short relic
vocal snow
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.

cold sonnet
#

error handler?

vocal snow
cold sonnet
#

could also be a missing self param, right?

#

or it raises error

short relic
# vocal snow !paste full code please
class ORDER416(discord.ui.View): 
    @discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("dang tao don hang")
        channelinteraction = interaction.channel
        await channelinteraction.purge(limit = 4)
        opener = interaction.user.name
        user = interaction.user
        guild = await bot.fetch_guild(907785823452278865)
        mod = guild.get_role(951141051358388365)
        overwrites = {
            guild.default_role: discord.PermissionOverwrite(read_messages = False),
            user: discord.PermissionOverwrite(read_messages = True),
            mod: discord.PermissionOverwrite(read_messages = True)
        }
        
        ticket_channel = await guild.create_text_channel(name = "ticket cua" + "-" + str(opener), overwrites = overwrites)
        
        await ticket_channel.send("don hang cua ban la 4 - 16 no gpu")
        await ticket_channel.send("@short relic day ban vps ne con cho")
        await ticket_channel.send(embed = paymentembed)
        
        @bot.command()
        async def delete(ctx):
            if ctx.channel.name.startswith("ticket"):
                await ctx.channel.delete()
            else:
                await ctx.send("this channel cant be deleted")
cold sonnet
#

yeah probably

short relic
#

full code 😈

vocal snow
#

!d discord.ui.button

unkempt canyonBOT
#

discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
vocal snow
#

view, interaction, button

vocal snow
cold sonnet
#

😈

short relic
vocal snow
#

read the doc

cold sonnet
#

😭

short relic
#

yea but like no thing goes wrong

vocal snow
#

The function being decorated should have three parameters, self representing the discord.ui.View, the discord.Interaction you receive and the discord.ui.Button being pressed.

#

and see your function params

short relic
#

only the purge function is going wrong 😈

robust fulcrum
vocal snow
cold sonnet
#

yeah that shouldn't work either

short relic
robust fulcrum
#

🤨

vocal snow
#

im not sure if its style attr

#

you should recheck docs for that

cold sonnet
#

yeah it is

#

and you have to edit the message

#

with view=self like you did before

short relic
#

i think im messing up with the purge so can i ask how do i delete a view instance

cold sonnet
#

you delete the message

robust fulcrum
short relic
#

im just gonna delete the create button so people cant spam 😈

short relic
#

view().delete ?

robust fulcrum
#

Bruh why sending this emoji are you gone mad? 😈

cold sonnet
#

no you delete the message not the view

past spire
#

how can i get user nick name?

short relic
cold sonnet
#

you need a member object, not a user
member.display_name

cold sonnet
short relic
#
class ORDER416(discord.ui.View): 
    @discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("dang tao don hang")

how bro theres only one message which is dang tao don hang and the button is not in any message 😭

cold sonnet
#

do you not wanna delete the text just the button?

short relic
#

yea

cold sonnet
#

do you not wanna delete the text just the button?

#

internet gone

short relic
#

its something like this

#

i want to delete that so people cant spam spam spam create ticket

cold sonnet
#

you have to edit the message with view=None

#

or delete the message

#

await interaction.followup.delete() I think

#

!d discord.Interaction.followup

unkempt canyonBOT
short relic
#

ok ill tryy

cold sonnet
#

hm, it's weird

short relic
vocal snow
unkempt canyonBOT
#

class discord.ButtonStyle```
Represents the style of the button component.

New in version 2.0.
vocal snow
#

use one of it's attributes

#

according to the color you want the button to be

robust fulcrum
#

Ok

robust fulcrum
cold sonnet
#

does InteractionResponse.send_message return the message

#

!d discord.InteractionResponse.send_message

unkempt canyonBOT
#

await send_message(content=None, *, embed=..., embeds=..., file=..., files=..., view=..., tts=False, ephemeral=False, allowed_mentions=..., suppress_embeds=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by sending a message.
short relic
#

but the message doenst have the function to create ticket

#

the button does so i have to delete or edit it 👿

crystal glen
#

Is there a way to make my bot join voice and do Text-To-Speech with tts library?

vocal snow
#

sure

cold sonnet
#

oh wait you just have to edit the original message

short relic
cold sonnet
#

I looked at this wrong

vocal snow
#

Interaction has edit_original_message

cold sonnet
#

await interaction.edit_original_message(content="ticket created", view=None)

past spire
#

finally 😭

cold sonnet
#

I hate every Interaction

#

why can't it just be like Context

#

I'm so used to it

past spire
#

interections are so slow

short relic
#

yea i love context

#

easy to use 😉

past spire
#

is there a way to preserve variable data, like for balance

vocal snow
#

database

past spire
cold sonnet
#

where did you put it

#

do you get an error

vocal snow
short relic
# cold sonnet do you get an error
class ORDER416(discord.ui.View): 
    @discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("dang tao don hang")
        await interaction.edit_original_message(content="ticket created", view=N

sadly no errro

past spire
cold sonnet
#

what if it had the time to send the message but not to edit, but it won't raise anything cuz it responded afterall

#

or you have an error handler

vocal snow
past spire
#

ohkk

short relic
#

so can i just edit the label and function or basically just delete it

cold sonnet
#

every view is sent with a message...

#

it's not just floating there on discord

#

use await interaction.response.defer()

meager chasm
cold sonnet
#

or just tell if you have an error handler already

cold sonnet
#

!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...
cold sonnet
#

use this at the start

meager chasm
short relic
#

i dont think i have that because every error is shown to my terminal

cold sonnet
#

ok that's good

#

try defer then, if it doesn't work I ran out of ideas

meager chasm
meager chasm
#

or

#
await interaction.message.edit(view=None)
short relic
#

i tried but nothing happens, i think that is because the button is not in a message or sth

short relic
#

but it still not create the text channel

cold sonnet
#

there's not even code for that

meager chasm
#

!d discord.Interaction.message

unkempt canyonBOT
meager chasm
#

it should work 🤷

short relic
# meager chasm you tried using `interaction.message.edit`?
class ORDER48(discord.ui.View): 
    @discord.ui.button(label = "bam vao day de xac nhan don hang va tien hanh thanh toan", style = discord.ButtonStyle.success)
    async def button_callback(self, button, interaction):
        await interaction.message.edit(view=None)
        await interaction.response.send_message("dang tao don hang")

discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message

cold sonnet
#

what do you mean it stopped working

short relic
#

its nearly what i want but i want it to stop working after it is pressed once and the ticket is created

meager chasm
#

only a view

cold sonnet
#

yeah the message has to have content...

meager chasm
#

in which case you should delete it instead

cold sonnet
#

or pass content

meager chasm
#

you could also just stop the view with self.stop() but that won't remove the components

silk fulcrum
#

Oh my gosh, I have to recode almost all of these..

short relic
cold sonnet
#

await interaction.message.edit(content="I'm the content", view=None)

#

it either has a view or a content

#

or both, but one of them at least

shrewd apex
#

u can use interaction.response.edit_message()

#

with content kwarg

dry urchin
#

I have a ban command but how do I make it so that someone can also use a user ID or display name? Like ".ban zzy#0001 my reason" or ".ban 165023948638126080 my reason"?

@commands.has_permissions(ban_members=True)
@bot.command(aliases=['b', 'banuser', 'banmember'])
async def ban(ctx, member:discord.Member, *, reason=None):
    if not reason:
        reason = "No reason provided"
    else:
        pass
short relic
#

how can i make it so that it will do something like this

id = ctx.user.id
ctx.send(<@id>)
#

but the <@> and the id arent the same type so how can i do that

slate swan
#

!d discord.Member.mention

unkempt canyonBOT
torn sail
pearl shoal
#

helloo

dry urchin
pearl shoal
#

i have a question so i have a token in an .env file and i want to use it how can i?

#
client.run(TOKEN)
#

can we do this]

left raptor
#

has anyone used a virtual input program to pipe sound into a discord voice channel? I have voicemeter, and I'm using the python module playsound to play audio clips, but I haven't been able to get it to pipe the python sound into discord

left raptor
pearl shoal
#

thanks

left raptor
#

I'm building a virtual assistant script, and every part is built except the part that pipes the audio into the discord voice channel

pearl shoal
left raptor
#

it shouldn't matter what your file name is for load_dotenv() to find it, it just needs to be in the same directory

pearl shoal
#

hm

#

and i have another question

#
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await member.kick()
    kick_messages = ["Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}", 
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
    await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')


client.run(TOKEN)
pearl shoal
slate swan
#

without the filename in the call, it will read only .env file

slate swan
pearl shoal
#

then itll work?

slate swan
#

YES.

short relic
# slate swan ctx.author.mention

so ill be doing this?...

await ticket_channel.send("don hang cua ban la 4 - 8 no gpu")
        interaction.user.mention 
        await ticket_channel.send(embed = paymentembed)
slate swan
#

but inside the send's content kwarg

short relic
slate swan
short relic
swift pumice
#

can someone send me the discord py inv?

dry urchin
#

how do I check if a member is timed out?

swift pumice
#

plss

swift pumice
hearty timber
#

yo can anyone help me

dry urchin
hearty timber
#

i need to fix this issue

hearty timber
dry urchin
pearl shoal
#
import random
from discord.ext import commands

TOKEN = 'O
client = commands.Bot(command_prefix='!')

@client.event
async def on_ready():
    print('{client.user} is on')
    

@client.command
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await member.kick()
    kick_messages = [f"Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}", 
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
    await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')


client.run(TOKEN)
dry urchin
#

generate a new one

hearty timber
#

alr

swift pumice
#

@hearty timber can you send me the discord.py server link?

dry urchin
pearl shoal
swift pumice
dry urchin
pearl shoal
#

ok

dry urchin
#

also @pearl shoal put () beside @client.command

#

so its @client.command()

pearl shoal
#

hm

pearl shoal
#

ayeeeeeeeeeeee tyyy finally worked but there are 2 spaces between

#

nothing

#

ty everyone

#
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member()):
    embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
    embed.add.field(name = "ID", value = member.id , inline = True)
    await ctx.send(embed=embed)
client.run(TOKEN)
#

error -Traceback (most recent call last):
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 27, in <module>
async def whois(ctx, member : discord.Member(), data, guild, state):
TypeError: Member.init() missing 3 required keyword-only arguments: 'data', 'guild', and 'state'

shrewd apex
#

embed.add_field

#

also typehint only discord.Member

#

no need to call

slate swan
#

I have a question: Im trying to display a message whenever someone adds my bot to my server. It works in my bot support server but when I added it to one of my friends server it gave me this message discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions Whats going on?

pearl shoal
#

ok'

shrewd apex
#

and value takes in only str so do str(member.id)

shrewd apex
slate swan
#

But shouldnt it be able to? I already set the permission to send messages inn a server in the discord developer portal

pearl shoal
#
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member()):
    embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
    embed.add_field(name = "ID", value = str(member.id) , inline = True)
    await ctx.send(embed=embed)
client.run(TOKEN)
```
shrewd apex
#

why are u doing discord.Member()

#

remove the ()

pearl shoal
#

ok

crystal glen
#
async def birthday(birthdays, user):
    if not str(user.id) in birthdays:
        birthdays[str(user.id)] = {'birthday': None, 'age': 0}

async def add_birthday(birthdays, user, birthday):
    birthdays[str(user.id)]['birthday'] = birthday
    birthdays[str(user.id)]['age'] = (datetime.datetime.now() - birthday).days // 365

Is this good enough?

silk fulcrum
#

why would you need to make these function async?

crystal glen
#

idk

#
async def birthday(ctx, birthdays, user):
    if not str(user.id) in birthdays:
        birthdays[str(user.id)] = {'birthday': None, 'age': 0}
        await ctx.send(f'{user.mention} has no birthday set, Please add one using the command `!setbirthday <date>`.')

async def set_birthday(ctx, birthdays, user, birthday):
    birthdays[str(user.id)]['birthday'] = birthday
    birthdays[str(user.id)]['age'] = (datetime.datetime.now() - birthday).days // 365
    await ctx.send(f'{user.mention} birthday has been set to ().')
#

Is this good enough 🤦‍♂️

silk fulcrum
crystal glen
#

Bruv

silk fulcrum
#

also wth is bitrhday has been set to ()

crystal glen
silk fulcrum
slate swan
#
@client.command()
@commands.has_role('General Officer')
async def mute(ctx, member: discord.Member):
   mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
   await member.add_roles(mutedRole)
   await member.send(f"You have been temporarily muted in **{ctx.guild.name}** by user: **{ctx.author}**.")

   embed = discord.Embed(
    title = "Server Mute",
    description = f"Successfully muted {member.mention}.",
    color = 0xe74c3c #RED
   )
   embed.set_footer(text = "Think this is a mistake? Open a ticket. - USAF Logging")
   await ctx.send(embed=embed)
   channel = client.get_channel(999759936122794017)
   embed = discord.Embed(
    title = "Moderation Notice",
    description = f"{ctx.author} has used the command: **MUTE** on {member.mention}.",
    color = 0x3498db
   )
   embed.set_footer(text = "USAF Logging | Developed by joshhh.#2142")
   embed.set_thumbnail(url = "https://media.discordapp.net/attachments/886694502566330440/1000160324160340018/AFHQ.png")
   await channel.send(embed = embed)

I have made a simple mute command. However, every time I execute this in Discord, I get an error saying this.. even though the bot has Administrator perms.

Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
silk fulcrum
slate swan
silk fulcrum
slate swan
#

@silk fulcrum Works like a charm now! Thanks so much. :)

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
vocal snow
#

one thing you can do is check the permissions available when it joins a server (on_guild_join) and just make the bot leave the server if it doesn't have sufficient permissions

slate swan
sour ginkgo
#

anyone here know how to make a discord bot

silk fulcrum
silk fulcrum
#

and if you are new to python then use !resources

sacred tendon
#

so i am trying to get my bot to ban using both pings and/or a user id for member that are not in the server, is this possible?

sacred tendon
#

when i use await user.ban(user) or member.ban(member) itll spit out an error saying (id) not found

sick birch
#

Could I see the code?

silk fulcrum
#

why would you pass user inside of user.ban or member inside of member.ban

#

that just doesnt make sence?

sick birch
#

Oh you want to ban members not in the server

sacred tendon
#

its probably really bad i am not very good at python

sick birch
#

Typehint to discord.User

sacred tendon
sacred tendon
#

i am reverse smart

silk fulcrum
torn sail
#

That’s a problem with replit

#

The projects share an IP address so if one gets ratelimited everyone does

sacred tendon
#

same error

torn sail
silk fulcrum
#

ban*

sacred tendon
#

wait why does it say unban

#

tf lmaoo

torn sail
#

Yes typo

silk fulcrum
#

or await user.ban(reason=reason) iirc

torn sail
#

That won’t work for non guild users

silk fulcrum
#

if user is discord.Member of course

torn sail
#

Yes

sacred tendon
#

im trying to ban a non member

sacred tendon
#

its not working still

torn sail
#

Error?

#

Try kill 1 in the shell

silk fulcrum
#

He should consider using a VPS

#

and you too

sacred tendon
#

(dw about the id its a scam bot im trying to test banning on)

silk fulcrum
#

typehint user as discord.User

sacred tendon
torn sail
#

Yes

sacred tendon
#

that was there before

silk fulcrum
#

are you sure you saved file, restarted the bot?

sacred tendon
#

o h

#

it should autosave when i click the little restart button

kind wind
#
@bot.command()
@mods_or_owner()
async def slowmode(ctx, arg1: int):
    await discord.TextChannel.slowmode_delay('arg1')
    await ctx.reply("Set channel's slowmode to " + str(arg1) + " seconds!")

Is this code good for setting slowmode in a channel?

sacred tendon
#

also, if i want to send a dm with the server the command was sent in (for example; "you have been banned in server. reason = [reason]") how would i do that

sick birch
sacred tendon
#

dammit i just realized that my unban cmd dosent work

#

it unbans everyone in the member list instead of just the id i provide

kind wind
#

How its correct

sacred tendon
#

sdljhfklgdjlihk

#

its getting all the members in the list and unbanning all of them

#

but i dont know how to just do id

sick birch
#

Well yeah

#

That’s how you coded it

#

Of course it’s going to do what you ask it to

sacred tendon
#

i coded it at 1am i had no sleep lmao

#

idk how to fix it thi

sick birch
#

Why not just pass in the discord.User instance to the unban method? It should be an one like function

silk fulcrum
fading marlin
#

^ slowmode_delay isn't a method, it's an attribute. You have to use TextChannel.edit(slowmode_delay=...) to change the value

sick birch
#

Typehint to discord.User, pass that instance into unban, easy peasy

#

!intents you said you had the ID not found error; might be an intents issue

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

sacred tendon
sick birch
#
@bot.command
async def unban(context: commands.Context, user: discord.User, ...) -> None:
  await context.guild.unban(user)

pretty simple unban command

sacred tendon
#

i changed that so it sends messages if an id is not present and it sends a message and it still unbans all users in the list

spring flax
#

Meaning? It worked?

sacred tendon
#

im trying to unban ONE person

#

not clear the list

spring flax
#

What do you mean by clear the list

sacred tendon
#

unbans all members on the list

silk fulcrum
spring flax
#

You can check the length of the argument

silk fulcrum
#

or Annotated instead of Union

red lake
#

!codeblock

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.

slate swan
#

how i fix this, AttributeError: module 'discord' has no attribute 'ui'

silk fulcrum
#

install dpy 2.0

hard hinge
#

Does Discord.py realy support slash commands?
I have it installed, but not mutch documentation about it

silk fulcrum
#

!d discord.app_commands.AppCommand

unkempt canyonBOT
#

class discord.app_commands.AppCommand```
Represents a application command.

In common parlance this is referred to as a “Slash Command” or a “Context Menu Command”.

New in version 2.0...
slate swan
#

how do i install the version?

hard hinge
#

Ah dope! Thanks for youre answer!

Gonna look into it in more depth tomorrow

hard hinge
silk fulcrum
slate swan
#

i dont have git so how i install git?

wicked atlas
hard hinge
silk fulcrum
hard hinge
#

pip install git i think

silk fulcrum
#

no

#

git is not python lib

hard hinge
#

Oh w8 youre right

#

My bad

slate swan
hard hinge
#

DOwnloaded that, idk for sure withs page

slate swan
#

i try

hard hinge
misty robin
#

How Can i do a statu for thé bot ?

crystal glen
#
@client.command()
async def birthday(ctx, *, member: discord.Member):
    if member == None:
        member = ctx.author
    with open("D:/Desktop/Haryad Bot/data/birthdays.json", "r") as f:
        birthdays = json.load(f)
    if str(member.id) in birthdays:
        await ctx.send(f"{member.mention}'s birthday is {birthdays[str(member.id)]}")
    else:
        await ctx.send(f"{member.mention} has not set a birthday")

When I do ?birthday it gives me missing arguments error

wicked atlas
#

Did you provide it with a mention?

#

You also shouldn't need the *, if you're only giving it one mention

slate swan
crystal glen
#

No, Isn't that what I'm trying to avoid?

slate swan
hard hinge
slate swan
#

git bash, or the cmd?

sleek gyro
#

is there a way to the bot to send an txt file without the need to have the file saved locally?

hard hinge
red lake
#

!codeblock

hard hinge
#

I did it in terminal in VScode

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.

slate swan
wicked atlas
red lake
#
import asyncio
import re, ast, inspect
from discord.ext import commands

client = commands.Bot(command_prefix=';', help_command=None, case_insensitive=True, intents=discord.Intents.all())
embed = True
timeout = 1

@client.event
async def on_ready():
    print("online")

def source(o):
    s = inspect.getsource(o).split("\n")
    indent = len(s[0]) - len(s[0].lstrip())
    return "\n".join(i[indent:] for i in s)
source_ = source(discord.gateway.DiscordWebSocket.identify)
patched = re.sub(
    r'([\'"]\$browser[\'"]:\s?[\'"]).+([\'"])',  
    r"\1Discord Android\2", 
    source_
)
loc = {}
exec(compile(ast.parse(patched), "<string>", "exec"), discord.gateway.__dict__, loc)
discord.gateway.DiscordWebSocket.identify = loc["identify"]


client.run("token")```
cold sonnet
#

imagine having to worry about cwd

sleek gyro
rancid notch
sleek gyro
#

oh, i asked because in discord.js had it

slate swan
#

it worked, so git and the v2 version is now on it?

wicked atlas
#

Where is this text file though?

brazen raft
cold sonnet
#

??

brazen raft
#

!d discord.discord.ext.commands.Author

unkempt canyonBOT
#

discord.ext.commands.Author```
A default [`Parameter`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Parameter "discord.ext.commands.Parameter") which returns the [`author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") for this context.

New in version 2.0.
wicked atlas
cold sonnet
#

wtf is discord.discord

brazen raft
#

Their fault

sleek gyro
brazen raft
cold sonnet
#

I'm completely confused

#

this is so wrong

#

I don't like this

slate swan
#

I didn't know this was a thing

#

So unlike Danny

cold sonnet
#

yeah

slate swan
red lake
#

can someone help me rq?

brazen raft
wicked atlas
slate swan
#

It's impractical, ctx.author already exists I mean why the extra stuff

brazen raft
sleek gyro
#

thank you guys!

hard hinge
brazen raft
cold sonnet
#

does that problem only appear in the docs

#

please tell me that's not a completely different commands

slate swan
#

I guess it's for metadata

brazen raft
#

What do you mean? It has a use

#

It's a Parameter

slate swan
#

Its primary function is to add extra metadata to command signatures and stuff

cold sonnet
#

I don't think it's any faster

slate swan
#

It's slower. No doubt about it. But that's not the point

cold sonnet
#

it's just a pointer

#

and the if statement is also still there

#

in a way

slate swan
#

ext.commands is so bloated

brazen raft
#

Well, I doubt it removes the argument from the use string of the command in the help command

#

Doing =None does

cold sonnet
#

time to make an own discord API wrapper

slate swan
#

Been wanting to do that for a while now

#

One that is more REST-friendly and has a simpler internal design

silk fulcrum
#

too lazy, I'll leave this for later, if it makes sence tho

slate swan
#

I mean Hikari already nails the REST-friendly part, but it's extremely modular to the point where it can be hard to use

brazen raft
slate swan
#

Well having the option to use a REST-only client

#

Or a client that exposes those methods

#

I mean for example if you have to edit a channel when you only have the ID, you have to first fetch it and then use .edit()

#

With discord.py's current design, the solution for this issue is just to add classes so that you can construct a partial version of these objects so you can make those api requests. The issue is that they are a pain to implement and PartialMessage is the only one that exists

outer violet
hard hinge
slate swan
#

I mean why did you even mention lightbulb lol

#

It wasn't relevant to the discussion whatsoever

#

yikes we don't help people with malicious intent

knotty notch
#

Man thought you meant like a fake nitro ( to log)

#

I’m not saying who (unless required to) someone here is tryna make a logger 🗿

slate swan
#

In short you can't

silk fulcrum
#

you can?

slate swan
#

You can just send the link to a fake nitro

silk fulcrum
#

button is just filled with empty symbols to left and to the right

knotty notch
slate swan
#

what does "to log" even mean according to you

knotty notch
slate swan
#

None taken, I just don't know what you're even talking about

knotty notch
#

I am giving hints on the dude who’s tryna log people

#

(If you reading this and decided to delete our dm, that would do you much worst)

slate swan
#

I genuinely still have no idea what you're saying

misty robin
#

How Can i do a mute Chat command

#

?

knotty notch
#

As what they say can actually mean for something else

slate swan
#

How do i connect to my vps

slate swan
#

what do you guys use? to connect to your vps

knotty notch
limber bison
#

how can i add buttons to embed ?

#

should i install another lib ?

lost lichen
limber bison
#

whats disnake lul

brazen raft
limber bison
#

install diacord.py.2.0 ?

#

😂

brazen raft
#

pip install git+https://github.com/Rapptz/discord.py

limber bison
brazen raft
inner perch
#

after updating my python am getting a error on this line

bot = commands.Bot(command_prefix = "-")
inner perch
#
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    bot = commands.Bot(command_prefix = "-")
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
sick birch
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

limber bison
#

i use client word

#

not bot

#

is Bot a class / object ?

inner perch
#

do i have to change my whole script after updating?

brazen raft
#

With proper commands, error handling, etc.

sick birch
inner perch
#
Traceback (most recent call last):
  File "main.py", line 71, in <module>
    bot.run(TOKEN)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 877, in run
sick birch
#

But if you're just asking a question, you may be on an old version where intents are not required

#

Can you post the full error?

limber bison
inner perch
#
Traceback (most recent call last):
  File "main.py", line 71, in <module>
    bot.run(TOKEN)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 877, in run
    asyncio.run(runner())
  File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 852, in runner
    await self.start(token, reconnect=reconnect)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 786, in start
    await self.connect(reconnect=reconnect)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/discord/client.py", line 717, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
 
sick birch
sick birch
# inner perch ``` Traceback (most recent call last): File "main.py", line 71, in <module> ...

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

Might be a good idea to follow what the error says

limber bison
sick birch
#

It's not on pip

limber bison
sick birch
#

See the github homepage to see how to install the dev version (2.0)

brazen raft
# limber bison 🤔 ohhh k lul i use client everywhere

Variable names don't matter, but they should be sensible.
If you are instantiating a "bot" from commands.Bot, you should name your variable accordingly (bot).
If you are instantiating a "client" from discord.Client, you should name it client or something.

flat solstice
#

I'm having a weird issue getting my bot to start. I'm trying to adapt the advanced start-up example (https://github.com/Rapptz/discord.py/blob/master/examples/advanced_startup.py#L84-L90) to work with my codebase but I keep getting a py Traceback (most recent call last): File "C:\Users\Teagan\Documents\Coding\FAQ\main.py", line 29, in <module> client = FAQ_Client( TypeError: FAQ_Client.__init__() missing 1 required positional argument: 'web_client' and my code is https://github.com/SnowyJaguar1034/ModMail-FAQ/blob/master/classes/faq.py#L68-L83. I did just check I have the latest version as I last updated around a month ago, updating to the latest has not fixed my problem. (Discord.py 2.0)

brazen raft
limber bison
brazen raft
#

I believe commands.Bot subclasses discord.Client

#

It has a better suited API for developing Discord bots

sick birch
inner perch
brazen raft
#

If you can't enable the privileged intent for your application on Discord Developer Portal, it means Discord won't allow you to use it for the application anyway

inner perch
#

oh

#

alr

brazen raft
#

You'd have to request the use of the specific privileged intent

#

And you also need to have your bot verified

inner perch
#

o

lapis lintel
#

Aside from top.gg, are there any other discord bot websites where you can vote for your bot?

brazen raft
hard hinge
#

I have a question

I have @app_commands.checks.has_any_role('Admin', 1002211217349300294)
This limits who can use the slash command.

But can i send instead of "The application did not respond":

You can't access this command?

misty robin
#

I want to creat a commane and shere in a room what A website share
but i don't know how

slate swan
#

How do I make a Slash Command? (reply please!)

slate swan
slate swan
#

Yeah

#

I hope to get the "application badge" that bots can get

#

and I assume that the format is like normal commands?

#

like @client.cmmand or whatever

limber bison
#

what he wants to say ?

brazen raft
#

There's a page in their documentations website about all the things you need to change

brazen raft