#discord-bots

1 messages · Page 134 of 1

slate swan
#

Was gonna say. Check that guildid is actually returning an integer and not a string. But good to hear you figured out a solution.

sick birch
#

Sure

WALLPAPERS_ID = 123
WALLPAPER_REQUESTS_ID = 456
@bot.listen()
async def on_message(message: discord.Message) -> None:
  if message.channel.id == WALLPAPERS_ID:
    # add star emoji
  elif message.channel.id == WALLPAPER_REQUESTS_ID
    # add check and cross emoji
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Adds a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Emoji "discord.Emoji").

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") to do this. If nobody else has reacted to the message using this emoji, [`add_reactions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") is required.

Changed in version 2.0: `emoji` parameter is now positional-only.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.11)") instead of `InvalidArgument`.
sick birch
#

see here for how to add a reaction

jovial lynx
sick birch
jovial lynx
#

is the WALLPAPERS_ID and REQEUSTS_ID the ID of the channel?

sick birch
#

yes

jovial lynx
sick birch
#

It's a pretty simple getting started guide

jovial lynx
#

actually yes

#

i have this:

import discord
from discord.ext import commands, tasks
import os
import asyncio
import random
from itertools import cycle

# Your bot's prefix.

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

# Creates an arraylist containing phrases you'd like the bot to cycle through.

status = cycle(['DM me!', 'Wanna talk?', 'Lets chat', 'Why wont you DM me?', 'Cmon, talk to me...'])

# Do not add apostrophe's to the arraylist.

@client.command()
async def clear(ctx, amount=5):
    await ctx.channel.purge(limit=amount)

@client.event
async def on_ready():
    print("Bot was deployed sucessfully !")
    while True:
        await client.change_presence(game=Game(name='DM me!'))
        await asyncio.sleep(3)
        await client.change_presence(game=Game(name='Wanna talk?'))
        await asyncio.sleep(3)
        await client.change_presence(game=Game(name='Lets chat', type = 3))
        await asyncio.sleep(3)
        await client.change_presence(game=Game(name='Why wont you DM me?', type = 2))
        await asyncio.sleep(3)

@client.event
async def on_message(message):
    message.content = message.content.lower()
    author = '{0.author.mention}'.format(message)

    # Stops the bot from talking to itself.

    if message.author == client.user:
        return

# Add/edit your responses here.

    if message.content.startswith('hello'):
        msg = 'Hello, how are you? {0.author.mention}'.format(message)
        await message.author.send(msg)

    if message.content.startswith('hey'):
        msg = ''
        randomlist = ['Hello! {0.author.mention}'.format(message),'Oh, hey!','Hello {0.author.mention}'.format(message),'How are you doing?','Heyy..','Hey, is there anything you would like to talk about? {0.author.mention}'.format(message),'Hiya!']
        await message.author.send(msg + (random.choice(randomlist)))

@client.event
async def on_ready():
    print('Bot running as...')
    print(client.user.name)
    print(client.user.id)
    print('------')
    change_status.start()

@tasks.loop(seconds=10)
async def change_status():
    await client.change_presence(activity=discord.Game(next(status)))

client.run(" Paste your token between these speech marks.")
oblique laurel
#

How does editing embeds work? I first send a message to a channel that contains an embed, which has a title and a description. If the user reacts to the message with the embed, the embed should edit to include the previous content plus some new stuff. And if they edit it again, it should contain both the previous ones plus something new, and the cycle continues.

Sending the message works fine, and so does the first reaction. However, every reaction after that discards the previous one. I'm bad at explaining things, so here's an example. If I first sent "foo", and they reacted, it should send "foo bar". Then if they react again, it should edit to be "foo bar baz". Right now I'm getting "foo" then "foo bar" but then "foo baz".

Any clue what the issue could be?

sick birch
#

Just work the new code into there

#

Should be just a if/elif statement

jovial lynx
#

do i need to modify anything to make it work or just throw it in?

sick birch
#

Just throw it in

jovial lynx
#

since this bot uses @client.events

#

okay cool

sick birch
#

Other than that the code is a bit rough around the edges

hushed galleon
jovial lynx
sick birch
jovial lynx
#

also your

    # add star emoji

is that just

await add_reaction(emoji id, /)
sick birch
#

Not directly the cause of any issue of course

oblique laurel
jovial lynx
#

what is the purpose of that slash

sick birch
sick birch
jovial lynx
#

oh okay cool

oblique laurel
slate swan
#
class config(Select):
  async def callback(self, interaction):
    if self.values[0] == 'Configs':
        with open('guilds.txt', 'r') as file:
          guildid = file.read()
        guildid = guildid.split()
        if str(interaction.guild.id) not in guildid:
         with open("configs.json", "r") as f:
           guilds = json.load(f)
        await update_guild(guilds, interaction.guild)
slate swan
jovial lynx
#

thanks for your help @sick birch

sick birch
#

no worries

hushed galleon
oblique laurel
slate swan
#

embed.title += stuff

slate swan
#

its under that

oblique laurel
#

!paste

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
#

yes

#

if you select the config option

#

then if your not found in it

#

Well you haven't indented it properly in that case

#

it seems I havent

hushed galleon
slate swan
#

i can never catch those

oblique laurel
slate swan
#
>
Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/ui/view.py", line 425, in _scheduled_task
    await item.callback(interaction)
  File "main.py", line 526, in callback
    with open(interaction.guild.id, "w") as f:
TypeError: expected str, bytes or os.PathLike object, not int
#
interaction.guild.id```
#

how can I make a file with the guilds id

oblique laurel
slate swan
#

ill try it

oblique laurel
#

prob add an extension tho, like .txt or whatever the file will hold

hushed galleon
# oblique laurel Is there another way to access the embed title that you know of?

my assumption was that the message sent by the bot would be stored in the message cache, which message_update events will later access and update the message in-place, but after going through abc/message/state.py, it appears that the message object returned by ctx.send() isnt the same object as the one cached by the connection state

however, message.edit() still constructs a new message object based on the data received after making the API request, so using message = await message.edit(...) should work as expected

slate swan
oblique laurel
slate swan
#

i dont need str right

ionic garden
#

so i have some stuff in a discord view class
how do i make the view do some stuff to the message upon startup

oblique laurel
hushed galleon
#

although i would also consider storing just the text embed rather than relying on the message embed getting it from the message each time

oblique laurel
slate swan
#
@mt.tree.command(name='configs', description='Check your configs!')
@app_commands.describe(choice='Choose an option!')
@app_commands.describe(word='Choose a word!')
@app_commands.choices(choice=[
  discord.app_commands.Choice(name='Check', value=1),
  discord.app_commands.Choice(name='Add', value=2),
  discord.app_commands.Choice(name='Remove', value=3)
])
async def configs(interaction: discord.Interaction, choice: discord.app_commands.Choice[int], word=''):
  if choice.value == 1:
Traceback (most recent call last):
  File "main.py", line 518, in <module>
    async def configs(interaction: discord.Interaction, choice: discord.app_commands.Choice[int], word=''):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/tree.py", line 889, in decorator
    command = Command(
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 685, in __init__
    self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 390, in _extract_parameters_from_callback
    raise TypeError(f'parameter {parameter.name!r} is missing a type annotation in callback {func.__qualname__!r}')
TypeError: parameter 'word' is missing a type annotation in callback 'configs'

```\
#

wait

#

nvm got it lol

hushed galleon
oblique laurel
hushed galleon
#

an embed object is like, 200 bytes in size

#

of course that could be bigger, perhaps at most 6kb, but you're not leaking memory or anything

drifting arrow
#

Hey, using the webhook system, how do you ping roles?

slate swan
#
  if choice.value == 1:
        with open('guilds.txt', 'r') as file:
          guildid = file.read()
        guildid = guildid.split()
        if str(interaction.guild.id) not in guildid:
         with open(f"{interaction.guild.id}.json", "w") as f:
            f.write("{}")       
         with open(f"{interaction.guild.id}.json", "r") as f:
           guilds = json.load(f)
         await update_guild(guilds, interaction.guild)
         with open(f"{interaction.guild.id}.json", "w") as f:
           json.dump(guilds, f, indent=4)
         with open("guilds.txt", "a") as f:
          f.write(f"{interaction.guild.id}\n")
          await interaction.response.send_message("Configs set up.", ephemeral=True)
        if str(interaction.guild.id) in guildid:
         with open(f"{interaction.guild.id}.json", "r") as f:
          guilds = json.load(f)
         words = guilds[f'{interaction.guild.id}']['words']
         await interaction.response.send_message(f"Words: {words}", ephemeral=True)
slate swan
# slate swan ```py if choice.value == 1: with open('guilds.txt', 'r') as file: ...
Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 862, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "main.py", line 526, in configs
    await update_guild(guilds, interaction.guild)
  File "main.py", line 26, in update_guild
    guilds[f'{guild.id}']['words'] = ''
KeyError: '1040483695976517732'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/tree.py", line 1242, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 887, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 880, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'configs' raised an exception: KeyError: '1040483695976517732'
drifting arrow
slate swan
#

I’m trying to just have it like cleaned up I want all the messages in the channel ids section to be sent to my channel I’d

drifting arrow
slate swan
#

wym

drifting arrow
#

At the end you have a key error

slate swan
#

yea its not updating the info

drifting arrow
#

A bunch of numbers, which tells me you're not parsing an int as a string

slate swan
#
with open(f"{interaction.guild.id}.json", "r") as f:
           guilds = json.load(f)
         await update_guild(guilds, interaction.guild)
         with open(f"{interaction.guild.id}.json", "w") as f:
           json.dump(guilds, f, indent=4)
drifting arrow
#

Just do str_guild_id = str(guild_id)

#

and use the str version to guild id as your dictionary/json item

slate swan
#

what

slate swan
drifting arrow
#

i dont know your code. I just know keys need to be strings

slate swan
#

thne
with open(path, "r")

#

that just raises errors

#

@drifting arrow

drifting arrow
#

but the issue comes down to your keys. Keys are the 'named' values in your dictionary..

mydictionary = { 'key1': "Hello World", 'key2': "APPLES!"}
slate swan
#

@drifting arrow i got it working

#

but i have another issue

#
  if choice.value == 2:

      with open(f"{interaction.guild.id}.json", "r") as f:
        guilds = json.load(f)
      format = f"'{word}', "
      guilds[f'{interaction.guild.id}']['words'] -= format
      with open(f"{interaction.guild.id}.json", "w") as f:
        json.dump(guilds, f)
      await interaction.response.send_message(f"Removed the word {word}.", ephemeral=True)
e Ignoring exception in command 'configs'
Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 862, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "main.py", line 544, in configs
    guilds[f'{interaction.guild.id}']['words'] - format
TypeError: unsupported operand type(s) for -: 'str' and 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/tree.py", line 1242, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 887, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 876, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'configs' raised an exception: TypeError: 
drifting arrow
#

pretty sure you cant minus a string from a string.

#

in your json file, store the words as a list.

#

and then simply remove that word from the list as needed

slate swan
#

how?

#

{"1040483695976517732": {"words": "'test', "}}

#

thisis how I have it

drifting arrow
#

a json file is just a dictionary.

mydictionary = {'mykey': ['list_item_1', 'list_item_2']}
slate swan
#

wait how would I do that?

shrewd apex
#

first of all u are storing more words in a string when a better approach would be to use a list

slate swan
#

WELL

#

oops cap lock

#

ik basic python btw

soft radish
#
Traceback (most recent call last):
  File "/home/runner/G9/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/G9/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1015, in invoke
    await self.prepare(ctx)
  File "/home/runner/G9/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 932, in prepare
    await self._parse_arguments(ctx)
  File "/home/runner/G9/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 839, in _parse_arguments
    transformed = await self.transform(ctx, param, attachments)
  File "/home/runner/G9/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 691, in transform
    raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: question is a required argument that is missing.```
#
@client.command(name='8ball', description='Let the 8 Ball Predict!\n')
async def _8ball(self, ctx, question):
    responses = ['As I see it, yes.',
             'Yes.',
             'Positive',
             'From my point of view, yes',
             'Convinced.',
             'Most Likley.',
             'Chances High',
             'No.',
             'Negative.',
             'Not Convinced.',
             'Perhaps.',
             'Not Sure',
             'Mayby',
             'I cannot predict now.',
             'Im to lazy to predict.',
             'I am tired. *proceeds with sleeping*']
    response = random.choice(responses)
    embed=discord.Embed(title="The Magic 8 Ball has Spoken!")
    embed.add_field(name='Question: ', value=f'{question}', inline=True)
    embed.add_field(name='Answer: ', value=f'{response}', inline=False)
    await ctx.send(embed=embed)```
slate swan
soft radish
slate swan
#

Are you typing just the _8ball command with nothing after it

soft radish
soft radish
#

oh shit

upbeat gust
#

it consumes the rest of the message instead of only 1 wors

#

wors

#

Word

loud junco
#

erm :D

slate swan
#

check dms lol i sent it yesterday

loud junco
#

i didnt get the notification 💀💀💀💀

charred radish
#

What embed colour is this

upbeat gust
novel apexBOT
#

This is not a Modmail thread.

upbeat gust
#

Ugh

charred radish
#

!tag ?

charred radish
upbeat gust
vale wing
#

When the hex

#

"What color is your embed?"
- Andrew Tate, Verified Discord Bot Developer

slate swan
#

lmaooo

upbeat gust
#

what

placid skiff
#

Guys always remember to use the correct naming convention for your variables. Especially if they're database tables and records Pepe_Meltdown

paper sluice
#

screaming snake for functions

vocal snow
#

People remove vowels from words and think it's an excellent naming convention

slate swan
#

couldnt think of shorter ones

placid skiff
#

My eyes hurt

loud junco
#

then rename it and makes the whole thing unusable?

placid skiff
#

I can't, they're from the work enviroment and they're already in production

slate swan
#

so its a lifetime fuckery now

placid skiff
#

also i can't show you the whole database but it's like very damn huge

#

and all namings for both records and tables are like that

#

so yeah i'm pretty screwed up

little lava
#

Is it possible to update voice channel name every seconds?

#
@tree.command(description="VC Timer")
async def timer(interaction, time: int):
    channel = client.get_channel(1042018244548108349)
    try:
        seconds = int(time)
    except ValueError:
        await interaction.response.send_message("Please enter a valid number.")
        return
    await interaction.response.send_message(f"Timer started for {seconds} seconds.")
    new_name = f"Timer: {seconds}"
    await channel.edit(name=new_name)
placid skiff
#

lol why you would even need that

little lava
#

i need a timer

loud junco
#

timer

#

lol

placid skiff
#

good i can't even remember module names

loud junco
#

lol

#

ask sarth

placid skiff
#

REALLY?

#

oh right

slate swan
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

@discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
placid skiff
#

thanks

little lava
#

Thank you!

slate swan
#

or Loop if you want the obj

#

but editing a channel name every minute is a bad idea

placid skiff
#

shh rate limit helps people learn

little lava
#

its even every seconds..

slate swan
#

you'll get ratelimited

little lava
#

oh...

slate swan
#

loooli cri about it

vale wing
#

Discord's gonna suck your soul out

placid skiff
#

rude

loud junco
little lava
#

how about every 3 or 5 seconds? it will limited?

vale wing
#

It will suck even more

slate swan
#

just use a text with a unix timestamp?

placid skiff
#

But where are ashley and hunter? i've not saw them in a while

slate swan
#

it will pretty much work as a timer

vale wing
#

It won't suck only with 5 min interval at least

little lava
#

umm...

slate swan
#

Hunter might be busy with studies, its his School's final year (class12th)

loud junco
#

ashley had been gone for a month

placid skiff
#

oh very nice for him

vale wing
#

Damn 12 grades

#

In Russia we have 11 max

slate swan
#

me who dropped after school

placid skiff
#

Bruh in Italy we don't even have "grades"

loud junco
loud junco
placid skiff
#

We finish with the fifth year of high school

loud junco
#

im secondary 4

vale wing
#

Here it's just 1-4 is elementary 5-8 is secondary and 9-11 is high

#

School naming convention be like

loud junco
#

6 years of primary and another 5 more for secondary

placid skiff
#

we have 5 years of elementary, 3 of secondary and then you will have to choose a specialized high school, normally you would do 5 years in high school, but with some of them you can have a degree after 3 years once you're 16, but some of them like technical institute (which i did) requires 5 years for the degree

vale wing
#

Is there discord bots school

placid skiff
#

nope lmao

shrewd apex
#

us

vale wing
loud junco
vale wing
#

If noone teaches young discord bot developers they won't grow up 😢

shrewd apex
#

missed disnake and hikari

vale wing
#

Ubuntu 22.10 seriously affected my grammar and braincells

vale wing
#

😡
🦶🦶

shrewd apex
shrewd apex
tepid dagger
#

how to get your bot commands to only work for admin roles

upbeat gust
#

???

tepid dagger
#

sry typo

upbeat gust
#

?d discord.ext.commands.has_permissions

#

!d discord.ext.commands.has_permissions

unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
tepid dagger
#

ty

#

how does one use ! d

#

explen

slate swan
#

!d <full path to the object>

#

you gotta learn the docs before using this first

tepid dagger
slate swan
#

whatever library's documentation you want

#

you need to know object names and their path

tepid dagger
#

oh

#

well that sounds like a pain to remember

charred radish
#

Oh btw to send embeds I have to use

await ctx.send(embeds=(list[“embed1”, “embed2” . . .]))
```?
upbeat gust
#

interaction.channel.send

#

You still have to respond though, possibly with defer

tepid dagger
#

wait wut, my bot's token magically stopped working after i did nothing

#

me can't run token

upbeat gust
#

That is not what I said.

upbeat gust
#

get a new one

tepid dagger
#

i did

upbeat gust
#

ok..?

tepid dagger
#

it sent a very long error message

#

can i dm it

#

cus def not sending it here

#

smth about access denied

upbeat gust
tepid dagger
#

it is

upbeat gust
tepid dagger
#

yes, does that happen a lot

upbeat gust
#

Then it's a replit moment

tepid dagger
#

rip

#

ill run it in vscode

#

alr

#

i still have an error but it doesn't have to do with the token

upbeat gust
#

.. okay?

#

I can't read your mind buddy

#

You have to actually show me

tepid dagger
#

idk what htis stuff mens

vale wing
#

This is the part of traceback right?

tepid dagger
#

yes

#

in line 980

vale wing
#

If so, send the full traceback please

tepid dagger
#

ok

#

lolits too long

#

i will send it in like 3 parts

vale wing
#

!paste

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.

vale wing
#

Just telling, the most important part of traceback in python is usually in the bottom

tepid dagger
#

i will send ze message but i gotta remove the personal stuff from da terminal first

#

me confused

upbeat gust
#

Windows or Mac?

tepid dagger
#

macos

upbeat gust
#

Getting [SSL: CERTIFICATE_VERIFY_FAILED] on Python 3 on OS X?
Navigate to your Applications/Python 3.X/ folder and double click the Install Certificates.command to fix this.
Happy coding!

tepid dagger
#

wut

#

ok

#

bro wut

#

wait, can somebody explain the replit one 2

#

it is partially replit but also there's parts about the actual code

vale wing
#

What's with it

tepid dagger
#

wdym

#

i can send the part b4 the replit moment

vale wing
#

I mean what's your problem with replit

#

actually replit is one huge problem itself

tepid dagger
#

smth about access denied

vale wing
#

Could you send the error

#

And when it occurs

tepid dagger
#

it started today and i hadn't changed anything since i worked on it yesterday

vale wing
#

One sec

tepid dagger
#

hopefully me didn't miss smth that someone could hack me with

vale wing
#

Check this out

alpine cove
#

lol

tepid dagger
#

did i miss something that gives away personal info

#

in the error msg

tepid dagger
alpine cove
#

buy a raspberry pi

tepid dagger
#

why

vale wing
alpine cove
tepid dagger
#

does replit hosting cost mny

vale wing
#

Raspberry is hard to buy rn isn't it

alpine cove
tepid dagger
#

ok

alpine cove
#

didnt know about that

tepid dagger
vale wing
#

Or read html if you can

tepid dagger
#

wait wut

#

i never tried keeping the bot alive

vale wing
#

But yk I live in Russia here we have weird stuff with electronics happening sometimes

tepid dagger
#

all i did was setup the bot

#

to like, be online

vale wing
#

Replit still uses shared IP

tepid dagger
#

how duz that affect me

vale wing
#

Discord bot is a web app

tepid dagger
#

so if 2 many ppl use

#

then it dont work?

vale wing
#

Many people make requests from same IP = more than 50 requests per second or other per-route thresholds violations = ratelimit

tepid dagger
#

rip

#

but i won't get the error if i write it locally right?

#

after i fix the cert thing

vale wing
#

If you run it locally

vale wing
#

Doesn't matter where you write it

alpine cove
tepid dagger
#

eventually i will tho

vale wing
vale wing
#

Was doing pretty well until I updated to ubuntu 22.10 had to downgrade entire thing to 22.04.1

tepid dagger
#

rip

slate swan
#
@mt.event
async def on_message(message):
  user = message.author
  guild = message.guild
  if not guild:
    await user.send("Get out of my DMS.")
#
Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 570, in on_message
    await user.send("Get out of my DMS.")
AttributeError: 'ClientUser' object has no attribute 'send'

primal token
#

the author was the own bot, your logic implies recursion

slate swan
#

you're asking the bot to get out of its own dms, gg

tepid dagger
#

lol i fixed the problem with replit

#

by changing 1 character, coding stupid

hot cobalt
#

So you might want to slap an if-statement up there to make sure you ignore its own messages ```py
if user == client.user:
return

cloud dawn
slate swan
#

was cog loading changed somehow

#
for filename in os.listdir("./cogs"):
  if filename.endswith('.py'):
    try:
      bot.load_extension(f'cogs.{filename[:-3]}')
      print(f"{filename} loaded")
    except Exception as e:
      print(f"Exception in {filename}\n\n {e}")
  else:
    if filename != "__pycache__":
      print(f'{filename[:-3]} Not an .py file')

RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited bot.load_extension(f'cogs.{filename[:-3]}')

#

prob should google before askin

slate swan
#

im trying to make a dropdown selection but it gives me this error:

Ignoring exception in command menu:
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\ADMIN\Desktop\r.lykn\code.py", line 18, in menu
    await ctx.send("Menus!",view=Select())
  File "C:\Python310\lib\site-packages\discord\abc.py", line 1368, in send
    raise InvalidArgument(f'view parameter must be View not {view.__class__!r}')
discord.errors.InvalidArgument: view parameter must be View not <class '__main__.Select'> 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: view parameter must be View not <class '__main__.Select'>
#

my code is this:

class Select(discord.ui.Select):
    def __init__(self):
        options=[
            discord.SelectOption(label="a",description="h"),
            discord.SelectOption(label="b",description="hh"),
            discord.SelectOption(label="c",description="hhh")
            ]
        super().__init__(placeholder="Select an option",max_values=1,min_values=1,options=options)
    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message(content="h", ephemeral=False)

class SelectView(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.add_item(Select())

@bot.command()
async def menu(ctx):
    await ctx.reply("menu",view=Select())
#

nevermind i got it working

upbeat otter
upbeat otter
#

nice

upbeat otter
upbeat otter
slate swan
#

how to return a message where only the person using the command can see it with the slash command?

naive briar
#

What is return a message

paper sluice
charred radish
#

how do i give user a role

naive briar
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") 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.
charred radish
#

await interaction.user.add_roles("role name" . .. .)?

naive briar
#

A role object or just any object that has an id attribute of a role

slate swan
#

Why won’t my? bot rename the ticket

#

@slate swan u need to show the code

#

@slate swan

#

u cant rename the channel by sending a message...

#

await interaction.channel.edit(name='name')

#

that should work

slate swan
#

Shouldn’t I be able to?

#

no

naive briar
#

The bot is probably ignore other bots' messages

slate swan
#

^^^

#

@slate swan you can't rename via another bot, make your bot change channel name

#

yea^

slate swan
slate swan
#

Ooooo ty guys fr had me confused 😭

#

yea yw

quasi thorn
#

i'm not sure i should ask here but i pip installed dhooks but for some reason can't import it

cloud dawn
#

Yikes the last update of that pip was 2 years ago, you sure want to use this?

quasi thorn
#

zamn i was following a tutorial from 2020 without noticing

#

what module should i use to easily send data to webhooks

cloud dawn
#

No clue never worked with webhooks.

maiden fable
unkempt canyonBOT
#
Fat chance.

No documentation found for the requested symbol.

maiden fable
#

!d discord.ext.commands.Bot.fetch_webhook *

unkempt canyonBOT
#

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

Retrieves a [`Webhook`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook "discord.Webhook") with the specified ID.

Changed in version 2.0: `webhook_id` parameter is now positional-only.
maiden fable
#

!d discord.Webhook.send

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

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.11)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects to send.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
maiden fable
#

Easy peasy

quasi thorn
#

thankss

alpine cove
maiden fable
#

Indeed

slate swan
#

how can I get all the invite codes a user has made?

alpine cove
slate swan
#

k bc i didnt understand the docs

slate swan
# alpine cove invites = list(filter(lambda inv: inv.inviter.id == user.id, ctx.guild.invites))
Traceback (most recent call last):
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/tree.py", line 1242, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 887, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 876, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'invites' raised an exception: TypeError: 'method' object is not iterable
cloud dawn
slate swan
#
[<Invite code='TBCfJQqzVr' guild=<Guild id=1040483695976517732 name='bot testing' shard_id=0 chunked=True member_count=5> online=None members=None>, <Invite code='jjkJPVuv' guild=<Guild id=1040483695976517732 name='bot testing' shard_id=0 chunked=True member_count=5> online=None members=None>]
#

any way to make this nicer?

cloud dawn
#

This is nicer repr is gut :3

#

No clue half the code is scrambled.

#

Indention most likely

#

Well I have no idea if that is the case since I can't see anything.

#

But seeing as this top code is indented that far out there is likely something wrong.

#

When you create a class the first indent is usually the class so it appears to be there.

#

2 indentions in and your inside the first indention of a function.

#

Why are you also adding app commands to a Cog but they use groups..? And a tree..? pithink

#

Help

#

!remind 5d don't touch pycord

unkempt canyonBOT
#
Certainly not.

Sorry, you can't do that here!

cloud dawn
#

Still same applies it's on the first indention and you have no self inside a class instance, only inside the methods.

#

See "self" or "this" as a private protected variable.

#

And not mutable inside a class.

slate swan
#

any ideas for what can i do w my bot?

cloud dawn
#

Well.. at the root lol

cloud dawn
slate swan
#

HAHA

#

now frrr

cloud dawn
#

lol why not have it ping a random online user to chat.

#

tldr you can't use self inside a class like that.

#

Do it in the init

verbal monolith
cloud dawn
#

It's a bit ambiguous, what do you mean by "where would i add it ?"?

verbal monolith
#

like

#

would i change ctx.send to ctx.reply?

cloud dawn
#

Both would work.

verbal monolith
#

if i want it to message reply though, id use ctx.reply, right?

cloud dawn
#

Yes.

verbal monolith
#

got ittt tyy

#

how would i make a command to send messages from the console? or would i be better off using the echo command

waxen cradle
#

guys where do you host a bot for free?

cloud dawn
mighty pilot
#

I recommend oracle for free hosting

#

They might sell your info though

cloud dawn
waxen cradle
#

thx

cloud dawn
# waxen cradle guys where do you host a bot for free?

Affordable hosting providers:
• OVH Starting at $3.35/mo for 1 core, 2GB RAM, 20GB SSD
• DigitalOcean Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
• Linode Starting at $5/mo for 1 core, 1GB RAM, 25GB SSD
• Vultr Starting at $2.50/mo for 1 core, 512MB RAM, 10GB SSD
• AWS Lightsail Starting at $3.50/mo (first month free) for 1 core, 512MB RAM, 20GB SSD
• Time4VPS Starting at €3.99/month for 1 core, 2GB RAM, 20GB SSD
• VIRMACH Full Windows and Linux Desktop VPS starting at $7/mo and $1/mo respectively
• Netcup Starting at €2.62/mo for 1 core, 2GB RAM, 20GB SSD
• GitHub education Free credit and other offers for students
• Microsoft students Free credit for students
• Google Cloud free tier

mighty pilot
# slate swan any ideas for what can i do w my bot?

My random bot I started recently handles welcome images pasting member pfp onto a background and also runs giveaways. Future implements I plan to include are a 2 hour timer to let people know when the server may be bumped again and a staff member application modal that sends an embed to the staff channel with the answers they input

slate swan
verbal monolith
#

hold on im gonna try and make one and tell me what i did wrong

slate swan
#
async def load():
  for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
      await mt.load_extension(f'cogs.{filename[: -3]}')

async def main():
  await load()
Traceback (most recent call last):
  File "main.py", line 582, in <module>
    asyncio.run(main())
  File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "main.py", line 24, in main
    await load()
  File "main.py", line 21, in load
    await mt.load_extension(f'cogs.{filename[: -3]}')
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1012, in load_extension
    await self._load_from_module_spec(spec, name)
  File "/home/runner/miner-bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in _load_from_module_spec
    raise errors.NoEntryPointError(key)
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.ping' has no 'setup' function.
timid spade
#

is there any event name about detecting someone boosting a server?

slate swan
#

async def on_message():
if message.type == discord.MessageType.premium_guild_subscription:

slate swan
#

yw

dense horizon
#

Hello, I'm using discord.py and I'm wondering how to make a field in embed to be on 1 line. For example, I have a field with name 'test' and value 'check'. I can do something like this: test check
But how can I do something like this: test check inline=True doesn't work

sick birch
#

Add it to your description

dense horizon
#

Okay, but is there a way to change size of the text in the description?

sick birch
#

No

dense horizon
#

And the last question, is there some other, more customizable alternatives to embeds?

sick birch
#

Discord is a text messaging platform not a front end UI framework

dense horizon
#

Got it, thank you!

alpine cove
#

^

cloud dawn
#

ˢᵐᵒˡˡ ᵗᵉˣᵗ

slate swan
#
@commands.Cog.listener("on_command_error")
async def on_sync_error(self, interaction: discord.Interaction, error: app_commands.AppCommandError):
  if isinstance(error, app_commands.CommandOnCooldown):
    await interaction.response.send_message(str(error), ephemeral=True)
#

how can I add a cooldown to command

#

in cogs

naive briar
#

!d discord.app_commands.checks.cooldown

unkempt canyonBOT
#

@discord.app_commands.checks.cooldown(rate, per, *, key=...)```
A decorator that adds a cooldown to a command.

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns are based off of the `key` function provided. If a `key` is not provided then it defaults to a user-level cooldown. The `key` function must take a single parameter, the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction") and return a value that is used as a key to the internal cooldown mapping.

The `key` function can optionally be a coroutine.

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandOnCooldown "discord.app_commands.CommandOnCooldown") is raised to the error handlers.

Examples

Setting a one per 5 seconds per member cooldown on a command:
alpine cove
# cloud dawn

I remeber doing smth like that a while back its still just ascii art

slate swan
#
  d = '0'
  print(sid) a = 0 b = 0 c = 0 d 
      
#

File "main.py", line 37
d = '0'
^
IndentationError: unindent does not match any outer indentation level

alpine cove
slate swan
#

i did

alpine cove
#

send the whole code

#

like everything

#

the whole func

#

/ command

slate swan
#
your_twilio_phone_number = raw_config['Twilio Phone Number']
ngrok = raw_config['ngrok_url']
client = Client(account_sid, auth_token)
server_id = int(raw_config['server_id'])
app = Flask(__name__)
@slash.slash( name='call', description='F', guild_ids=[server_id], options=[ discord_slash.utils.manage_commands.create_option( name='phone', description='With +1', required=True, option_type=3 ), discord_slash.utils.manage_commands.create_option( name='digits', description='Seg', required=True, option_type=3 ), discord_slash.utils.manage_commands.create_option( name='name', description='Seg', required=True, option_type=3 ), discord_slash.utils.manage_commands.create_option( name='companyname', description='Seg', required=True, option_type=3 ) ])
async def _call(ctx=SlashContext, phone=str, digits=str, name=str, companyname=str):
    await ctx.send('Nothing Just Want To Avoid Error')
    open('Extra/Digits.txt', 'w').write(f'{digits}')
    open('Extra/Name.txt', 'w').write(f'{name}')
    open('Extra/Company Name.txt', 'w').write(f'{companyname}')
    call = client.calls.create( url=f'{ngrok}/voice', to=f'{phone}', from_=f'{your_twilio_phone_number}' )
    sid = call.sid
  print(sid) 
  a = 0 
  b = 0 
  c = 0
  d = 0
naive briar
#

What is that abomination

slate swan
alpine cove
#

otherwise it might have a problem with whitespaces in ur code

#

why r u using d.py slash anyways?

silk bridge
#
import discord
import config
import requests
import os
import asyncio
import datetime
import time
import random

from discord import Intents
from discord.ext import commands
from discord import app_commands

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

bot = commands.Bot(command_prefix="!", intents = discord.Intents.all())
bot.remove_command('help')```

code:
```py
@bot.command()
@commands.has_permissions(administrator=True)
async def start(ctx, mins : int, *, prize: str):
    embed = discord.Embed(title='Giveaway!', description= f"{prize}", color = 0x2E79FF)
    end = datetime.datetime.utcnow() + datetime.timedelta(seconds = mins*60)
    embed.add_field(name='Current time: ', value = f"{end} UTC", inline=False)
    embed.set_footer(text = f'Ends {mins} minutes from now!')
    my_msg = await ctx.send(embed = embed)
    await my_msg.add_reaction("📀")
    await asyncio.sleep(mins*60)
    new_msg = await ctx.channel.fetch_message(my_msg.id)
    users = await new_msg.reactions[0].users().flatten()
    users.pop(users.index(bot.user))
    winner = random.choice(users)
    await ctx.send(f"Congratulations {winner.mention} won {prize}! ")
    await winner.send('Hiya')

its start the giveaway
but not finish it

error code

Traceback (most recent call last):
  File "C:\Users\אמיר\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\אמיר\Desktop\servers\Discord Ne0r4i Stock\Official Bot\official_bot_start.py", line 100, in start
    bot.run(config.TOKEN)
AttributeError: 'async_generator' object has no attribute 'flatten'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\אמיר\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1349, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\אמיר\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "C:\Users\אמיר\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'async_generator' object has no attribute 'flatten'```
#

someone?

naive briar
#

It means exactly what it says

#

!d discord.Reaction.users

unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.11)") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Changed in version 2.0: `limit` and `after` parameters are now keyword-only.

Examples

Usage...
slate swan
#
async def on_message(message):
    if message.author != client.user:
      channellist = [1034897577478455337, 1025864145150685194, 1038870393815044257, 1033090064827306086]
      if message.channel.id in channellist:
       
        channel = client.get_channel(1041876398849146910)
        await channel.send(f"@everyone {message.content}") ```

Does anyone know how I can have my `ids` in the `channellist` section messages to be sent to `1041876398849146910`
cinder tulip
#

!d discord.Embed

alpine cove
#

fetch the user and then user.send

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

x == y Checks if two embeds are equal.

New in version 2.0...
mighty pilot
#

Can't you just put channellist in your message send

#

Oh you mean user IDs from the messages in those channels

cinder tulip
#

does someone know how to help me

naive briar
#

What is the problem

alpine cove
#

yea send the traceback

cinder tulip
#

ok so i run the kick command with an account that doesnt has the perms and it doesnt show the embed

mighty pilot
#

Does it perform the kick

#

Does it show any errors in your console

cinder tulip
#

i mean you need the kick_members perm and the account doesnt has it and no it doesnt kick it

#

wait let me check

slate swan
cinder tulip
naive briar
#

Call the discord.Color.red

cinder tulip
# slate swan show code
@client.command()
@has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
    await member.kick(reason=reason)
    await ctx.send(f"{member} has been kicked | Reason: {reason}")

@kick.error
async def kick_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        embed = discord.Embed(title="You don't have the permissions to do so.", color=discord.Color.red)
        await ctx.send(embed=embed)
cinder tulip
cinder tulip
mighty pilot
alpine cove
#

*traceback
the code seems fine on a first glance

river obsidian
#
\u001b[bold;30m
afafa
#
\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
\u001b[1;40;32mThat's some cool formatted text right?
main moth
#

Hey I have a question, I have a Discord bot that runs 24/7. I pass a Discord ID from PHP to a python script, how can I now call a function from a python script to a Discord bot (other python script) and give a return to the other script that it worked?

shrewd apex
#

websockets

ocean dragon
#

what is the default value for file parameter in discord.Webhook.send ? if I put None it will throw an error

slate swan
#

Why won’t it send a embed when I do roll then a number

main moth
shrewd apex
#

ofc

main moth
shrewd apex
#

only thing i can say is learn python

main moth
#

ik

#

i am still on it

#

😉

#

Else i would not ask bro

shrewd apex
naive briar
#

🧐

slate swan
#

traceback:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: View.to_components() missing 1 required positional argument: 'self'

my code:

class Texting(discord.ui.TextInput):
    def __init__(self):
        super().__init__(placeholder="hello", type=4)
    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message("thanks for sharing!!!!!!")

class TextingView(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.add_item(discord.ui.TextInput(label="hhhhh", placeholder="hhhhhhhhhhhh"))

@bot.command()
async def texting(ctx):
    await ctx.reply("abc",view=TextingView)

???

shrewd apex
main moth
delicate pilot
#

anyone can help me

#

@shrewd apex

main moth
#

you named it leo

shrewd apex
#

leo.run

delicate pilot
#

@shrewd apex

shrewd apex
#

enter some code under on_member_join

slate swan
delicate pilot
slate swan
naive briar
#

TextInput can only be used with modals

#

And you have to create an instance of your view by calling it

slate swan
#
@commands.Cog.listener("on_command_error")
async def on_sync_error(self, interaction: discord.Interaction, error: app_commands.AppCommandError):
  if isinstance(error, app_commands.CommandOnCooldown):
    await interaction.response.send_message(str(error), ephemeral=True

how can I add cooldown to cogs?

main moth
#

@shrewd apex i dont get it, i tryed it so:
Script after php args got:

import asyncio
import websockets

uri = 'ws://0.0.0.0:8000'

async def send_message():
    async with websockets.connect(uri) as websocket:
        message = input("msg: ")

        await websocket.send(message)
        print(f"[ws client] message  > {message}")

        #answer = await websocket.recv()
        #print(f"[ws client] answer < {answer}")

asyncio.get_event_loop().run_until_complete(send_message())

Script (Discord Bot) i added following:

async def response(websocket, path): 
    message = await websocket.recv()
    channel = client.get_channel(MY_CHANNEL_ID)  # access to channel
    await channel.send(f'websockets: {message}')
    
server = websockets.serve(response, '0.0.0.0', '8000')
asyncio.get_event_loop().run_until_complete(server)
#

But there is even no message coming to my channel

slate swan
#

how do i make a modal then?

slate swan
#

#bot-commands

shrewd apex
main moth
main moth
slate swan
#
async def on_message(message):
    if message.author != client.user:
      channellist = [1034897577478455337, 1025864145150685194, 1038870393815044257, 1033090064827306086]
      if message.channel.id in channellist:
       
        channel = client.get_channel(1041876398849146910)
        await channel.send(f"@everyone {message.content}") ```

Does anyone know how I can have my `ids` in the `channellist` section messages to be sent to `1041876398849146910`
slate swan
alpine cove
slate swan
#

how do i make a modal?
someone help

cinder tulip
#

if i wanna put just one user do i need to do discord.Member = {their-id} ?

sick birch
cinder tulip
#

i'd just like to make like an embed where i can put my bot

#

so even if they do .credits @slate swan the bot is still gonna come out

#

oh no... i pinged someone

sick birch
#

What does the bot do with the user?

cinder tulip
#

.credits and then just show the bot's profile picture, and the name

empty crane
#

How would I make it so I can customize my bot through a website?

alpine cove
cinder tulip
#

of the bot, and not of anyone else

alpine cove
empty crane
alpine cove
slate swan
# alpine cove be more specific
class TextModal(discord.ui.Modal):
    def __init__(self):
        super().__init__()

i know that that makes the actual modal, but how do i make a discord.ui.View

alpine cove
slate swan
alpine cove
slate swan
alpine cove
#

a lot of aliases

slate swan
slate swan
#
label="label"
style=discord.TextStyle.short
placeholder="idk something"
min_length=4
max_length=50
etc..
slate swan
main moth
#

How to give a Discord bot an arg from other script. With normal script it works with: sys.argv

#

Is there a way to implement in discord bot

alpine cove
#

or have a run func

main moth
#

so import bot and then create async function which runs a channel.send?

main moth
#

and just run the function basically without any event or loop?

alpine cove
main moth
#

I try this, you understand me?

main moth
alpine cove
#

i cant help you out here

main moth
#

So you dont know what i mean or how to do it?

#

I can help you to understand my question ^^

#

@alpine cove

slate swan
#

also not even sure u can run a script from inside a discord bot lol

#

or how that would even work

alpine cove
main moth
#

Thanks for the idea xD

alpine cove
#

maybe someone else will be able to help you

main moth
main moth
# alpine cove gl

Bro could you pls just say me why it does not work:

async def password_reset_code():
    while True:
        channel = client.get_channel(815263639333371908)
        message = "test"
        await channel.send(f"{message}")
        await asyncio.sleep(10)```
#

and Thank you

alpine cove
#

dont use pycord

alpine cove
#

second of all: use tasks

#

print channel

main moth
alpine cove
#

yea use bot

main moth
#

But it is underlindes

slate swan
# alpine cove u didnt test it?
async def on_message(message):
    if message.author != client.user:
      channellist = [1034897577478455337, 1025864145150685194, 1038870393815044257, 1033090064827306086, 1039968764927692863]
      if message.channel.id in channellist:
        channel = client.get_channel(1041876398849146910)
        await channel.send(f"@everyone {message.content}")```

**Why doesn't the bot send messages to my id?**
main moth
alpine cove
#

no traceback?

slate swan
alpine cove
main moth
slate swan
alpine cove
#

in most text editors you can do ctrl+r to replace all strings

main moth
main moth
alpine cove
#

I didnt say it would fix the error

alpine cove
main moth
#

with which function does it work?

naive briar
alpine cove
alpine cove
slate swan
alpine cove
#

*might have

alpine cove
main moth
#

client = commands.Bot(command_prefix="!", intents=discord.Intents.all(), help_command=PrettyHelp(color=discord.Color.dark_gold(), active=10))

#

And on Discord settings also

slate swan
alpine cove
naive briar
#

Do I really have to tell anything

alpine cove
#

nope

slate swan
alpine cove
main moth
#

yeah ik

alpine cove
#

a user cant read messages from a server he isnt in

#

same with bots

upbeat gust
#

I don't think message is even defined here

main moth
alpine cove
main moth
main moth
ocean dragon
#

I have an autocomplete descriptor

async def my_autocomplete(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice[str]]:
    options = await database.fetch(...)

obviously this is not feasible, how could I get the options ONCE per command and just compare when the current changes? I could add options to bot.autocomplete_options but is there a more dynamic way?

upbeat gust
#

maybe use difflib.get_close_matches to get closes 25

ocean dragon
#

yeah im doing that

ocean dragon
#

thx i'll try that

waxen cradle
#

so here if i put the hour as 23:25 (my local hour is 23:17), the bot will wait till the time is 23:25 to send the message, but if i put the hour as 6, for 6 in the morning the bot sends the message instantly

#

should i replace days=0 to days=1

lunar island
#

is anyone able to help fix a Python code that i found for doing a webhooks bot, sadly the author isnt responding and i belive the syntax are broken and my understanding of script is rudimentary at best

upbeat gust
waxen cradle
#

i figured it out

slate swan
#

Once I send my bot a users discord ID I want it to send it back how can I do this?
And it can’t be a command

cloud dawn
waxen cradle
waxen cradle
cloud dawn
#

But why would you need to sleep until morning?

waxen cradle
slate swan
mighty pilot
#

how do i grab user input from a modal? i have everything else setup i just dont know how to do anything with their input

waxen cradle
alpine cove
#

!d discord.TextInput.value

unkempt canyonBOT
alpine cove
#

got smth mixed up anyways

soft fjord
#

guys does anyone know how to install pycord on spyder?

#

if I do pip install discord

#

I get this result

#

Note: you may need to restart the kernel to use updated packages.
C:\Users\Andrew\AppData\Local\Programs\Spyder\Python\python.exe: No module named pip

slate swan
#

yo does anyone know how to run multiple discord accounts via one program

soft fjord
#

oh wait

waxen cradle
alpine cove
soft fjord
waxen cradle
#

in command prompt\

slate swan
alpine cove
soft fjord
slate swan
soft fjord
slate swan
#

but how considering bot.run only takes one token

alpine cove
slate swan
soft fjord
slate swan
#

nah

#

im just mentally slow mate im sorry

soft fjord
#

ok so, it did install discord on spyder

#

but when I do

soft fjord
#

import discord, it says "No module named 'discord'"

slate swan
#

Elaborate

waxen cradle
#

ah i think i had this problem

slate swan
#

dont use spyder

alpine cove
soft fjord
slate swan
alpine cove
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.11)"). 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.11)") 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.11)") 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**...
soft fjord
alpine cove
waxen cradle
slate swan
alpine cove
waxen cradle
#

but i can't really remember it was a few months ago

soft fjord
alpine cove
#

just install it correctly

soft fjord
#

it installed

#

but it still says module not found

waxen cradle
#

i would love to tell you exactly where i moved the installed discord module but thats how i solved it

soft fjord
#

so where did u move it?

waxen cradle
#

@soft fjord run: pip list in your terminal

soft fjord
#

in spyder terminal?

waxen cradle
#

i never used spyder but sure

soft fjord
#

yes

#

indeed

waxen cradle
#

you have it?

slate swan
#

yo can anyone help me w running multiple accounts on one script on discord.py

#

i know threading would help

#

but idk threading that well

soft fjord
waxen cradle
#

well then it's not installed where it should be exactly

soft fjord
#

so how do I move it, and where?

waxen cradle
#

for starters try pip uninstall discord

#

and install it again from command prompt and not spyder

hollow gazelle
#

AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?

alpine cove
hollow gazelle
alpine cove
#

bot.tree.command()

#

is your way go go in d.py

hollow gazelle
alpine cove
alpine cove
mighty pilot
#

is there a limit to how many fields a modal has?

hollow gazelle
#

is it a slash command hto

alpine cove
#

oh no wait

#

I thought you ment char limit

mighty pilot
#

4000 fieldsRipwhoop

alpine cove
#

idk if there is a field limit

mighty pilot
#

lol ok

slate swan
alpine cove
#

prob tho

slate swan
#

how u gonna have that many options lfmao

mighty pilot
#

guess im testing that 4000 limit

#

gonna have to close your app to get out of my modal

#

is there a way to do multiple choice in one or just text based answers

hollow gazelle
#

async def restock(inter: discord.MessageInteraction, new_stock: discord.Attachment) -> None:
NameError: name 'discord' is not defined

slate swan
#

import discord

hollow gazelle
#

i did

slate swan
#

pip uninstall discord

hollow gazelle
#

ok

slate swan
#

pip install discord

#

lmfao im not even joking that worked for me

alpine cove
#

the docs dont state wether there is a limit or nit

#

*not

#

but the discord api is confusing anyways

#

*the dics

#

*docs

mighty pilot
#

well im trying with 7 fields so ill lyk if its less than that lol

fading marlin
#

it's probably 5

cloud dawn
#

@waxen cradle ```py
from datetime import datetime

from discord.ext import tasks
from discord.ext.commands import Bot, Cog

class MyCog(Cog):
def init(self, bot: Bot) -> None:
self.bot = bot
self.weather_loop.change_interval(time=self.get_next_date_at(hours=6))
self.weather_loop.start()

async def cog_unload(self) -> None:
    self.printer.cancel()

def get_next_date_at(*, hours: int = 0, minutes: int = 0, seconds: int = 0) -> datetime:
    dtnow = datetime.now()
    if dtnow.hour < hours or dtnow.minute < minutes or dtnow.second < seconds:
        dt = datetime(dtnow.year, dtnow.month, dtnow.day, hours, minutes, 0, 0)
    else:
        tomorrow = dtnow + timedelta(days=1)
        dt = datetime(tomorrow.year, tomorrow.month, tomorrow.day, hours, minutes, 0, 0)

    return dt

@printer.before_loop
async def before_weather_loop(self) -> None:
    await self.bot.wait_until_ready()

@tasks.loop()
async def weather_loop(self) -> None:
    ...

@bulker.after_loop
async def after_weather_loop(self) -> None:
    self.weather_loop.change_interval(time=self.get_next_date_at(hours=6))
soft fjord
mighty pilot
slate swan
#

I want my bot to say hello when I send the id of another discord user However I got this error

fading marlin
#

why are you using textchannel creation event for that

mighty pilot
fading marlin
#

yeah, it's 5

mighty pilot
#

gonna go cry now

fading marlin
#

now go cry 🔫

mighty pilot
cloud dawn
#

And waiting that long for a potential message is not the right way.

hollow gazelle
#

async def boost(ctx: discord.ApplicationContext,
AttributeError: module 'discord' has no attribute 'ApplicationContext'

fading marlin
#

did you mean commands.Context?

cloud dawn
fading marlin
cloud dawn
#

||Dind't test it tough||

fading marlin
#

ah

cloud dawn
#

It was from another question but he just slept the entire task for 24hrs and started the task wrong so it could be 10~ seconds off.

#

Critical time.

waxen cradle
fading marlin
#

consider using aiohttp instead of requests

alpine cove
#

^

cloud dawn
#

^

#

But eh it's in a task so in theory it shouldn't impact it that much.

fading marlin
#

also, requests.get returns a Response object which has a json method that does what're you doing for you (no need to json.loads)

cloud dawn
#

Scratch that requests can wait for like an hour on some bad requests lol

alpine cove
cloud dawn
alpine cove
cloud dawn
#

Since it's sync it will just wait.

slate swan
cloud dawn
#

Ignores my question

fading marlin
soft fjord
#

guys what ide do u use?

#

I dont think spyder is any good

cloud dawn
soft fjord
#

alr

pastel yew
#

Hey, does anyone know how to make a script that makes my account send a specific message to a discord channel every couple of minutes?

fading marlin
#

that is against tos

cloud dawn
#

Discord doesn't allow self botting.

pastel yew
fading marlin
#

regardless

pastel yew
#

Alright, how do you make a script run over and over again?

cloud dawn
#

^ We also won't help since it's a bannable offense.

cloud dawn
fading marlin
#

!rule 5

unkempt canyonBOT
#

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

pastel yew
#

What, I just need a way to make a script run over and over again.

cloud dawn
cloud dawn
#

Again, we won't help break ToS.

fading marlin
cloud dawn
#

So please stop asking about self botting and anything regarding repeating scripts.

pastel yew
#

Is it not allowed to make a bot make an announcement every hour or a reminder?

slate swan
fading marlin
#

ah

slate swan
#

I want the person making a ticket to just send the id of the person they are dealing and for my bot to just send the id back that’s all

slate swan
cloud dawn
#

If you think that is unfair please contact @novel apex

fading marlin
slate swan
fading marlin
slate swan
fading marlin
#

!d discord.ext.commands.Bot.wait_for you can get docs :)

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.11)"). 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.11)") 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.11)") 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**...
fading marlin
#

check the first example

slate swan
fading marlin
#

wdym

hollow gazelle
#

odule 'discord' has no attribute 'ApplicationContext'
File "D:\yew\main.py", line 149, in <module>
async def boost(ctx: discord.ApplicationContext,

slate swan
#

Oh nvm Alr I’ll try

#

Btw last thing yk what I can check like what should I check about the content tho to see if it’s a id if that makes sense?

fading marlin
mighty pilot
#

how do i get a users highest role without knowing what # it is? i can get the list of roles from interaction.user.roles[] but the highest role is at the end of the list

fading marlin
hollow gazelle
mighty pilot
#

thanks

fading marlin
hollow gazelle
fading marlin
#

use a normal type hint

hollow gazelle
#

idk how

cloud dawn
#

What is option?

fading marlin
#

oh wait no

#

!d discord.ext.commands.parameter - it does

unkempt canyonBOT
#

discord.ext.commands.parameter(\*, converter=..., default=..., description=..., displayed_default=...)```
A way to assign custom metadata for a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")'s parameter.

New in version 2.0.

Examples

A custom default can be used to have late binding behaviour.

```py
@bot.command()
async def wave(ctx, to: discord.User = commands.parameter(default=lambda ctx: ctx.author)):
    await ctx.send(f'Hello {to.mention} :wave:')
fading marlin
#

there's also param as an alias if you want

hollow gazelle
#

im confused on how i use it

fading marlin
#

there's an example in the docs

hollow gazelle
#

im like really new to python trying to learn as i go on

fading marlin
#

well that's not really good, discord bot development isn't really the most beginner-friendly project

cloud dawn
#

But if you're determined it's fine

mighty pilot
#

it can be done though

#

ive been learning as i go

cloud dawn
#

I did as well unless... no I still suck nvm

mighty pilot
#

lmao

hollow gazelle
fading marlin
#

dpy's version changes it to a default instead of a type hint, and you gotta use commands.param(eter)

cloud dawn
#

Not like this just typehint str then use describe decorator with the kwarg names for the arg.

fading marlin
#

read the docs for argument names and what they correspond

cloud dawn
#

Could someone link the describe? I'm on phone rn

slate swan
#

!d discord.app_commands.describe

unkempt canyonBOT
#

@discord.app_commands.describe(**parameters)```
Describes the given parameters by their name using the key of the keyword argument as the name.

Example:

```py
@app_commands.command(description='Bans a member')
@app_commands.describe(member='the member to ban')
async def ban(interaction: discord.Interaction, member: discord.Member):
    await interaction.response.send_message(f'Banned {member}')
```  Alternatively, you can describe parameters using Google, Sphinx, or Numpy style docstrings...
slate swan
#

there's an options* decorator too iirc

hollow gazelle
#

igh

#

ill tryu

cloud dawn
#

Bed.. too.. comfy

#

😴

slate swan
#

lmao

#

its 5am and i still can't sleep

cloud dawn
#

Sleep rn

fading marlin
#

turn your phone off jeez

cloud dawn
#

Just think about pandas always works for me

slate swan
#

Kannakillyourself i still got tons of assignment left

cloud dawn
#

Same but sleep important

hollow gazelle
#

i tried but it didnt work

#

i think imma give up

soft fjord
#

File "C:\Users\Andrew\Desktop\discordbot.py", line 4, in <module>
bot = discord.Bot()
AttributeError: module 'discord' has no attribute 'Bot'

fading marlin
#

commands.Bot/discord.Client

soft fjord
#

I hate this library

hollow gazelle
soft fjord
#

is this correct? bot = discord.Bot()

hollow gazelle
soft fjord
#

ah

hollow gazelle
#

yup

#
bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())
#

thats really all u need to put

soft fjord
#

bot = commands.bot()
NameError: name 'commands' is not defined

hollow gazelle
#

from discord.ext import commands

#

holdon

#
import discord
from discord.ext import commands
#

there

soft fjord
#

ile "C:\Users\Andrew\Desktop\discordbot.py", line 6, in <module>
@bot.slash_command(name = "main AI", description = "introduces himself")
AttributeError: 'Bot' object has no attribute 'slash_command'

#

💀

hollow gazelle
#

here

#

@bot.tree.command

soft fjord
#

is the documentation wrong, cuz I copied it from there

hollow gazelle
#

try what i did

#

@bot.tree.command

soft fjord
#

k one sec

hollow gazelle
#

ok

#

replace them all that have @bot.slash_command()

soft fjord
#

C:\Users\Andrew\Desktop>python discordbot.py
Traceback (most recent call last):
File "C:\Users\Andrew\Desktop\discordbot.py", line 7, in <module>
async def hello(ctx):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\app_commands\tree.py", line 889, in decorator
command = Command(
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\app_commands\commands.py", line 664, in init
self.name: str = validate_name(name)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\app_commands\commands.py", line 211, in validate_name
raise ValueError(
ValueError: 'main AI' must be between 1-32 characters and contain only lower-case letters, numbers, hyphens, or underscores.

#

fixed this one

#

File "C:\Users\Andrew\Desktop\discordbot.py", line 10, in <module>
bot.run(os.getenv(token))
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 828, in run
asyncio.run(runner())
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 745, in start
await self.login(token)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 577, in login
raise TypeError(f'expected token to be a str, received {token.class.name} instead')
TypeError: expected token to be a str, received NoneType instead

#

whats this?

soft fjord
hollow gazelle
soft fjord
#

no, I just wanna connect to the bot

#

do i just use bot.run(token)?

merry sail
#

environment variables are a neat way to ensure privacy if your bot is open source

#

but if you're just keeping it to yourself might as well just have the token as a string then and there

#

so bot.run('token')

soft fjord
#

I did it

#

but the output was this

#

[2022-11-16 01:01:29] [INFO ] discord.client: logging in using static token
Traceback (most recent call last):
File "C:\Users\Andrew\Desktop\discordbot.py", line 10, in <module>
bot.run(token)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 828, in run
asyncio.run(runner())
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 746, in start
await self.connect(reconnect=reconnect)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 672, 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.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001D933773790>
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
F

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.

#

ile "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x000001D933773790>
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed

merry sail
#

alright 2 things

#

first, not related to the problem itself

#

but in this server when you're going to send really long text

#

i urge you to use the pasting service

#

!paste

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.

merry sail
#

just so chat is clean and easy to read

#

now for the actual error you have: discord has these things called privileged intents, which are essentially switches that toggle what your bot can and cannot do

fading marlin
merry sail
#

you probably have mentions to "discord.Intents" somewhere in your code

#

if you don't know/need intents you can remove that line

hollow gazelle
merry sail
#

otherwise you gotta go into the devpanel and enable the intents you want

soft fjord
#

alr thks

hollow gazelle
#

Traceback (most recent call last):
File "D:\BOTS\xiniu boost\discord\bot.py", line 1082, in invoke_application_command
await ctx.command.invoke(ctx)
File "D:\BOTS\xiniu boost\discord\commands\core.py", line 375, in invoke
await injected(ctx)
File "D:\BOTS\xiniu boost\discord\commands\core.py", line 134, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: argument of type 'int' is not iterable

fading marlin
#

show full error

merry sail
#

code too

potent light
#

How are arguments passed on Discord classes?
Something like this: class Questionnaire(Modal, title='Questionnaire Response', test_list: list):

fading marlin
#

the last one isn't valid

#

you can also pass those to your super().__init__

potent light
#

@fading marlinI mean it works with
def __init__(self, test_list: list): the thing is that it says Questionaire doesn't have custom_id.

fading marlin
#

full traceback?

potent light
# fading marlin full traceback?

site-packages\discord\ui\modal.py", line 201, in to_dict 'custom_id': self.custom_id, AttributeError: 'Questionnaire' object has no attribute 'custom_id'

fading marlin
#

is that everything?