#discord-bots

1 messages · Page 327 of 1

arctic briar
#

if a autocomplete returns a valid list of Choice objects in less than 3s what can make discord say to the user 'failed loading options'?

haughty dagger
#

show code

arctic briar
#
@slash1.autocomplete('iskola_neve')
async def slash1_autocomp(interaction:discord.Interaction,courent:str)->list[app_commands.Choice[str]]:
    options=[]
    global KLIK_OPTIONS
    if 'kliks' not in globals():
        KLIK_OPTIONS=get_kliks()
    for name, value in KLIK_OPTIONS.items():
        if courent.lower() in name.lower():
            options.append(app_commands.Choice(name=name,value=value))
            
        if len(options)>=7:
            break
    print(options)
    return options
#

the dict in KLIK_OPTIONS has like 4900 elements but the print shows that it is fast enught

haughty dagger
#

try using return options[:25]

arctic briar
#

that didnt fix it

#

nothing seems to change the loop already stops at 7
if len(options)>=7:

#

if it helps this is one of the list discord sayid loading options failed for
[Choice(name='Földi János Két Tanítási Nyelvu Általános Iskola és Alapfokú Muvészeti Iskola Szilágyi Dániel Úti Tagintézménye', value='klik031049006'), Choice(name='Egri Szilágyi Erzsébet Gimnázium és Kollégium', value='klik031598001'), Choice(name='Egri Szilágyi Erzsébet Gimnázium és Kollégium Tagintézmény', value='klik031598101'), Choice(name='Budapest I. Kerületi Szilágyi Erzsébet Gimnázium', value='klik035219001'), Choice(name='Miskolci Szilágyi Dezso Általános Iskola', value='klik028978001'), Choice(name='Miskolci Szilágyi Dezso Általános Iskola Görömbölyi Tagiskolája', value='klik028978003'), Choice(name='Berettyóújfalui SZC Szilágyi Dániel Gimnáziuma, Szakgimnáziuma és Szakközépiskolája', value='beszc-szilagyi')]

#

i found it it turns out schools in hungary can have more than a 100 letters witch is the limit for Choices names lengths for example:
Földi János Két Tanítási Nyelvu Általános Iskola és Alapfokú Muvészeti Iskola Szilágyi Dániel Úti Tagintézménye
witch is 111 letters

final iron
#

You should be. Show your code

#

Unless you’re using Literal[]

#

!d discord.app_commands.autocomplete

unkempt canyonBOT
#

@discord.app_commands.autocomplete(**parameters)```
Associates the given parameters with the given autocomplete callback.

Autocomplete is only supported on types that have [`str`](https://docs.python.org/3/library/stdtypes.html#str), [`int`](https://docs.python.org/3/library/functions.html#int), or [`float`](https://docs.python.org/3/library/functions.html#float) values.

[`Checks`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check) are supported, however they must be attached to the autocomplete callback in order to work. Checks attached to the command are ignored when invoking the autocomplete callback.

For more information, see the [`Command.autocomplete()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Command.autocomplete) documentation.

Warning

The choices returned from this coroutine are suggestions. The user may ignore them and input their own value...
final iron
#

Ah, the value can only be str, int or floats

#

You cannot have classes as the value

haughty dagger
#

I found another way to achieve it nvm

#

thanks for the help though

fading marlin
#

create_ticket doesn't have any code, just comments

young dagger
#

@ashen notch I was going to add a list of users who are not queued up under the one that is queued up. What can I title this list?

#

Nvm I could just add two emojis ✅ ❌ grab every user in voice channel and then check if they are in queue or not

shadow oar
#

anyone tried sillydev site before to host a bot?
it's not letting me install dotenv python package
idk i might've messed up
should i send the error message in the console here? it's so long

#

okay this will say enough i guess

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
Traceback (most recent call last):
  File "/home/container/main.py", line 1, in <module>
    from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
Silly Development: Server marked as offline...
[Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon]: Exit code: 1
[Pterodactyl Daemon]: Out of memory: false
[Pterodactyl Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
#

i guess it says that dotenv is not installed? even tho it should be since i typed it in the python packages place in the site ummmm

final iron
#

All those hosting sites are trash

shadow oar
final iron
#

It has been said a million times before, and will continue to be said. Free hosting sites are terrible as hosting inherently costs money. They all have major drawbacks, such as shared IPs which can get your bot cloudflare banned, hosting sites having access to your token and in certain cases them actually owning your bot

#

The issue you’re having is directly linked to your host choice. You haven’t even started your bot yet but you’re already running into issues due to it

lyric isle
#

hi

shadow oar
#

alright thank you

lyric isle
#

who uses turtle py for game dev

lyric isle
#

what do you use to make discord bots

final iron
slate swan
#

its undefined cause you never created such varriable?

final iron
#

Are you asking how to define a variable?

#

How is it confusing

#

In Python variables are defined with the = operator

#

Defining variables is one of the first things you learn when using Python. I’d highly recommend learning the basics before creating a discord bot as discord.py isn’t designed to be a beginner library

young dagger
#

How can I grab all the users from a voice channel and compare it to a list?

slate swan
#

Hello I have the code of a python bot connect to save the world on fortnite and the bot works but as soon as I execute a command the bot does not respond, can you help

final iron
unkempt canyonBOT
final iron
slate swan
#

Of course but here the problem is that hardly I make a basic command like a /help the bot doesn't answer

young dagger
final iron
#

Also tias

young dagger
#

Should I sort the list by those in the queue and those who are not?

graceful temple
#

yo

#

HOW DO U DO THIS?

fading marlin
void mauve
#

Having trouble getting guild object, passing the right id but the guild is still None somehow. Any suggestions?

class TicketBot(commands.Bot, View):
    def __init__(
            self,
            initial_extensions: list[str],
            guild_id: int,
    ):
        super().__init__(command_prefix='', intents=discord.Intents.all())

        self.initial_extensions = initial_extensions
        self.guild_id = guild_id

    async def on_ready(self):
        await self.change_presence(activity=discord.CustomActivity(name='👀 Waiting for tickets'))

        print(f'{self.user.name} is ready')

    async def setup_hook(self) -> None:
        for extension in self.initial_extensions:
            await self.load_extension(extension)

            print('loaded!')
        # Here I am trying to get guild object
        self.tree.copy_global_to(guild=self.get_guild(self.guild_id))
        await self.tree.sync()
fading marlin
#

Cache isn't populated on setup_hook, so get_* will always return None. Also don't automatically sync, it's not recommended

fading marlin
#

Use an owner-only prefix command

void mauve
#

took the thing from examples on git, they always put it either in on_ready or setup_hook

void mauve
fading marlin
#

You don't need to sync every time you start your bot, and it's an easy way to get ratelimited

void mauve
void mauve
#

but it seems to not sync the command from my cog

#

Did I set it up correctly?

# COG
class Ping(commands.Cog, name='Ping Command'):
    def __init__(self, bot):
        self.bot = bot

    @commands.Cog.listener()
    async def on_ready(self):
        print(self.get_app_commands())

    @commands.command(name='ping', help='Ping the bot!')
    async def ping(self, interaction: discord.Interaction):
        bot_latency = round(self.bot.latency * 1000)

        await interaction.response.send_message(f'Latency is: {bot_latency} ms')


async def setup(bot):
    await bot.add_cog(Ping(bot))
# run.py
async def main():
    logger = logging.getLogger('discord')
    logger.setLevel(logging.INFO)

    exts = []

    for file in os.listdir(os.path.abspath('bot/cogs/commands')):
        if file.endswith('.py') and file != '__init__.py':
            cog = f'bot.cogs.commands.{file[:-3]}'
            try:
                exts.append(cog)

                print(f'{cog} is initialized')

            except Exception as e:
                print(e)

    for file in os.listdir(os.path.abspath('bot/cogs/events')):
        if file.endswith('.py') and file != '__init__.py':
            cog = f'bot.cogs.events.{file[:-3]}'
            try:
                exts.append(cog)

                print(f'{cog} is initialized')

            except Exception as e:
                print(e)

    print(exts)

    async with TicketBot(
        initial_extensions=exts,
    ) \
            as client:

        await client.start(token=bot_token)

asyncio.run(main())
final iron
void mauve
naive briar
#

!e you can't call sets 🤷

{1}()
unkempt canyonBOT
#

@naive briar :x: Your 3.12 eval job has completed with return code 1.

001 | /home/main.py:1: SyntaxWarning: 'set' object is not callable; perhaps you missed a comma?
002 |   {1}()
003 | Traceback (most recent call last):
004 |   File "/home/main.py", line 1, in <module>
005 |     {1}()
006 | TypeError: 'set' object is not callable
sick birch
#

Is {str}(selection) supposed to be str(selection)?

blazing condor
#

you're trying to call a coroutine inside a nromal function.

young dagger
#

Is there any way I could simplify/improve this code?

    # Get the voice channel
    voice_channel = ctx.guild.get_channel(712072729406472374)

    # Sort users_queue by ready_time
    users_queue_sorted = sorted(users_queue, key=lambda x: x.get("ready_time", datetime.datetime.min))

    # Separate users into "Ready" and "Not ready"
    ready_users = [member for member in voice_channel.members if member in [user["member"] for user in users_queue_sorted]]
    not_ready_users = [member for member in voice_channel.members if member not in [user["member"] for user in users_queue_sorted]]

    # Create strings for "Ready" and "Not ready" users
    ready_string = '\n'.join([f'{member.mention}' for member in ready_users])
    not_ready_string = '\n'.join([f'{member.mention}' for member in not_ready_users])```
golden portal
# young dagger Is there any way I could simplify/improve this code? ```py # Get the voice c...

this is probably faster tbh than iterating everytime ```py
members_in_queue = [user["member"] for user in users_queue_sorted]
ready_or_not_users = {}
for m in voice_channel.members:
ready_or_not_users.setdefault(m in members_in_queue, []).append(m)

ready_string = '\n'.join([f'{member.mention}' for member in ready_or_not_users[True]])
not_ready_string = '\n'.join([f'{member.mention}' for member in ready_or_not_users[False]])

#

maybe use a set for members_in_queue

#

can you show full traceback?

#

is one of your extension importing main file or something?

young dagger
# golden portal this is probably faster tbh than iterating everytime ```py members_in_queue = [...

What about?

# Separate users into "Ready" and "Not ready"
ready_users, not_ready_users = [], []
for member in voice_channel.members:
    (ready_users if member in (user["member"] for user in users_queue_sorted) else not_ready_users).append(member)

# Create strings for "Ready" and "Not ready" users
ready_string = '\n'.join(member.mention for member in ready_users)
not_ready_string = '\n'.join(member.mention for member in not_ready_users)```
#

@golden portal Or what about:

# Extract members in the voice channel
channel_members = set(voice_channel.members)

# Find members in users_queue_sorted
ready_members = channel_members.intersection(user["member"] for user in users_queue_sorted)
not_ready_members = channel_members.difference(ready_members)
golden portal
#

also generator are slower than list comp, so better use list comp when possible

young dagger
# golden portal also generator are slower than list comp, so better use list comp when possible

What about to make it as simple as:

# Get the voice channel
voice_channel = ctx.guild.get_channel(712072729406472374)

# Sort users_queue by ready_time
users_queue_sorted = sorted(users_queue, key=lambda x: x.get("ready_time", datetime.datetime.min))

# Get sets of members for "Ready" and "Not ready"
all_members = set(voice_channel.members)
ready_members = set(user["member"] for user in users_queue_sorted)
not_ready_members = all_members - ready_members

# Create strings for "Ready" and "Not ready" users
ready_string = '\n'.join(member.mention for member in ready_members)
not_ready_string = '\n'.join(member.mention for member in not_ready_members)
golden portal
#

i mean, you're essentially doing the same thing tbh, it's up to you to use which one

young dagger
slate swan
#

I think there's some sort of circular import going on here

#

Nevermind discord teleported me again

azure tulip
#

Who used railway?
can you help me

slate swan
#

you completely skipped the actual error message so i doubt any1 knows how to help you

azure tulip
slate swan
#

you cant install os since its built in module

azure tulip
slate swan
#

datetime is built in too

azure tulip
#

I'm blind, can you show me where in the console it wrote about datetime, so that I could also see the next error, it just kicks out again and I don't understand anything.

#

is an hour of annotations unnecessary?

slate swan
strange crater
#

hey guys

#

i need help

arctic briar
strange crater
#

can someone help me

arctic briar
strange crater
#

ok, i have code but on my pc doesnt work, can i send you the code and you send me the results, screenshoots ?

arctic briar
#

I got almost no time rn

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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

strange crater
#

done bro

#

just run it and send me the results, screenshoots

#

?

shrewd apex
#

just read

azure tulip
#

how fix it on railway

shrewd apex
azure tulip
#

it's not even in my project.

shrewd apex
#

well then python couldnt find the module called kafu_online_admission_system

azure tulip
#

What does he need it for and where should he put it?

shrewd apex
#

idk thats for the guy who made the code to figure out

fading granite
#

i have a ticket bot system running on my server. it starts when a user reacts to the msg on a channel that has ✉️ emoji. the bot is hosted on aws. but whenever i check back after 1-2 days, the react stops working bg and i’ve to generate a new embed for the bot to start working. why does this happen and is there any better alternative solution for ticket bot?

azure tulip
#
    @commands.slash_command(name='timely', description='Получить ежедневную награду')
    async def timely(self, interaction):
        await self.db.create_table()
        sender = interaction.author

        # Check the last claim time from the database
        last_claim_time = await self.db.get_last_claim_time(sender)

        # Calculate the time elapsed since the last claim
        current_time = datetime.datetime.now()
        time_elapsed = current_time - last_claim_time

        # Check if at least 24 hours have passed since the last claim
        if time_elapsed.total_seconds() >= 24 * 60 * 60:
            # Update the last claim time to the current time
            await self.db.update_last_claim_time(sender, current_time)

            # Update the user's balance
            await self.db.update_money(sender, +30, 0)

            # Send a message about the successful transaction
            embed = disnake.Embed(color=0x2F3136, title='Временная награда')
            embed.description = f'> **Вы успешно получили временную награду**\n'

            embed.set_thumbnail(url=interaction.author.display_avatar.url)
            await interaction.response.send_message(embed=embed)

        else:
            # Calculate the time remaining until the next claim
            time_remaining = datetime.timedelta(seconds=(24 * 60 * 60 - time_elapsed.total_seconds()))

            # Send a message about the time remaining until the next claim
            await interaction.response.send_message(f'{sender.mention}, вы уже получали награду. Приходите через {time_remaining}.')

help me pls

shrewd apex
#

get_last_claim_time ur db object dosent have any such method

abstract fox
#

Can someone help me to install like discord.py for windows?

shrewd apex
abstract fox
shrewd apex
abstract fox
shrewd apex
#

which version

abstract fox
#

most recent

shrewd apex
#

3.12?

abstract fox
#

No, the stable one.

shrewd apex
#

aight so open a command prompt then type in pip install discord.py

#

and enter

abstract fox
#

it didnt work,

#

i am on windows if that helps

shrewd apex
#

and what was the error

abstract fox
#

idk

#

i cant read it

#

Where exactly do I run it?

shrewd apex
#

copy paste the error here or send a pic

shrewd apex
abstract fox
#

this one?

shrewd apex
#

python -m pip install discord.py

abstract fox
#

oh

#

it said python was not found

shrewd apex
#

then u dont have it installed

abstract fox
#

Okay, how do I install it? (I thought I did)

shrewd apex
abstract fox
#

Thanks.

abstract fox
shrewd apex
#

close cmd open again

#

then do pip install discord.py

abstract fox
#

worked tysm

shrewd apex
#

np

abstract fox
#

what now?

#

how do I open it?

#

kk

#

wha-

#

i have never been more confused lol

#

how do I make a new file?

#

and what is visual studio code?

#

kk yeah just wanted to ensure i was right since that guide is kinda confusing ngl

#

im kinda regretting trying to code my bots in python rather then using botghost lol

final iron
#

FYI discord.py isn’t a beginner library so without the prerequisites you’re going to have a lot of trouble

abstract fox
#

yeah but like i have no use but for discord bots so best way to learn

#

i can read docs

#

the install was just confusing me so much lol

final iron
abstract fox
azure tulip
#
@bot.command()
@commands.is_owner()
async def reload(ctx, extention): # .load eco
    bot.reload_extension(f"cogs.{extension}")

how do I fix it?

hushed galleon
#

btw load_extension() and reload_extension() need to be awaited too oops that's for discord.py, not disnake

urban wren
#

ImportError: cannot import name '_shorten' from 'discord.utils

#

what's going on, should we wait for any updates?

hushed galleon
urban wren
# hushed galleon can you show the full error message? import errors like this usually mean you ha...
  File "F:\everydayuse\timestamp.py", line 1, in <module>
    import discord
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\__init__.py", line 23, in <module>
    from .client import *
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 67, in <module>
    from .state import ConnectionState
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\state.py", line 62, in <module>
    from .raw_models import *
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\raw_models.py", line 32, in <module>
    from .app_commands import AppCommandPermissions
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\__init__.py", line 12, in <module>
    from .commands import *
  File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 60, in <module>
    from ..utils import resolve_annotation, MISSING, is_inside_class, maybe_coroutine, async_all, _shorten, _to_kebab_case
ImportError: cannot import name '_shorten' from 'discord.utils' (C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\utils.py)
azure tulip
final iron
urban wren
hushed galleon
#

eh they definitely have discord.py>=2.0, but i suspect either py-cord or nextcord is installed

urban wren
#

so ?

#

I just reinstalled

hushed galleon
#

do you have py-cord or nextcord installed?

urban wren
#

what was the cmd to check which ones u installed

hushed galleon
#

pip list

urban wren
final iron
#

Run pip freeze and show the output please

urban wren
#

pip freeze is the same as pip list

final iron
urban wren
#

along the others like pyglet colorama etc

final iron
#

Can you show the entire output please?

urban wren
#

sure but does that help me ?

slate swan
#

yes

#

!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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

urban wren
hushed galleon
urban wren
final iron
#

Did you do any special commands/flags to install aiohttp, or was it automatically installed when you installed discord.py?

urban wren
#

all auto

shrewd apex
#

he seems to be using python 3.12 iirc dpy dosent support 3.12 does it?

slate swan
#

it does not

final iron
shrewd apex
#

yeah deps

final iron
#

aiohttp can be installed with custom wheels though, but I guess he didn’t do that

urban wren
#

should I reinstall aiohttp ?

hushed galleon
#

aiohttp 3.9.0 released some time ago so that should be fine with 3.12

slate swan
#

he has 3.7

final iron
#

What’s the command to check the interpreters installed on the system again?

shrewd apex
#

py -0 iirc

final iron
#

It’s py -0 right?

#

@urban wren could you run that?

hushed galleon
#

i mean i wouldn't be worried about it given that the earlier error message indicates it came from 3.12's global site-packages

urban wren
#

C:\Users\PC>py -0
-V:3.12 * Python 3.12 (64-bit)

slate swan
#

try pip install -U aiohttp

final iron
#

_shorten does exist in discord.utils, so there shouldn’t be an import issue

hushed galleon
#

^ tbh i don't know why your discord.py install would still be corrupted after a reinstall

urban wren
#

let me reinstall everything and check again i guess

shrewd apex
#

do u have a folder/file named discord or smn?

slate swan
#

Which is better for hosting discord bots? Linuix Or Windows?

slate swan
#

wym location

#

Like what would get the fastest speed

final iron
#

Doesn’t really matter

slate swan
#

How to make 💰 using discord bots ?

shrewd apex
final iron
#

If you have a capable server and internet the speed differences from location to location will be small

slate swan
shrewd apex
#

since discord bot markets are very saturated

slate swan
#

while you can be running on some debian

final iron
slate swan
slate swan
final iron
slate swan
#

So like a uk linux vps would run near enough the same speed as a USA one?

shrewd apex
#

ping

slate swan
#

And how fast it responds

shrewd apex
#

usually its uniform

slate swan
#

depends where the receiving server is

urban wren
#

should I just install 3.9 python?

slate swan
final iron
slate swan
#

I dont really have a useful bot but I'm working on one that is not gonna make any money

urban wren
azure tulip
#
@bot.command()
@commands.is_owner()
async def reload(ctx, extention): # .load eco
    bot.reload_extension(f"cogs.{extension}")

Help how to fix this

final iron
shrewd apex
#

u forgot to pass the extension name when using it

final iron
#

extention is a required argument

final iron
acoustic kernel
#

how can I loop through and create a button for each item in a dictionary?

final iron
acoustic kernel
#

Like how do I create the button?

#

I know how to create individual buttons, but I want to loop through each item in my dictionary to create a button

final iron
#

If you’re creating them dynamically id initialise the class

#

!d discord.ui.Button

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
final iron
#

These would then be added to the discord.ui.View instance

slate swan
#

Where do I host my discord bot for free 24/7

slate swan
#

Well replit does that ;_;

#

how is replit a hosting service

#

You use replit and uptimerobot and keep_alive.py

#

and how does that make it a hosting service

slate swan
#

XDX

#

😂

final iron
#

A hosting service does not require you to ping a web server thats run alongside your bot to keep the connection alive

hushed galleon
#

!d discord.ui.Modal < @spark nimbus

unkempt canyonBOT
#

class discord.ui.Modal(*, title=..., timeout=None, custom_id=...)```
Represents a UI modal.

This object must be inherited to create a modal popup window within discord.

New in version 2.0.

Examples...
acoustic kernel
#

If I have a command that has buttons and I want to edit the original message when a button is clicked how do I do that?

fading granite
shrewd fjord
#

Its better to use this event

#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_reaction_add), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.reactions) to be enabled.
true vector
shrewd apex
#

yes

slate swan
true vector
#

thanks

young dagger
#

Why am I getting a warn for the following line:

actual_reason = lowercase_preset_reasons.get(reason.lower(), reason)```
#

After the Pycharm update

open flame
#

how to add the python bot to a server

true vector
shrewd fjord
young dagger
vale wing
#

To ensure unwanted people don't put unwanted stuff into unwanted places

#

You can ignore it if your case allows you to, but you'd rather ensure string passed there doesn't pose security vulnerability

#

I.e. choice of string is limited

#

!d typing.LiteralString

unkempt canyonBOT
#

typing.LiteralString```
Special type that includes only literal strings.

Any string literal is compatible with `LiteralString`, as is another `LiteralString`. However, an object typed as just `str` is not. A string created by composing `LiteralString`-typed objects is also acceptable as a `LiteralString`.

Example...
young dagger
# vale wing Because StringLiteral is security type

Here is my code:

preset_reasons = {
    "NSFW": "No NSFW or inappropriate content. This includes pornographic material, foul language, violence, and any other content that is widely found to be offensive and not suitable for public environments.",
    "Spam": "Do not spam or otherwise misuse any channels. Keep content in their respective channels. Prevent yourself from splitting words or use several lines to say very little (line splitting)."
}

        lowercase_preset_reasons = {key.lower(): value for key, value in preset_reasons.items()}

        actual_reason = lowercase_preset_reasons.get(reason.lower(), reason)
#

@vale wing Do you have any idea how I can fix this?

prime steeple
#
actual_reason = str(lowercase_preset_reasons.get(reason.lower()), str(reason))
hushed galleon
acoustic kernel
#

If I have a command that has buttons and I want to edit the original message when a button is clicked how do I do that?

potent light
shrewd apex
#

ie the msgstr string

hushed galleon
#

oui, gettext assumes you or someone else can translate your program to the given locale

shrewd apex
#

ah now that makes sense 💀 i was thinking get text does it for me

shrewd apex
#

now time to work on a translation script btw i have doubt when i direcly used some translations from google translate it lead to discord not liking some of the characters prolly due to charset does gettext help with that?

hushed galleon
#

Translators find it easier to provide an appropriate localization when they know the context of each message being translated. As such, adding comments beside messages is a helpful practice.
sometimes asking a person to just translate a string like "roll" isn't enough, for example which meaning of roll are they referring to? is it a food item, an action, or an adjective for another noun?

#

tbf the comment i wrote there also doesn't really give that context 🙃

shrewd apex
#

it happened in the msginit i assumed

hushed galleon
#

fair enough, i'll amend the document to clarify that

shrewd apex
#

so i got confused for a period of time

hushed galleon
#

gettext is apparently 33 year old tech

shrewd apex
shrewd apex
cloud dawn
#

Is py from src.utils.generic import * inside an __init__ ethical to do?

shrewd apex
cloud dawn
shrewd apex
#

thats usually what libs often do

cloud dawn
#

I guess I could

shrewd apex
# cloud dawn all?

specifies a list of valid imports for linters altho if they want to import it it wont actually raise any error during runtime

hushed galleon
shrewd apex
cloud dawn
#
src\utils\__init__.py:1:1: F403 `from src.utils.generic import *` used; unable to detect undefined names
shrewd apex
cloud dawn
#

src\utils\__init__.py:1:1: F403 'from .generic import *' used; unable to detect undefined names

shrewd apex
cloud dawn
#

"Going to close for now because I'm comfortable with our current behavior." bruh

shrewd apex
#

did u declare __all__ in generic?

cloud dawn
#

Yep

shrewd apex
#

declare one in init too

cloud dawn
#

Just throws x amount of errors of objects.

shrewd apex
#

hmm weird tbh just mark it as # noqa: F403

cloud dawn
#

It's going into the ignore list how about that

#
# Ignoring
# `no-blank-line-before-class` (D211) in favor of `one-blank-line-before-class` (D203)
# `multi-line-summary-first-line` (D212) in favor of `multi-line-summary-second-line` (D213)
ignore = [
    "D211", "D212", "D100", "D101", "D102", "D103", "D104", "D107",
    "ANN101", "ANN002", "ANN003", "D205", "D401", "E501", "TRY003",
    "EM102", "ANN401", "G004", "SLF001", "D105", "F03"
]
``` got a nice list already.
shrewd apex
#

damn

cloud dawn
#
select = [
    "F", "E", "W", "C90", "I",
    "N", "D", "UP", "ANN", "S",
    "BLE", "FBT", "B", "A", "COM",
    "C4", "DTZ", "EM", "ISC", "ICN",
    "G", "PIE", "T20", "PYI", "PT",
    "PT", "Q", "RSE", "RET", "SLF",
    "SIM", "TID", "TCH", "INT", "ARG",
    "PTH", "ERA", "PD", "PGH", "PL",
    "PLC", "PLE", "PLR", "PLW", "TRY",
    "NPY", "RUF"
]
``` don't be fooled I do have a lot of rules but some are just bs
#

Forcing a comment on every function should be illegal.

shrewd apex
#

fair

hushed galleon
shrewd apex
hushed galleon
shrewd apex
hushed galleon
#

oh lol, gnighty then

slate swan
#

does anyone know why my bot replys so late? It has 30ms ping and no errors but it replys like a min after its on a linux vps

hushed galleon
slate swan
cloud dawn
#

How did it still respond then

cloud dawn
#

Any1 there?

fading marlin
#

The event decorator shouldn't be called

golden portal
#

meaning, remove ()

languid sequoia
#

I am attempting to create a discord/ game bot for a VR game using console commands within that game. My problem is is that I would like to automate the process of inputting usernames within that game so that way users can not abuse the system. The way it would work be by a user executing a “!link username” command. The bot would then give them a random string of letters in game and then they would follow the command up by doing “!link code”. This part I understand how to do, my problem is that I do not know how to make a variable have different values based on who executes it.

desert heart
languid sequoia
vale wing
#

Can't compare really

dry swift
#

/keith mock/

vale wing
#

What error

slate swan
#

`C:\Users\abhay\OneDrive\Desktop\scanner>python main.py
Traceback (most recent call last):
File "C:\Users\abhay\OneDrive\Desktop\scanner\main.py", line 32, in <module>
@bot.hybrid_command()
^^^^^^^^^^^^^^^^^^
AttributeError: 'Bot' object has no attribute 'hybrid_command'

C:\Users\abhay\OneDrive\Desktop\scanner>`

#

how-to-fix-it?

#

@bot.hybrid_command() async def config(ctx):

merry cliff
slate swan
#

sorry lol

merry cliff
#

ok

young dagger
#

Could a while loop block other tasks from running? Should I consider using asyncio.wait_for() to set a timeout for a coroutine?

shrewd apex
vale wing
shrewd apex
vale wing
#

Then how it doesn't work

#

If there's no reaction it's intents issue

#

Ok nvm it's not

#

Is that the whole code

shrewd apex
#

ah right

stark nexus
#
 @discord.ui.button(label="🔇", style=discord.ButtonStyle.grey)
    async def mute(self,  interaction: discord.Interaction, button: discord.ui.Button):
        vc = discord.utils.get(client.voice_clients, guild=interaction.guild)
        
        if not vc or not vc.is_playing():
            return await interaction.response.send_message("There's no music paused now!")
        else:
            if vc.source.volume == 0.0:
                vc.source = discord.PCMVolumeTransformer(vc.source, volume=50.0)
                await interaction.response.send_message("Music unmuted")
            else:
                vc.source = discord.PCMVolumeTransformer(vc.source, volume=0.0)
                await interaction.response.send_message("Music muted")```
#

How suppose i edit?
I mean the vc.sourse.volume it's getting error

golden portal
stark nexus
#

Oh

golden portal
#

if you wanna set the volume, just set as attr, vc.source.volume = .5

stark nexus
#

Like add 5 each time

golden portal
#

uh okay?

stark nexus
#

When it reach maximum it stop add and say a sentence

stark nexus
#

The error is vc.sourse has no "volume"

golden portal
#

whats your code

golden portal
#

can you show the entire traceback?

stark nexus
#

Oh

#

Sure

stark nexus
golden portal
#

i see

stark nexus
#

Where do you think it's error? : o

golden portal
#

the error is you haven't transform it yet to PCMVolumeTransformer

stark nexus
#

I see
How suppose i transform into?

golden portal
# stark nexus I see How suppose i transform into?

so maybe like, ```py
new_volume = 0.5
current_volume = getattr(vc.source, 'volume', None)
if current_volume is None:
vc.source = discord.PCMVolumeTransformer(vc.source, volume=new_volume)
elif current_volume == 0.0:
vc.source.volume = new_volume
else:
vc.source.volume = 0

#

honestly i dont see much info on it

stark nexus
#

Okay

#

Let my try a bit

slim kelp
#

excuse me haw can i install pygame?

blazing condor
#

well u have 2 separate definitions of MyClient classes

you need to combine the logic into a single on_message method with one class.

#

❤️

blazing condor
#

do u understand what argument it's asking for?

#

do u know what intents are?

#

take a look at the documentation and look.

potent creek
#

someone help me

final iron
#

What is a discord signing bot

potent creek
smoky anvil
#

Please check dm

terse flume
#

One message removed from a suspended account.

#

One message removed from a suspended account.

blazing beacon
#

line 18, youre not returning anything or youre not rlly doing anything there

#

call a function there i guess it should fix it

final iron
terse flume
#

One message removed from a suspended account.

final iron
#

Just remove the if statement if you aren't going to use it

terse flume
#

One message removed from a suspended account.

acoustic kernel
#

Question, is there a way to add autocomplete to a slash command? like /buy 3000 (Autocomplete Good to purchase)

languid sequoia
#

Is it possible to store a dictionary within a database? I need my bot to have the value of a dictionary stay the same even if it goes offline, but I’m not sure if it’s possible to do so.

final iron
final iron
unkempt canyonBOT
#

@discord.app_commands.autocomplete(**parameters)```
Associates the given parameters with the given autocomplete callback.

Autocomplete is only supported on types that have [`str`](https://docs.python.org/3/library/stdtypes.html#str), [`int`](https://docs.python.org/3/library/functions.html#int), or [`float`](https://docs.python.org/3/library/functions.html#float) values.

[`Checks`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check) are supported, however they must be attached to the autocomplete callback in order to work. Checks attached to the command are ignored when invoking the autocomplete callback.

For more information, see the [`Command.autocomplete()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Command.autocomplete) documentation.

Warning

The choices returned from this coroutine are suggestions. The user may ignore them and input their own value...
terse flume
final iron
acoustic kernel
final iron
terse flume
#

One message removed from a suspended account.

languid sequoia
languid sequoia
terse flume
#

One message removed from a suspended account.

#

One message removed from a suspended account.

terse flume
#

One message removed from a suspended account.

void pumice
#

How this bot showing exact expires time without editing msg again and again, ?

#

How can I create expiry like this ?

void pumice
final iron
#

<t:1543392060>

void pumice
final iron
astral lotus
#

Is there an easy way to learn coding a bot

#

YouTube has multiple different ways it’s hard to learn on YouTube for me🫠

final iron
#

There is not 1 good up to date tutorial

#

Creating ideas for features/commands is probably going to help point you in a direction, so it's what I'd recommend

#

Doesn't have to be anything complicated, you can just do simple messaging commands

astral lotus
#

I will try in morning it’s 2am for me

patent lark
blazing condor
#

[Text](URL)

patent lark
patent lark
magic folio
# terse flume One message removed from a suspended account.

Line 18, you have used an if statement but there isn't anything inside it so Python is expecting for there to be something there essentially but you haven't gave an 'argument' or in simpler terms what you want the code to do with the if block

upbeat otter
#

Which library are you using?

cunning briar
#

is there a way to make bot discord online froever while computer is offline?
dont say vps im broke asf

brazen raft
#

Any online host will do

#

As in, any host connected to the internet

cunning briar
#

like heroku

#

?

brazen raft
#

I've heard they removed their free plan

cunning briar
#

Glitch?

#

glitch vps

#

is that one good?

brazen raft
#

I don't know whether you can host Python apps on it

upbeat otter
#

you have to import it first

#

from discord import SlashCommandGroup

robust fulcrum
stray adder
#

Anyone help me with

#

My bot the shit ban command is not working

#

Look at this code

#

Cant ban a member from server what should i do🥶

robust fulcrum
naive briar
#

I wonder why there's a built-in ban button and a slash command

stray adder
stray adder
slate swan
stray adder
#

My problem is no commands are working

#

@slate swan

keen talon
obsidian fable
#

can bots read the timestamp of rich presence? using discord.Activity

brazen raft
#

Should be the created_at attribute for all activity types inheriting discord.BaseActivity

obsidian fable
brazen raft
#

Yes

obsidian fable
#

whats the difference?

brazen raft
#

discord.BaseActivity's only attribute is created_at

#

This is all there is to it

obsidian fable
#

so I should be using discord.BaseActivity instead of discord.Activity?

brazen raft
#

No, I mean you can access created_at with any type of activity

obsidian fable
#

ooh

#

I see

brazen raft
#

The "07:41 elapsed" is calculated from it

#

Or from attributes which refer to the created_at attribute

obsidian fable
brazen raft
#

If you want to account for Game only, ye

obsidian fable
#

I think discord.Activity.start would get the job done, I just need the timestamp

#

is that right?

obsidian fable
#

what are CustomActivity?

brazen raft
#

!d discord.CustomActivity

unkempt canyonBOT
#

class discord.CustomActivity(name, *, emoji=None, **extra)```
Represents a custom activity from Discord.

x == y Checks if two activities are equal.

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

hash(x) Returns the activity’s hash.

str(x) Returns the custom status text.

New in version 1.3.
obsidian fable
#

I see, thank you. I think discord.Activity.start would work

brazen raft
#

It depends on what activity you're working with

obsidian fable
#

I just need Rich Presence as of now

brazen raft
obsidian fable
slate swan
#

and they are usually out dated a few months after getting made

#

anybody can help me?

#

what with

ocean dragon
#

can I force sync a command so I can see my new parameters? this is annoying af that I have to wait 1 hour

shrewd apex
#

its instant now

#

at most u would have to reload discord

cunning briar
#

hello

celest cliff
#

any tips on getting started to making bots ? i already know python tho

rigid bramble
#

How can I make slash commands, i've tried so much and it's just not working

blazing condor
rigid bramble
#

UHhhhh

#

All that : )

shrewd apex
rigid bramble
#

Blackbox

#

even Stackoverflow dont work

shrewd apex
#

u can just use discord.py for slash commands no third party module needed

shrewd apex
celest cliff
#

thanks my g

maiden pilot
#
        return random.choice(Silly_List)```

list ``Silly_input2 = [":fire:", "bruh", ":hey:", "magnificent", "silly"]``
#

i want to make the bot respond with random.choice(Silly_List) if any of the inputs in Silly_list2 is typed, how would i do that?

shrewd apex
#

if p_message in silly_input2

maiden pilot
#

oh it's that simple?

#

thanks!

young dagger
#

Are list comprehensions faster than loops?

#
    # Separate users into "Ready" and "Not ready"
    ready_users = []
    not_ready_users = []
    for member in voice_channel.members:
        if member in users_queue_sorted:
            ready_users.append(member)
        else:
            not_ready_users.append(member)

vs

    # Separate users into "Ready" and "Not ready" using list comprehension
    ready_users = [member for member in voice_channel.members if member in users_queue_sorted]
    not_ready_users = [member for member in voice_channel.members if member not in users_queue_sorted]```
#

Which method should I use?

cunning briar
#

what 24/7 means

brazen raft
#

Twenty four hours in all seven days of the week

#

Aka always

brazen raft
final iron
#

You can just time it yourself

young dagger
acoustic kernel
#

does anyone have an example on how to create groups and sub commands using discord.interaction and slash commands

severe sonnet
#

for some reason my description is not appearing:

#
from typing import Mapping, Optional, List, Any

import discord
from discord.ext import commands
from discord.ext.commands import Cog, Command


class Help(commands.MinimalHelpCommand):
    def __init__(self):
       attributes = {
           "name": "help",
           "cooldown": commands.CooldownMapping.from_cooldown(2, 5.0, commands.BucketType.user),
           "description": "This is a list of commands for RP Utilities"
        }
       super().__init__(command_attrs = attributes)

    async def send_bot_help(self, mapping):
        embed = discord.Embed(title="Help")
        for cog, commands in mapping.items():
            filtered = await self.filter_commands(commands, sort=True)
            command_signature = [self.get_command_signature(c) for c in filtered]
            if command_signature:
                cog_name = getattr(cog, "qualified_name", "No Category")
                embed.add_field(name=cog_name, value="\n".join(command_signature), inline=False)

        channel = self.get_destination()
        await channel.send(embed=embed)

    
    async def send_command_help(self, command):
        embed = discord.Embed(title=self.get_command_signature(command))
        embed.add_field(name="Help", value=command.help)
        alias = command.aliases
        if alias:
            embed.add_field(name="Aliases", value=", ".join(alias), inline=False)

        channel = self.get_destination()
        await channel.send(embed=embed)
    

    async def send_error_message(self, error: str):
        embed = discord.Embed(title="Error", description=error)
        channel = self.get_destination()
        await channel.send(embed=embed)
main holly
#

how do i learn python?

final iron
shrewd fjord
naive briar
#

So, I'd prefer the first one in this case

slate swan
latent harness
#

My bot's commands don't work for me but do work for another person... Whats the prob here?

latent harness
#

@final iron

The code might be a bit to disorganized. Pls don't tell me that since i already know lmao 😅

#

Hope you understand it tho

shrewd fjord
tight harness
#

Breh

#

I want to download discord-components

#

@potent fox

slate swan
ocean dragon
#

How do I add a new line to slash command value

coral cradle
#

I know this isn't exactly dc.py but can someone who still knows what reality is tell me what they have done with the active users list in the mobile app ??

naive briar
#

What?

young dagger
brazen raft
coral cradle
young dagger
naive briar
shrewd apex
#

why do u need two diff lists for that in first place

naive briar
unkempt canyonBOT
#

@naive briar :white_check_mark: Your 3.12 timeit job has completed with return code 0.

20000 loops, best of 5: 10.4 usec per loop
naive briar
#

!timeit

a = [0 for i in range(100) if i % 2 == 0]
b = [0 for i in range(100) if i % 2 != 0]
unkempt canyonBOT
#

@naive briar :white_check_mark: Your 3.12 timeit job has completed with return code 0.

20000 loops, best of 5: 14.6 usec per loop
naive briar
#

A little slower

young dagger
#

@mild tide ^ check this out

young dagger
#

!timeit

users_queue_set = {"User1", "User2", "User3", "User4", "User5", "User6", "User7", "User8", "User9", "User10"}
voice_channel_set = {"User10", "User2", "User5", "User44", "User5", "User6", "User75", "User8", "User96", "User10"}

# Separate users into "Ready" and "Not ready"
ready_users = list(users_queue_set & voice_channel_set)
not_ready_users = list(voice_channel_set - users_queue_set)

print("Ready Users:", ready_users)
print("Not Ready Users:", not_ready_users)
unkempt canyonBOT
#

@young dagger :white_check_mark: Your 3.12 timeit job has completed with return code 0.

50000 loops, best of 5: 7.64 usec per loop
slate swan
#

After putting condition can i order list somehow?
If a 1+2
If b 5+6
If c 7+8
Now can i order program to print abc

young dagger
#

@naive briar This one is winning with 7.64 and we are using list comp

naive briar
#

Those are not list comprehensions

#

That's just initializing lists from sets

#

!e

print(list({0, 1, 2}))
unkempt canyonBOT
#

@naive briar :white_check_mark: Your 3.12 eval job has completed with return code 0.

[0, 1, 2]
mild tide
#
users_queue_set = set(["User1", "User2", "User3", "User4", "User5", "User6", "User7", "User8", "User9", "User10"])
voice_channel_set = set(["User10", "User2", "User5", "User44", "User5", "User6", "User75", "User8", "User96", "User10"])

# Separate users into "Ready" and "Not ready"
ready_users = list(users_queue_set & voice_channel_set)
not_ready_users = list(voice_channel_set - users_queue_set)

print("Ready Users:", ready_users)
print("Not Ready Users:", not_ready_users)

young dagger
#

Could you do that same thing with a list, or does it have to be a set?

mild tide
#

this is the one using lists from last night

young dagger
shrewd apex
young dagger
#

We need ready_users and not_ready_users

shrewd apex
#

how exactly are u using them?

young dagger
shrewd apex
#
voice_presence = {member: member in users_queue_sorted for member in voice_channel.members}

why not something like this?

brazen raft
#

What are you fellas trying to do

young dagger
#

Beerhunter is in the room and wearing a blue shirt
Asher is in the room and not wearing a blue shirt

shrewd apex
young dagger
brazen raft
#

So ready_members and unqueued_members?

total_connected_members = set(voice_channel.members)
queued_members = set(queued_member_whatever)
ready_members = total_connected_members & queued_members
unqueued_members = total_connected_members - queued_members  # or total_connected_members - ready_members, whichever floats your boat
young dagger
brazen raft
#

How is it the problem of today

young dagger
#

# Separate users into "Ready" and "Not ready" ready_users = list(users_queue_set & voice_channel_set) not_ready_users = list(voice_channel_set - users_queue_set)

brazen raft
#

Or is it not

young dagger
brazen raft
#

Looping and filtering

young dagger
# brazen raft Looping and filtering

So something like:

    for member in voice_channel.members:
        if member in users_queue_sorted:
            ready_users.append(member)
        else:
            not_ready_users.append(member)```
brazen raft
#

Yes

west shuttle
#

I get raise TypeError("cogs must derive from Cog") but i dont see anything wrong with the code

#

other cog is working

slate swan
#

seems like you tried to load a cog that doesn't inherit from the Cog class

#

you'll have to post code and full traceback

uneven arch
#

Im getting errors when i import these two things:from discord.ext import commands,tasks
from discord import FFmpegPCMAudio

ocean dragon
#

any mastermind able to extract the three dot animation from discord when an interaction is created and it says "thinking..."? I'd like to use it as an emote to indicate that the bot is typing gradually

fallow mauve
robust fulcrum
ocean dragon
#

can I have buttons on a normal message which is not an interaction?

slate swan
#

can someone make me a discord bot

stray adder
#

Now my bot is ready i added many commands working perfect

uneven arch
#

Does anybody know how to reference the discord bot in a cog i want to check if bot it in a voice channel in a slash command

hushed galleon
#

for checking the bot's voice in particular, you'd want the guild object which contains the bot's voice client when they're connected

#

!d discord.Interaction.guild

unkempt canyonBOT
hushed galleon
#

!d discord.Guild.voice_client

unkempt canyonBOT
#

property voice_client```
Returns the [`VoiceProtocol`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceProtocol) associated with this guild, if any.
unreal pilot
#

yo

#

is there anyway to get an interaction object from an id

shrewd apex
#

what id?

hushed galleon
unkempt canyonBOT
#

discord/interactions.py line 167

def __init__(self, *, data: InteractionPayload, state: ConnectionState[ClientT]):```
shrewd apex
hushed galleon
#

well i didnt see any in docs, and the library doesn't need one for anything afaik

shrewd apex
#

hmm i see

unreal pilot
#

So you would suggest me to create my own 'interceptor' to also receive interaction object payload and make this payload encodable

#

encodable for storing it in my db

hushed galleon
#

why do you want to recreate interactions from IDs? they only last 15 minutes anyway

unreal pilot
#

right.. forgot about that

unreal pilot
#

with a recovery system in case of outage

#

hence why i wanted to store an interaction, as i use this interaction object and its attributes multiple times throughout the sequence

#

ill just create an interaction dictionairy and store its attributes in there

#

and refractor my code

#
    @staticmethod
    async def map_varToInstance(guild: discord.Guild, var_name, map_var: Any) -> Any:
        if map_var[0]:
            if e := Config.VAR_TO_INSTANCE.get(map_var[1]):
                instance = await getattr(guild, e)()
                return instance.id
            return map_var[0]

a little bit of context

#
    @staticmethod
    def mapInstance(instance: object):
        instance_vars = dict(vars(instance))
        for k, v in instance_vars.items():
            if hasattr(v, 'id'):
                instance_vars[k] = [v.id, str(type(v))]
            elif not isinstance(v, (int, str, float, list, tuple, dict, set)):
                try:
                    instance_vars[k] = [list(v), str(type(v))]
                except:
                    instance_vars[k] = [None, str(type(v))]

        return instance_vars
#

part of my orm thing

maiden pilot
#

Hi guys, im trying to make a /say command kinda like in minecraft, but i just can't get it to work (im very new to coding)
main.py :


if __name__ == "__main__":
    bot.run_discord_bot()```
bot.py :
```import discord
import responses
from discord import app_commands, Intents, Client, Interaction


cats = ["![Sillycat](https://cdn.discordapp.com/emojis/1179802515076821032.webp?size=128 "Sillycat")", "![Cat](https://cdn.discordapp.com/emojis/1069729563720028230.webp?size=128 "Cat")"]


async def send_message(message, user_message, is_private):
    try:
        response = responses.handle_response(user_message)
        await message.author.send(response) if is_private else await message.channel.send(response)
    except Exception as e:
        print(e)


def run_discord_bot():
    bot_token = ""
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)

    @client.event
    async def on_ready():
        print(f"{client.user} Online")

    @client.event
    async def on_message(message):
        if message.author == client.user:
            return

        if message.content in cats:
            await message.add_reaction(":Cat:")

        username = str(message.author)
        user_message = str(message.content)
        channel = str(message.channel)

        print(f'{username} said: "{user_message}" ({channel}')

        if user_message[0] == "<":
            user_message = user_message[1:]
            await send_message(message, user_message, is_private=True)
        else:
            await send_message(message, user_message, is_private=False)

        @client.tree.command()
        async def hello(interaction: Interaction):

            await interaction.response.send_message("Test")

        @bot.tree.command(name="test", description="Test description")
        async def add(interaction: discord.Interaction, word: str):
            embed = discord.Embed(title="Here is it!:", description=word, color=0x9208ea)
            await interaction.response.send_message(embed=embed)

    client.run(bot_token)

I have of course removed my discord bot token but it would be inside the "" of bot_token = ""

Only functionaly it has right now is reacting to this cat emoji (inside joke with some friends of mine)

Currently the bot works fine with everything except the /say command (currently just called "test" i think) im not good at coding (yet)

cloud dawn
maiden pilot
#

if the message is a dm

maiden pilot
cloud dawn
#

The app commands, otherwise they aren't visible with /

maiden pilot
#

oh

#

how would i do that?

#

also the bot part seems to not be working, any idea why?

blazing condor
#

cause you haven't defined it

#

also wouldn't that be client.

maiden pilot
#

might be

maiden pilot
#

i am very new to discord bots

blazing condor
#

then i would suggest reading the documentation first before jumping into it.

maiden pilot
#

i tried to find some but none of it works, atleast when i try it

blazing condor
#

Okay, let me ask you something.

maiden pilot
#

yes?

blazing condor
#

What do u think is wrong with your example? let's start there.

hushed galleon
#

there are various examples in the official repository, and the documentation has a pretty good API reference, but it lacks a proper tutorial especially for their newer features like slash commands

#

fyi the send_message() / run_discord_bot() code isn't really a useful structure to follow, despite the number of bots you'll find on github using it

severe sonnet
#

please

hushed galleon
severe sonnet
#

i was placing it in init though

hushed galleon
#

you overwrote send_bot_help though, so you have to format the description into the embed yourself

maiden pilot
hushed galleon
# maiden pilot that im missing something

the basic principles for setting up a slash command with d.py is to:

  1. define a CommandTree instance
  2. add your command to that CommandTree
  3. synchronize your commands to discord so your users can see them (the step that you're missing)

the simplest option is to sync your commands during startup, for example: ```py
from discord.ext import commands

bot = commands.Bot(intents=...)

commands.Bot comes with a CommandTree for free:

@bot.tree.command()
async def hello(interaction: discord.Interaction):
await interaction.response.send_message("Hello world!")

Use setup_hook() to run something after your bot logs into discord:

@bot.event
async def setup_hook():
await bot.tree.sync()

bot.run(...)```

maiden pilot
#

oh thank you so much

hushed galleon
#

fwiw syncing your slash commands every restart is usually unnecessary and discord can ratelimit your bot if you sync too often, but you don't have to worry about it right now, later you can write an owner-only command to sync your commands when you need to

maiden pilot
#

i'll keep that in mind, but right now im getting this error

hushed galleon
#

yeah, the prefix is used for message commands

maiden pilot
#

intents are define here btw, dunno if that would help

hushed galleon
#

dunno why its still a required argument but you can just give it some random prefix like $ or whatever

maiden pilot
#

so how would i add a prefix to it?

hushed galleon
#

as per the error, command_prefix is the name of the argument so you would write command_prefix="some prefix here" inside Bot()

#

btw you also mis-capitalized Intents=intents

maiden pilot
#

ah

hushed galleon
maiden pilot
#

completely start from scratch or?

hushed galleon
maiden pilot
#

I've tried to make more files for other stuff but it never worked, like the reactions thing it only worked when i put it in the bot.py file

hushed galleon
#

the other code is getting in the way given that the slash commands were mistakenly over-indented

#

pycharm lets you define run configurations that only run one specific file, so you'll need to either change the run configuration, add a new one, or (arguably more simply) open up the built-in terminal and type out the file you want to run instead

blazing condor
maiden pilot
#

no worries dude

maiden pilot
#

or the def run_discord_bot(): etc

hushed galleon
west shuttle
#

ValueError: anchor not supported for multiline text

hushed galleon
#

this doesn't look related to discord bots, but can you show the full error message?

unreal pilot
#

no lol

#

list comprehension is like 40% faster or something

final iron
#

crazy

#

whole 2ms is going to make a massive difference

unreal pilot
#

theyre not the same speed

final iron
#

Even with 10000 elements its a difference of 16ms

#

With only 250 elements the difference will be extremely small

hushed galleon
# final iron Sorting through a list with 10000 elements, either 1 or 2 List comp: 3.359751939...

what unit is that in? if its seconds, the difference is 151ms, but i assume the code was repeated ~5000 times so the actual performance per iteration would be even smaller
here's my benchmark measuring time per iteration https://paste.pythondiscord.com/Y2RQ py List comprehension: 395.60us For loop: 297.20us in context of asyncio/bot development, i doubt the performance of an occasional, sub-millisecond loop matters (unless it's super expensive to check member in users_queue_sorted, but we can't tell that from the original code)

maiden pilot
#

How can i do this but with stickers

#

Currently it's looking for only Cat but i want it to also look for a sticker and add the same reaction

unreal pilot
#

a sticker isnt a reaction

maiden pilot
#

i want to add a reaction to a specific sticker

unreal pilot
maiden pilot
#

could you explain a bit more? im very new to coding, especially discord bots

unreal pilot
#

my advice:

#

dont work with discordpy if you dont know how to code

maiden pilot
maiden pilot
#

i will have a look

#

thanks

unreal pilot
#

but for your specific thing

#

message.stickers returns a list

#

just do like

#
if your_sticker in message.stickers:
  await message.add_reaction(your_emojithing)
maiden pilot
#

print(message.stickers) worked to get id

young dagger
#

@unreal pilot@final iron@hushed galleon Sorry for the ping. According to this test, the loop is faster

hushed galleon
#

either way i would hope you don't need that level of micro-optimization, especially within a discord bot

young dagger
#

Fastest script was created by @mild tide last night. Many users from the community were involved and discussed the matter.
#voice-chat-text-0 message

hushed galleon
#

oh yeah set intersection perfectly represents the problem

unkempt canyonBOT
#

@young dagger :white_check_mark: Your 3.12 timeit job has completed with return code 0.

50000 loops, best of 5: 7.46 usec per loop
unreal pilot
young dagger
unreal pilot
pliant mica
#

pogo

unreal pilot
#

As you use 2 list comprehensions as well

pliant mica
#

can you help me for a min?

unreal pilot
#

Yes

#

If its a min, i wanna sleep

pliant mica
#

its less than a min

#

IndentationError: expected an indented block after 'while' statement on line 1

while n > 0: print (n)
... n = n - 1
File "<stdin>", line 2
n = n - 1
^
SyntaxError: invalid syntax

#

im new to this

#

and was lost in the tutorial thing

unreal pilot
#

Show ur code

pliant mica
#

um okay

unreal pilot
pliant mica
#

while n>0: print (n) n=n-1 print ('blastoff!')

unreal pilot
#

?

#

So 0 indentation

pliant mica
#

can u open dms?

#

i cant send image here

unreal pilot
#

I dont accept dm’s

pliant mica
#

ohh okay ill upload image eq

young dagger
unreal pilot
#

Indentation matters

pliant mica
#

whats indentation

unreal pilot
unreal pilot
#

Im gonna sleep

unreal pilot
pliant mica
unreal pilot
#

i cant help u much

#

When u dont know what indentation is

#

Thats like the first thing of python

pliant mica
#

im new

#

im doing introduction in the course

unreal pilot
#

Yea ik

#

I suggest u read what indentation is before contuining with the course tho

pliant mica
#

alright thanks for the advice

unreal pilot
#

Its important in python

maiden pilot
#

you see how the code is pushed to the right, that's an indentation

pliant mica
#

ohh alright thanks once again

unreal pilot
#

Np! Goodnight

unreal pilot
pliant mica
young dagger
azure tulip
#

how to fix it?

#
@bot.command()
@commands.is_owner()
async def reload(ctx, extention): # .load eco
    bot.reload_extension(f"cogs.{extension}")

final iron
azure tulip
final iron
#

Look at your spelling

azure tulip
#

thanks, I don't know English very well

latent harness
#

I'm posting this again since no one replied earlier

shrewd fjord
#

Weird

final iron
latent harness
final iron
#

Implementation with only what's required

lavish harness
#

How do I make my code send a message to discord and what channel is needed? When I try to channel.send() It says something like this:

Traceback (most recent call last):
  File "/home/runner/NoaKushiRewrite/.pythonlibs/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/NoaKushiRewrite/main.py", line 56, in on_ready
    await check_changes()
  File "/home/runner/NoaKushiRewrite/.pythonlibs/lib/python3.10/site-packages/discord/ext/tasks/__init__.py", line 368, in __call__
    return await self.coro(*args, **kwargs)
  File "/home/runner/NoaKushiRewrite/main.py", line 112, in check_changes
    await channel.send(f'[{key}] Changed from {previous_val} to {current_val}')
AttributeError: 'str' object has no attribute 'send'```
golden portal
lavish harness
#

nope its an integer

golden portal
#

error says its an str

lavish harness
#

wait i actually changed some stuff

lavish harness
# golden portal error says its an str

now it says this when line 20 is an integer

Traceback (most recent call last):
  File "/home/runner/NoaKushiRewrite/.pythonlibs/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/NoaKushiRewrite/main.py", line 56, in on_ready
    await check_changes()
  File "/home/runner/NoaKushiRewrite/.pythonlibs/lib/python3.10/site-packages/discord/ext/tasks/__init__.py", line 368, in __call__
    return await self.coro(*args, **kwargs)
  File "/home/runner/NoaKushiRewrite/main.py", line 111, in check_changes
    await channel.send(f'{target_id} [{key}] Changed from {previous_val} to {current_val}')
AttributeError: 'int' object has no attribute 'send'```
golden portal
#

yea you need to set the channel object first with bot.get_channel

lavish harness
#

so it also doesn't work

golden portal
#

that needs to be set after the bot ready event is fired, which means it finishes filling cache, if it returns none, either cache isnt filled yet or id is wrong

lavish harness
#

im sure the id is correct because i copy pastied it

golden portal
#

show current code please

naive briar
golden portal
# lavish harness https://paste.pythondiscord.com/YUOQ

you're essentially doing this ```py
channel = 123

def function():
channel = 456
function2()

def function2():
global channel
print(channel)

function()

when you set `channel` in a function, it defines it at a local var, you need to reference the var `global` first to override it
#

!e ```py
channel = 123

def function():
channel = 456
function2()

def function2():
global channel
print(channel)

function()

unkempt canyonBOT
#

@golden portal :white_check_mark: Your 3.12 eval job has completed with return code 0.

123
golden portal
#

also, that is not how you use a task loop, do check_changes.start() instead

lavish harness
#

lesson learned, thanks

lavish harness
#

something like this

#

i probably screwed up line 110 and line 111 :/

unreal pilot
#

Just use classes pls

golden portal
#

tell them that, i'm not gonna go through another topic to teach

lavish harness
shrewd apex
young dagger
#

Should I keep this format?

unreal pilot
#

has more potential

#

make the banner color based on the rank that the person has

#

maybe try to shove in some emojis somewhere :d

spark nimbus
#

well i have created this ticket system which has modals and buttons and store data in json file and 2 commands are not working.
the first:
the take category command which supposed to take the category id and later open in that category a channel. but the command doesnt even sync so i think its a typo that i havent got
the second:
my launch ticket system command dont work, take a stored data for embed description(the store data for the description worked) and have a button linked to the modal.
when i tried to launch it didnt work and didnt sent any error so i added try: and except Exception as e: and now it send me in return the server
code(changed the oriantation that the modal is on top then button then ticket class):
https://paste.pythondiscord.com/JJ7Q
the terminal:
https://paste.pythondiscord.com/3PAQ
the 2 last parts is from the except Exception as e....

spark nimbus
#

if someone know pls tag me..

vale wing
final iron
#

Then people would be more likely to help

robust fulcrum
#

guys why i see this when i close my bot?

        await self.close()
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002246F2CB230>, 2411.437)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002246F201810>
spark nimbus
#
@app_commands.command(name="ticketscat", description="Set the tickets channel. enter the category name only!")
@commands.has_permissions(administrator=True)
@app_commands.describe(category="tickets categories")
  async def ticketscat(self, interaction: discord.Interaction, category: str):
      with open("cogs/json/tickets.json", "r") as f:
          data = json.load(f)

      data[str(interaction.guild.id)]["TicketCategory"] = str(category)

      with open("cogs/json/tickets.json", "w") as f:
            json.dump(data, f, indent=4)

      ticketscat_embed = discord.Embed(title="Tickets category has been changed successfully!", description=f"The ticket category has been changed to: \n{category}", color = 0x020F81)
      await interaction.response.send_message(embed=ticketscat_embed, ephemeral=True)```

idk why this command is not syncing while other commands are
spark nimbus
#
synced = len(await client.tree.sync())
print(f"CMD'S Synced: {synced}")```
spark nimbus
cloud dawn
#

Well this is a global sync

#

It will take up to an hour to sync new commands.

spark nimbus
spark nimbus
cloud dawn
#

If you sync per guild it will almost instantly sync.

spark nimbus
#

ok i will switch to that and let you know in a few minutes

spark nimbus
#

its dosnt sound right

cloud dawn
spark nimbus
#

the command is still not syncing

robust fulcrum
hushed galleon
stark nexus
#
@client.event
async def on_ready():
    activity = discord.Game(name='Splatoon (In ' + str(len(client.guilds))+ ' servers)', type=1)
    await client.change_presence(status=discord.Status.online, activity=activity)
    print(f'{client.user} is online')

    server_id = 1117262143159541792
    channel_id = 1174376047735738368

    server = client.get_guild(server_id)
    channel = server.get_channel(channel_id)

    if server and channel:
        embed = discord.Embed(
            title="I went online!",
            description=f"{client.user} is successfully online!",
            color=0xebd517
        )

        await channel.send(embed=embed)

    try:
        synced = await client.tree.sync()
        print(f'Synced {len(synced)} Commands')
    except Exception as e:
        print(e)
    scheduler.start()
    
    async def send_invites(channel, server_id):
        for guild in bot.guilds:
            if guild.id == target_server_id:
                try:
                    invite = await guild.text_channels[0].create_invite(max_age=86400) 
                    await channel.send(f"Invite link for {guild.name}: {invite.url}")
                except discord.Forbidden:
                    print(f"Bot doesn't have permission to create invites in {guild.name}")
                except Exception as e:
                    print(f"An error occurred while creating an invite for {guild.name}: {e}")

    async def daily_task():
        channel = bot.get_channel(channel_id)
        if channel:
            await send_invites(channel, server_id)

    scheduler = AsyncIOScheduler(timezone=pytz.timezone('Asia/Taipei'))  
    scheduler.add_job(daily_task, 'cron', hour=22, minute=0) 
    scheduler.start()```
#

Why "cannot access local variable 'scheduler' whrte it is not associated with a value?"

#

At py schedular.start

hushed galleon
#

err you have a scheduler.start() line in the middle of your function, above where you defined the scheduler

#

i suggest using the d.py's built-in tasks extension for this though

#

also usually you should avoid running code in on_ready() because it can trigger repeatedly if your bot disconnects from discord

stark nexus
#

let me try a bit

stark nexus
# hushed galleon i suggest using the d.py's built-in tasks extension for this though

what about now?

@client.event
async def on_ready():
    activity = discord.Game(name='Splatoon (In ' + str(len(client.guilds))+ ' servers)', type=1)
    await client.change_presence(status=discord.Status.online, activity=activity)
    print(f'{client.user} is online')

    server_id = 1117262143159541792
    channel_id = 1174376047735738368

    server = client.get_guild(server_id)
    channel = server.get_channel(channel_id)

    if server and channel:
        embed = discord.Embed(
            title="I went online!",
            description=f"{client.user} is successfully online!",
            color=0xebd517
        )

        await channel.send(embed=embed)

    try:
        synced = await client.tree.sync()
        print(f'Synced {len(synced)} Commands')
    except Exception as e:
        print(e)
    my_loop.start()
    
    async def send_invites(channel, server_id):
        for guild in bot.guilds:
            if guild.id == server_id:
                try:
                    invite = await guild.text_channels[0].create_invite(max_age=86400)  # Max age in seconds (24 hours)
                    await channel.send(f"Invite link for {guild.name}: {invite.url}")
                except discord.Forbidden:
                    print(f"Bot doesn't have permission to create invites in {guild.name}")
                except Exception as e:
                    print(f"An error occurred while creating an invite for {guild.name}: {e}")

    @tasks.loop(hours=24)
    async def my_loop():
        channel = bot.get_channel(channel_id)
        if channel:
            await send_invites(channel, server_id)```
#

”cannot access local variable 'my_loop’ where it is not associated with a value”

vale wing
#

Why is your my_loop defined inside on_ready

fallow mauve
#

if a command were to be used with a channel id as an argument, how would i check to see if that id matches a channel in the guild it was used in?

fallow mauve
vale wing
#

You can't parse a channel from other guild using slash channel selection to my knowledge

#
async def cmd(inter: Interaction, channel: TextChannel)```
fallow mauve
#

am i missing a library?

vale wing
#

Because it belongs to whatever library you are using

#

Eg discord.TextChannel

fallow mauve
#

ok

#

ty

#

so

#

would that mean in the command you select the actual channel?

#

not the id?

vale wing
#

Yeah

fallow mauve
#

awesome

vale wing
#

You get ready channel object

#

And you can do that with variety of types

fallow mauve
#

nice

#

slash commands have improved a lot since i last used them (that was years ago tho lol)

vale wing
#

Years ago there was ugly discord_slash lib and it was very ugly indeed

fallow mauve
#

yeah, i kinda tried it out and never used it again

vale wing
#

Thx god disnake appeared

fallow mauve
#

lol

uneven arch
#

I have this codemport discord
from discord.ext import commands
from discord import Interaction
from yt_dlp import YoutubeDL
from discord import FFmpegPCMAudio
import asyncio

class music(commands.Cog):
def init(self, bot):
self.bot = bot
self.is_playing = False
self.is_paused = False

    self.music_queue = []
    self.YDL_Options = {"format": "bestaudio", "noplaylist": "True"}
    self.FFMPEG_OPTIONS = {'before_options': '-reconnect 1 - reconnect_streamed 1 -reconnect_delay_max 5',
                           'options': '-vn'}

    self.vc = None
#

and keep getting this issue [NULL @ 0000023902c35640] Unable to find a suitable output format for 'pipe:'
pipe:: Invalid argument

smoky patrol
#

is it possible to change that if mode add is slected input is required:

@app_commands.describe(channel="Select a Channel")
@app_commands.describe(category="Select a Category")
async def staff_channels(
interaction: discord.Interaction,
mode: discord.app_commands.Choice[str],
input: discord.TextChannel = None,
):

#

so it only shows up if it is selected

fallow mauve
#
@bot.tree.command(name="addchannel", description="Adds a channel to the list.")
@app_commands.describe(channel = "A discord channel")
async def addchannel(interaction: discord.Interaction, channel: discord.TextChannel):
    with open('channels.json', 'r') as file:
        data = json.load(file)
        if not channel.id in data:
            with open(channels.json, 'w') as file:
                json.dump(channel.id, file)
            interaction.response.send_message("Done")

im confused, im wanting to check if a channel id is in channels.json and if it isnt in it then it will add the id of "channel" to the file. the command doesnt respond and it gives me an error saying 'list' object has no attribute 'json'

shrewd apex
#

ur second with open has channels.json

fallow mauve
#

yes

shrewd apex
#

also u shouldnt use json as a db

fallow mauve
#

its just a simple list of channels, i know that json isnt great but i havent coded in years so im not gonna jump right into sqlite yet

#

i will soon but im not ready for it atm

hard nest
#

hey guys, i have a python bot that also uses selenium to webscrape, but i now have no idea how i can host it, as most hosting things probably wont support it. Anyone have any ideas? i dont want to host it locally

shrewd apex
#

not sqlite either thats synchronous u need an asynchronous storage facility

fallow mauve
#

such as

shrewd apex
#

aiosqlite asyncpg aiomysql (sql flavors), motor (mongodb), aioredis (redis)

shrewd apex
#

any host is fine ig

shrewd apex
#

headless dosent open the browser gui when scraping

hard nest
#

im kinda not that advanced with it

hard nest
#

u have an example?

shrewd apex
#

lemme look at the docs been some time since i have played with selenium iirc there is a class called ChromeOptions

hard nest
#

cool ty

shrewd apex
#
options = ChromeOptions()
options.headless = True
driver = webdriver.Chrome(options=options)
driver.get('http://selenium.dev')
driver.quit()
#

also fyi this channel is for discord bots not (bots in general) afaik so next time probably use the #1035199133436354600

hard nest
#

yeah its just that it is a discord bot so i thought that might be why

#

but ty, lemme try it

#

wait where do i define chrome options

#

wait i got it dw, ty

azure tulip
#
embed.set_thumbnail(url=interction.guild.display_avatar.url)

how to specify server avatar in embed?

unkempt canyonBOT
azure tulip
final iron
#

Same thing

hushed galleon
cloud dawn
hushed galleon
#

the earliest mention i found in their server was #697489244649816084 message which is over a year ago, so i don't really think it counts as a test anymore

#

still worth syncing to a guild if you don't want to show off your commands to the public, or if you think you might hit the 200/day ratelimit for command creations which is kinda tough to do by accident

cloud dawn
#

Thanks for the search

ornate linden
#

I'm trying to implement hashlib into a bot to hash large sums of data
In hashlib's documentation I can see that

To allow multithreading, the Python GIL is released...
How can I take advantage of that with asyncio?
Is the asyncio.to_thread method what I'm looking for?

shrewd apex
#

hasn't been yet its still in work and features are largely experimental and still limited to c api for now

ornate linden
#

it looks like that functionality has existed since at least python 2.7

#

If it doesn't matter whether I take advantage of the GIL release or not, can I use a ProcessPoolExecutor instead? Will a ProcessPoolExecutor work with asyncio?

shrewd apex
#

is hashlib blocking?

ornate linden
#

afaik, yeah

shrewd apex
#

then u need to use run_in_executor along with that

ornate linden
#

ah reading more of the asyncio docs,

Note
Due to the GIL, asyncio.to_thread() can typically only be used to make IO-bound functions non-blocking. However, for extension modules that release the GIL or alternative Python implementations that don’t have one, asyncio.to_thread() can also be used for CPU-bound functions.
So the answer is maybe, but then I'm still limited to single-core

shrewd apex
ornate linden
#

is that different than the asyncio run_in_executor?

ocean dragon
#
class GeneratorView(discord.ui.View):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.stopped: bool = False

    @discord.ui.button(label="Stop", style=discord.ButtonStyle.red)
    async def stop_button(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
        self.stopped = True
        self.stop()
message = await interaction.original_response()
await message.edit(view=GeneratorView())
async with message.channel.typing():
    async for content in generator:
        if view.stopped:
            break
        else:
            ...
#

any way to do this?

shrewd apex
ocean dragon
#

have a stop button in a view to stop a generator from generating response

ornate linden
shrewd apex
#

a better or cleaner way might be to edit the wait method in the view

hushed galleon
ocean dragon
#

wym edit method

shrewd apex
#

!d discord.ui.View.wait

unkempt canyonBOT
#

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

Waits until the view has finished interacting.

A view is considered finished when [`stop()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.stop) is called or it times out.
shrewd apex
#

tbh u can probably just use a while loop with the stopped attribute of the view

ocean dragon
#

it doesnt work, the generator just runs until end

ornate linden