#discord-bots

1 messages · Page 503 of 1

hasty iron
#

and make sure its an int

tough wagon
#

^

steep estuary
#

i gave correct id

#

it is sending None

hasty iron
#

how are you getting the id

steep estuary
#

instead of emoji

#

just copy id

hasty iron
#

you cant get the id from right clicking it btw

tough wagon
#

full code pls

steep estuary
#

of that emoji

steep estuary
hasty iron
steep estuary
#

cuz it was sending None

tough wagon
steep estuary
hasty iron
tough wagon
#

\:emoji:

steep estuary
hasty iron
#

what?

hasty iron
#

im talking about right clicking it

steep estuary
#

right clicking on emoji

tough wagon
steep estuary
#

just used await bot.get_emoji(id)

tough wagon
#

you need an async function, send attr to send this

steep estuary
#

also used await ctx.send("<:name:>747387427895")

tough wagon
#

you can't just use that

tough wagon
#

i mean
async def event_or_command():
get_emoji
send(emoji)

steep estuary
#

i used that :/

#

in a command

tough wagon
#

then can u send that?

steep estuary
#

emoji = bot.get_emoji(id)

tough wagon
#

full code of command

steep estuary
#

hmm

#

k

dapper cobalt
#

If you want the emoji's ID just do \:emoji: and copy the number. Or, you can copy the whole result and use it in the string.

#

Try and instead of or.

steep estuary
#

i just used this

tough wagon
#

you didn't define id

#

how should it work

#

like bruh

steep estuary
#

i defined

tough wagon
#

where?

hasty iron
#

you didn’t

#

id is a builtin

steep estuary
#

now i wrote that

#

i deleted that line

#

to show u i wrote that

#

but it didn't worked that time

tough wagon
#

uh, afraid of showing ids ok

steep estuary
#

so i deleted that line

steep estuary
tough wagon
#

rewrite emoji = bot.get_emoji(id) to emoji = bot.get_emoji(replace_this_with_your_emoji_id)

#

and show output

#

like screenshot of what bot sends

tough wagon
steep estuary
#

ok

hasty iron
#

you dont have to

#

you can pass in the id directly

steep estuary
#

i told it send None instead of emoji

tough wagon
#

yes other variant is <[a]:emo_name:emo_id>

steep estuary
#

like <:name:>

tough wagon
steep estuary
#

no

hasty iron
#

are you passing in the id as a string?

tough wagon
#

it should be

steep estuary
#

i cannot tell everyone to add

#

like mee6 also use some emojis

#

of him

tough wagon
#

Your bot should be on the server with that emoji to use it

steep estuary
tough wagon
#

you can't change it

steep estuary
#

this emoji is not in my server

#

than also it sends that emoji

hasty iron
#

what

steep estuary
#

i just mean that

tough wagon
steep estuary
#

?

hasty iron
#

.

tough wagon
#

this emoji is not on your server

bold fog
#

@slate swan @slate swan it shows cogs is not define. You see idk how to setup a cog so i want you guys to help please. All youtube videos directly jump main stream knowledge so i can't understand. btw i want to connect it to music.py file

steep estuary
#

:/

tough wagon
#

but it is on server where mee6 is

steep estuary
#

so it can use anywhere?

#

that only i want to know how to do that :/

crystal cliff
steep estuary
#

i also tried my emoji where my bot is

dapper cobalt
#

Why do you want to get the emoji with its ID? Just do \:emoji:.

#

![lemon_cop](https://cdn.discordapp.com/emojis/827146371466788864.webp?size=128 "lemon_cop") = lemon_cop

#

Try doing \:lemon_cop:.

steep estuary
steep estuary
tough wagon
#

YESSS

dapper cobalt
#

Yes.

steep estuary
#

by bot?

tough wagon
#

@steep estuary

crystal cliff
bold fog
steep estuary
#

oh

dapper cobalt
bold fog
steep estuary
#

lol

#

nvm

tough wagon
crystal cliff
slate swan
bold fog
steep estuary
bold fog
steep estuary
#

message*

tough wagon
steep estuary
tough wagon
#

then it won't

bold fog
#

@tough wagon is it on youtube like full python school is slow in 11th grade

crystal cliff
steep estuary
#

ooh ok let me try my server emoji

#

in another server

dapper cobalt
crystal cliff
bold fog
crystal cliff
tough wagon
dapper cobalt
tough wagon
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

bold fog
honest shoal
#
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\smpbot\main.py", line 184, in play
    if not voice.is_playing():
AttributeError: 'NoneType' object has no attribute 'is_playing'

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

Traceback (most recent call last):
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'is_playing'  ```
#

I made a play command and getting this error

tough wagon
#

can't say anything else

steep estuary
#

oops

honest shoal
tough wagon
honest shoal
#

This is my play command ```py
@bot.command()
async def play(ctx, url):
YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
FFMPEG_OPTIONS = {
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
voice = get(bot.voice_clients, guild=ctx.guild)

if not voice.is_playing():
    with YoutubeDL(YDL_OPTIONS) as ydl:
        info = ydl.extract_info(url, download=False)
    URL = info['url']
    voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
    voice.is_playing()
    await ctx.send('Bot is playing')
tough wagon
steep estuary
past ermine
#

is there any reason why i should make my bot open source

bold fog
#

@tough wagon that will help right?

tough wagon
tough wagon
bold fog
#

ok

steep estuary
#

i just used the emoji which is in the server where the bot is

bold fog
#

how much time to learn fully a year?

past ermine
#

maybe :serverid:emojiname:

#

idk if it works tho

steep estuary
#

hmm

past ermine
#

stackoverflow i found

honest shoal
# tough wagon I don't know, your voice variable is just returning None, you didn't show code s...

this is my code ```py
@bot.command()
async def join(ctx):
channel = ctx.message.author.voice.channel
voice = get(bot.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()

players = {}
@bot.command()
async def play(ctx, url):
YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
FFMPEG_OPTIONS = {
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
voice = get(bot.voice_clients, guild=ctx.guild)

if not voice.is_playing():
    with YoutubeDL(YDL_OPTIONS) as ydl:
        info = ydl.extract_info(url, download=False)
    URL = info['url']
    voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
    voice.is_playing()
    await ctx.send('Bot is playing')

else:
    await ctx.send("Bot is already playing")
    return
plucky shoal
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
dapper cobalt
#

Type this here.

tough wagon
steep estuary
bold fog
#

ok i will be back in may by that time i will only ask things and learn pytthon

dapper cobalt
bold fog
#

thanks byee

dapper cobalt
#

It will be this.

steep estuary
#

??

steep estuary
#

:hello:

#

uff

dapper cobalt
#

With a \ before it.

tough wagon
#

use \

steep estuary
#

the name is changing

dapper cobalt
#

And without the

tough wagon
#

and emoji name

hasty iron
steep estuary
plucky shoal
#

We won't help with projects that include ytdl

dapper cobalt
#

Yes.

#

No.

steep estuary
#

ooh

marsh dove
#

What does the parameter Pass_Context do in a command?

dapper cobalt
#

No, not in the code.

steep estuary
#

wht

dapper cobalt
#

Just in Discord so you can copy it.

tough wagon
steep estuary
#

i tried

marsh dove
steep estuary
tough wagon
mortal thistle
#

hey

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: __aenter__

hasty iron
#

hello

dapper cobalt
mortal thistle
#

can someone tell me what's this?

hasty iron
#

nice error

hasty iron
honest shoal
# tough wagon https://discord.com/channels/267624335836053506/343944376055103488/8924730147829...

when I use play directly it shows "Bot is already playing"
and after using join command this error occurs:

[youtube] Downloading just video JKNz9RGft_0 because of --no-playlist
Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\smpbot\main.py", line 187, in play
    voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 147, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

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

Traceback (most recent call last):
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\New\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found```
mortal thistle
hasty iron
#

we dont have enough info so we dont know what exactly caused the error

steep estuary
#

even google have no answer how to use any emoji anywhere in discord.py

mortal thistle
steep estuary
#

i am searching from 1 week

hasty iron
#

unless you send the full traceback, we can do nothing

past ermine
mortal thistle
#

this is the line causing error

past ermine
#

check this one

hasty iron
mortal thistle
#

any replacement for it?

hasty iron
unkempt canyonBOT
#

property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
hasty iron
dapper cobalt
#

Yes, remove async with.

#

Remove async*

mortal thistle
tough wagon
hasty iron
unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
mortal thistle
#

right?

hasty iron
#

who knows!?

steep estuary
tough wagon
honest shoal
hasty iron
#

you dont have ffmpeg installed

honest shoal
hasty iron
#

(dont download it through pip)

dapper cobalt
honest shoal
hasty iron
#

you need the exe

steep estuary
#

i gave up

hasty iron
steep estuary
#

but the error didn't solved

mortal thistle
tough wagon
mortal thistle
#

I remove async then?

dapper cobalt
hasty iron
#

i mean, i told you to do so

dapper cobalt
mortal thistle
#

or async with?

hasty iron
#

remove async

dapper cobalt
#

I don't know. What do you think?

tough wagon
#

remove async

mortal thistle
hasty iron
#

no

#

you dont

mortal thistle
#

I did

hasty iron
#

AttributeError: __aenter__ only gets raised when something doesnt support async with

tough wagon
#

updated? restarted?

mortal thistle
hasty iron
#

you arent getting the same error if you changed it

#
        except KeyError:
            auction[str(itemname)] = {}
mortal thistle
#

from sqlite3

#

and it's solved now

waxen granite
#

define them in except?

junior verge
#

Any idea?

#
client.embed_color = discord.Color.from_rgb(
    config['Embed Settings']['Color']['r'],
    config['Embed Settings']['Color']['g'],
    config['Embed Settings']['Color']['b']
)
client.footer = config['Embed Settings']['Footer']['Text']
client.footer_image = config['Embed Settings']['Footer']['Text']['Icon URL']
client.playing_status = config['Playing Status']
client.prefix = config['Prefix']
"{prefix}help".format(prefix = client.prefix)

trim storm
#

how to use basic discord emotes using their alias

slate swan
#

try it again?

trim storm
slate swan
#

is there a way to have a cooldown on a cooldown? i dont want people to be spamming commands and my bot getting ratelimited for sending this command is on cooldown

junior verge
#

Yeah

slate swan
#

is there a way to take the member variable that I get from here and use it in another part of my code?

@bot.event
async def on_message(message):
  member = message.author

@buttons.click
async def button(ctx):
  #I need the member from the on_message to be here as well
slate swan
#

i need that same member from the on_message to be in the other spot

#

so i was wondering if its possible to like import the member variable from the on_message into the other spot or something

junior verge
#

Anyone?

#

Don't really see a problem

slate swan
junior verge
#

Where should it be?

#

In my yml?

slate swan
junior verge
#

Yeah but where

#

Like how to fix it

slate swan
#

in embed settings

hollow mortar
#

hey

slate swan
#

put Footer in embed settings

hollow mortar
#

any help here

junior verge
#

Don't get it sorry

hollow mortar
#
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> & C:/Users/Mohamed_Zeton/AppData/Local/Microsoft/WindowsApps/python3.9.exe "c:/Users/Mohamed_Zeton/Desktop/JOB 1/job.py"
CursedMC is ready.
Ignoring exception in on_raw_reaction_add
Traceback (most recent call last):
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 186, in on_raw_reaction_add
    await member.add_roles(role)
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\member.py", line 777, in add_roles
    await req(guild_id, user_id, role.id, reason=reason)
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
#

this error in this part of code

#
@bot.listen()
async def on_raw_reaction_add(payload):
    message_id = payload.message_id
    if message_id ==  892480300762947634: ## add id msg of the msg you want ppl to react to to get role 
        guild_id = payload.guild_id
        guild = discord.utils.find(lambda g: g.id ==guild_id, bot.guilds)
        if payload.emoji.name == 'verified':
            role = discord.utils.get(guild.roles, name='verified')
        elif payload.emoji.name == 'fola':
            role = discord.utils.get(guild.roles, name='fola')
        else:
            role = discord.utils.get(guild.roles, name=payload.emoji.name)
        if role is not None:
            member = payload.member
            if member is not None:
                await member.add_roles(role)
                print("done")
            else: 
                print("memeber not found")
        else:
            print("role not found ")```
slate swan
hollow mortar
#

how the bot have admin perms

slate swan
blissful crane
slate phoenix
#

it doesn’t have perms to add a role higher than it or possibly to a person above them

hollow mortar
#

worked even if bot have admin role the bots role should be top of the role you want to give

slate swan
junior verge
#
client.embed_color = discord.Color.from_rgb(
    config['Embed Settings']['Color']['r'],
    config['Embed Settings']['Color']['g'],
    config['Embed Settings']['Color']['b']
)
client.footer = config['Embed Settings']['Footer']['Text']
client.footer_image = config['Embed Settings']['Footer']['Text']['Icon URL']
client.playing_status = config['Playing Status']
client.prefix = config['Prefix']
"{prefix}help".format(prefix = client.prefix)


log_channel_id = config['Log Channel ID']
hollow mortar
slate swan
junior verge
#

Yeah it should be

#

In Yml you mean

slate swan
# hollow mortar nope
role = discord.utils.get(guild.roles, name='verified')

replace with

role = guild.get_role(id)
hollow mortar
outer violet
#

How do I make an ascii command that does this?

junior verge
#

@slate swan Sorry but I still don't get it

hollow mortar
slate swan
hollow mortar
junior verge
slate swan
marsh dove
#

the
await member.remove_roles()
command is slow when the member has no roles, is there anyway to fix this?

blissful crane
#

Just if not member.roles: would do

slate swan
#

if its slow when the user has no roles then check if the user does not have any roles

blissful crane
#

Yes

marsh dove
#

this worked i guess

slate swan
#

yes

marsh dove
#

it seems like the bot is stuttering when it comes to removing my roles in specifically

slate swan
marsh dove
slate swan
#

it does that automaticly

hollow mortar
#

hey i have question out here

slate swan
#

yes?

hollow mortar
#
@bot commands
@commands.has_permissions(manage_messages=true)```
marsh dove
slate swan
#

api? ratelimit?

hollow mortar
#

if make only ppl who have mange messages perm that can use this command ?

hollow mortar
blissful crane
hollow mortar
#

oh how do i change it like staff role ?

#

like if ppl have staff role can use this command

slate swan
#

Anyone knows how to remove a user reaction of a partialemoji class?

blissful crane
#

@commands.has_role(role)

slate swan
#

Im using raw_reaction_add to make a reaction role command

blissful crane
#

Or @commands.has_roles(roles)

hollow mortar
#

and i add var role in the line before it the role id right ?

blissful crane
#

No, just add the role name/id

#

Either, not both

hollow mortar
#

ohhohohohoh \

crystal cliff
hollow mortar
#

kk got it thanks alot

#

thanks

#

so i only change the (roles )

#

to my role name ?

blissful crane
#

await msg.remove_reaction(emoji, member)

blissful crane
#

👍

hollow mortar
#
  File "c:\Users\Mohamed_Zeton\Desktop\JOB 1\job.py", line 181, in <module>
    @commands.has_roles(891031599708266633)
AttributeError: module 'discord.ext.commands' has no attribute 'has_roles'
PS C:\Users\Mohamed_Zeton\Desktop\JOB 1> ```
slate swan
#

@bot.command()
async def emoijfy(ctx,*,text):
emoijs = []
for beans in text:
if beans.isdecimal():
num2word ={'0':'zero','1':'one','2':'two','3':'three','4':'four','5':'five','6':'six','7':'seven','8':'eight','9':'nine'}
emoijs.append(f':{numword.get(beans)}:')
elif beans.isalpha():
emoijs.append(f':regionalindicator{beans}:')
else:
emoijs.append(beans)
await ctx.send(''.join(emoijs))

hollow mortar
#
@bot.command()
@commands.has_roles(891031599708266633)
async def unmute(ctx ,member : discord.Member,):
    guild =ctx.guild
    mutedRole = discord.utils.get(guild.roles, name="Muted")
    await member.remove_roles(mutedRole)
    await ctx.send(f"Unmuted {member.mention}")

hollow mortar
#

in this code

blissful crane
#

Gimme a sec

hollow mortar
#

ok

blissful crane
#

Oh mbbb

#

It's has_any_role

#

For your case since you only have 1 role you should use has_role instead

hollow mortar
#

oh ok

boreal ravine
slate swan
boreal ravine
#

Still, I've seen the code a thousand times

cloud dawn
slate swan
dry kelp
#

how can i do this lol?

blissful crane
#

Well I mean, it's fine to copy code if you can understand what it does

blissful crane
dry kelp
#

thx

blissful crane
#

np

blissful crane
junior verge
#

Any idea?

#
client.embed_color = discord.Color.from_rgb(
    config['Embed Settings']['Color']['r'],
    config['Embed Settings']['Color']['g'],
    config['Embed Settings']['Color']['b']
)
client.footer = config['Embed Settings']['Footer']['Text']
client.footer_image = config['Embed Settings']['Footer']['Text']['Icon URL']
client.playing_status = config['Playing Status']
client.prefix = config['Prefix'].format(prefix = client.prefix)
"{prefix}help".format(prefix = client.prefix)
blissful crane
junior verge
#

where?

blissful crane
#

I mean, make it a lowercase f

#

footer instead of Footer

junior verge
#

Nope

#

same error

blissful crane
#

Gimme a sec

#

KeyError
If you get a KeyError, it means what you are looking for isn’t in the dict/json. There are many solutions for this:`

  1. Make a try-except to make a default value
  2. Add the key manually
  3. If its a discord bot and you are making a custom prefix thingy, simply kick the bot and invite it again (you need the on_guild_join part for this)`
#

We have no way of helping you since we don't know what config is and stuff so here is what a KeyError is and how to solve it

blissful crane
#

.get ?

slate swan
#

Yes

#

!d dict.get

unkempt canyonBOT
#

get(key[, default])```
Return the value for *key* if *key* is in the dictionary, else *default*. If *default* is not given, it defaults to `None`, so that this method never raises a [`KeyError`](https://docs.python.org/3.10/library/exceptions.html#KeyError "KeyError").
blissful crane
#

Oh

#

I just prefer using dct["thing"] but I guess that works too

slate swan
#

This is also what you'll usually encounter in production

blissful crane
#

len(bot.commands) I believe

slate swan
#

oh uhh

#

hmmmmmmmmmmmmmmm

#

TextChannel

#

oh ty

#

!d discord.TextChannel.overwrites_for

unkempt canyonBOT
slate swan
#

there we go

#

works with VoiceChannel aswell

#

quite obviously....

slate swan
#

i was looking for the permissions attributes

#

thats why i looked for overwrites

#

mmhmm

#

i was able to find em, thx B)

#

👍

rustic onyx
#
    await crowbot_channel.send(embed = embed)
AttributeError: 'NoneType' object has no attribute 'send'
blissful crane
rustic onyx
#

but it says it has no attribute send which makes no sense 😛

#


        crowbot_channel = self.bot.get_channel(config["Channels"]["Crowbot"])
        await crowbot_channel.send(embed = embed)
blissful crane
#

@rustic onyx it does, because crowbot_channel is None

rustic onyx
#

Oh

#

okay 👍

cloud dawn
#

!e crowbot_channel.send('makes sense')

unkempt canyonBOT
#

@cloud dawn :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'crowbot_channel' is not defined
blissful crane
#

print(config["Channels"]["Crowbot"])`

rustic onyx
#

1 sec

hasty iron
rustic onyx
#

ohoh wait

#

fucking me lmao

#

it was none, yeah

#

you were right, I got my error

#

thanks for answering guys

slate swan
#
supportEm = embed.Discord(title=namet)```

bruh lmaooo, im so sleepy i put "embed.Discord" instead of "discord.Embed"
#

im so dum rofl

rustic onyx
#

ok now I did the print thing and its returning an int

#

but still have the same error

#
    await self.coro(*args, **kwargs)
  File "D:\Discord Bots\CrowBot\Cogs\openinterest.py", line 43, in binance_btc_oi
    await crowbot_channel.send(embed = embed)
AttributeError: 'NoneType' object has no attribute 'send'
#
        crowbot_channel = self.bot.get_channel(config["Channels"]["Crowbot"])
        await crowbot_channel.send(embed = embed)

printing config["Channels"]["Crowbot"] returns
892169591172792320

#

no difference

#

its just how you define it

#

nah

final iron
#

In which context

#

There is a big difference between discord.Bot() and discord.Client()

cloud dawn
final iron
#

I would suggest bot because it's better practice but it doesn't make a difference

cloud dawn
#

One is badly named other one is not.

final iron
reef shell
#

discord.Bot() inherits discord.Client()

tender shore
#

How to implement the option to watch youtube video in loop or n-amount of times in this discord music bot?

    @commands.command()
    async def play(self, ctx, url):
        ctx.voice_client.stop()

        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}

        YDL_OPTIONS = {'format':"bestaudio"}

        vc = ctx.voice_client #we need to declare our voice chat

        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            url2 = info['formats'][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
            vc.play(source) #play the audio

I was trying to put something in the play command so if I put the command ? play url [2] then let the music repeat twice.

Or when input the command ? play url [6] then let the music repeat six times the url music.

I mean, with some [] you can indicate how many times to repeat, or if you simply omit the [], putting only ? play url then repeat it only once

final iron
unkempt canyonBOT
#

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

plucky shoal
reef shell
#

so you're talking about naming convention?

cloud dawn
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
plucky shoal
#

It's like the 10th time that someone does that in the last few minutes lmao (asking about ytdl)

final iron
cloud dawn
reef shell
#

my internet broke

#

nvm

tender shore
reef shell
#

XD

tender shore
reef shell
cloud dawn
reef shell
#

that helps breaking ToS

outer violet
cloud dawn
#

If i did know i'd report the server.

outer violet
#

I imported datetime and everything too

rustic onyx
#
    await crowbot_channel.send(embed = embed)
AttributeError: 'NoneType' object has no attribute 'send'
slate swan
#

wonder what crowbot_channel's type is

rustic onyx
#
        crowbot_channel = self.bot.get_channel(config["Channels"]["Crowbot"])
        await crowbot_channel.send(embed = embed)
cloud dawn
unkempt canyonBOT
#

@cloud dawn :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'send'
slate swan
#

self.bot.get_channel(config["Channels"]["Crowbot"]) = None

rustic onyx
#
Channels:
  Crowbot: 892169591172792320
#

idk...

outer violet
slate swan
#

can you print(config["Channels"]["Crowbot"])?

outer violet
#

:/

rustic onyx
reef shell
#

use time.time() instead

rustic onyx
dapper cobalt
rustic onyx
#

yup

slate swan
#

convert the id to int

outer violet
slate swan
#

int(config["Channels"]["Crowbot"])

reef shell
cloud dawn
outer violet
rustic onyx
slate swan
#

then ig the id's wrong

outer violet
rustic onyx
cloud dawn
#

check cmd

outer violet
#

It’s not .-.

outer violet
rustic onyx
languid jungle
#

Please don't use that word in this server

slate swan
#

breh

dapper cobalt
#

!d discord.Event @slate swan

unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

dapper cobalt
#

There's nothing such as discord.Event.

#

It's discord.on_message_delete.

#

!d discord.on_message_delete

unkempt canyonBOT
#

discord.on_message_delete(message)```
Called when a message is deleted. If the message is not found in the internal message cache, then this event will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.

If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_delete "discord.on_raw_message_delete") event instead.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
cloud dawn
unkempt canyonBOT
#

@event```
A decorator that registers an event to listen to.

You can find more info about the events on the [documentation below](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events).

The events must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)"), if not, [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.9)") is raised.

Example

```py
@client.event
async def on_ready():
    print('Ready!')
dapper cobalt
fallow mauve
#

i dont want this command to work is there a way to turn it off?

reef shell
#

!d discord.ext.commands.Command.enabled

unkempt canyonBOT
reef shell
#

why would you not want the help command?

crystal wind
#

Does PythonCharm need a specific version to be running?

reef shell
#

pythoncharm?

outer violet
fallow mauve
#

im coding the command separately, <commands, <about, etc, not just one command

reef shell
reef shell
outer violet
final iron
fallow mauve
crystal wind
reef shell
cloud dawn
reef shell
#

?

cloud dawn
unkempt canyonBOT
#

class discord.ext.commands.MinimalHelpCommand(*args, **kwargs)```
An implementation of a help command with minimal output.

This inherits from [`HelpCommand`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.HelpCommand "discord.ext.commands.HelpCommand").
reef shell
cloud dawn
#

Yeah

reef shell
#

I said "you need to hardcode a lotta stuffs when you remove the default help command and make a custom one"

cloud dawn
#

And there also is a kwarg in commands.Bot() to disable the default help command, but if you wanna modify it subclassing is the fastest option.

cloud dawn
#

You could and that is bad, doesn't mean you need to do it.

reef shell
#

Yes

cloud dawn
#

Indeed

#

Or am i still not getting it pithink

crystal wind
#

Okay let me reformulate my question.
Is it possible to use PyCharm with discord.py?
If so, is there a required version of Python for this?

cloud dawn
#

pycharm is just an IDE i don't see why ther would be an issue.

#

Python 3.8+

reef shell
crystal wind
#

It did recognize import discord, but not from discord import commands.

reef shell
#

Oh

#

I read it wrong

crystal wind
#

?

reef shell
crystal wind
#

I’ll see if I set discord.ext or discord only, I’ll let you know later

reef shell
#

Ok

crystal wind
#

I’ll give more details later, because I can’t have access to my pc right now xD

cloud dawn
#

Well you could name it discord

crystal wind
#

I don’t think it works if you put discord only, I tried it.

cloud dawn
#

from discord.ext import commands as discord

#

Pretty bad naming though

crystal wind
#

Oh you meant like that hm.

cloud dawn
#

Would be confusing for other coders

crystal wind
#

Does it make an impact on the code structure or?

reef shell
flat solstice
#

So I have this command which I'm using to copy a embed msg from a specific channel and repost it if a msg link or ID is provided. I then also want it to accept a str which will contain a search phrase, if it finds the phrase in the title of a embed in the suggestions channel then I want it to make a string of all of the embeds which contain that string. I am getting this error py ERROR:cogs.error_handler:TypeError: object TextChannel can't be used in 'await' expression (In test_sug) Traceback: File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/some_commands.py", line 14, in test_sug suggestions = await self.bot.get_channel(id = self.suggestions) and this is my code so farpy @commands.command(description = "Lets users locate a specfic suggestion via it's message ID or link.", usage = "sug <[messsage link|ID] | [phrase]>", aliases = ["find", "find-sug", "search", "search-sug"]) async def test_sug(self, ctx, search: str): suggestions = await self.bot.get_channel(id = self.suggestions) if search == discord.Message: message = self.bot if search.channel == suggestions: await ctx.reply(embed = search.embeds[0].copy(),) else: with ctx.typing(): matches = 0 output = " " messages = await suggestions.history(limit = None, before = None, after = None, around = None, oldest_first = None).flatten() for message in messages: if search in message.content: matches += 1 output = (f"[{message.embeds[0].title()}]({message.jump_url})" + output) embed = Embed(title = "I found `{len(matches)}` suggestions matching `{serach}`.", description = output) await ctx.reply(embed = embed)

crystal wind
#

Idk if it was on purpose.

reef shell
crystal wind
pliant gulch
#

You do not await it

cloud dawn
#

Can you copy embeds like that?

#

I thought they'd return as a dict

flat solstice
pliant gulch
#

!d discord.Embed.copy

unkempt canyonBOT
slate swan
#

how do i run a bot

reef shell
unkempt canyonBOT
#

run(*args, **kwargs)```
A blocking call that abstracts away the event loop initialisation from you.

If you want more control over the event loop then this function should not be used. Use [`start()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.start "discord.ext.commands.Bot.start") coroutine or [`connect()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.connect "discord.ext.commands.Bot.connect") + [`login()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.login "discord.ext.commands.Bot.login").

Roughly Equivalent to...
cloud dawn
cloud dawn
slate swan
#

like a bot token

reef shell
#

yes, you need to pass the token as arg

slate swan
#

ok

crystal wind
#

It can’t cause it doesn’t know which BOT is supposed to run.

slate swan
#

how do i do that im new to Python

crystal wind
#

same too ^

reef shell
slate swan
#

someone sent me a code

cloud dawn
reef shell
cloud dawn
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
reef shell
#

Before jumping into making discord bots

crystal wind
#

I really enjoy python, but I heard that discord.py doesn’t support anymore, do you use any alternatives or the current discord.py? @reef shell

cloud dawn
#

We can help but we are not going to hold your hand.

cloud dawn
slate swan
#

File "main.py", line 13
except:
^
SyntaxError: invalid syntax

#

help

slate swan
reef shell
#

You can keep using discord.py untill discord makes breaking changes to their api which may conflict with dpy

crystal wind
#

I think except only works if there’s try: right?

crystal wind
cloud dawn
crystal wind
#

Oof

cloud dawn
#

python 3.10 should fix that issue.

#

pretty neat

pliant gulch
#

man slash commands are just so eh

#

I made an HTTP server to test out for slash commands, so limiting

#

Not even worth it imo to do it over HTTP server like everyone was recommending

cloud dawn
pliant gulch
#

No its not the syntax lmao

#

how would that make any sense

reef shell
#

Lol

pliant gulch
#

its how limiting it is, esp with the returns

cloud dawn
#

I like the idea but it's pretty badly executed.

pliant gulch
#

thats what everyone says its overdone

crystal wind
#

People mostly use java for this kind of task

reef shell
#

slash commands could be an option but making message intent privileged is........

pliant gulch
#

what I was talking about is the return which discord takes and does something with

#

its way to limiting, cannot do regular use stuff

#

other then send messages and deferring an interaction

wispy spade
crystal wind
#

first result about discord slash commands is discord-interactions

cloud dawn
wispy spade
#

yeah i'm not sure how that's gonna work

#

could very well be abused

reef shell
cloud dawn
crystal wind
#

So that makes a 3rd party of a 3rd party

#

hahaha funny funny. Jokes asides, I might just use it.

reef shell
crystal wind
#

Oh yeah, one more thing.

#

Is it possible to play an mp3 file from a bot in vc, but that mp3 file is stored locally?

cloud dawn
#

Why not

crystal wind
#

In java, I heard it was possible through google drive, but I'm not sure if Python can

cloud dawn
#

java can also do it locally

crystal wind
#

ye

patent lark
#

👍

crystal wind
#

I'm not sure how am I supposed to search for on google. Because most of the results are affiliating with youtube_dl, but we can't do that.

hasty iron
#

google drive?

crystal wind
#

ye

#

through a link

hasty iron
#

what?

patent lark
hasty iron
#

thanks

crystal wind
#

h

hasty iron
#

i put alot of effort into it

wispy spade
#

a piece of art

patent lark
#

i can tell.

crystal wind
#

Yeah so. I'm not sure if it's possible to make a bot play from mp3 file, but I'll continue my deep research on it.

cloud dawn
#

i've seen this before pretty neat, i'd do it too if i wasn't so lazy.

hasty iron
#

!d discord.FFmpegOpusAudio

unkempt canyonBOT
#

class discord.FFmpegOpusAudio(source, *, bitrate=128, codec=None, executable='ffmpeg', pipe=False, stderr=None, before_options=None, options=None)```
An audio source from FFmpeg (or AVConv).

This launches a sub-process to a specific input file given. However, rather than producing PCM packets like [`FFmpegPCMAudio`](https://discordpy.readthedocs.io/en/master/api.html#discord.FFmpegPCMAudio "discord.FFmpegPCMAudio") does that need to be encoded to Opus, this class produces Opus packets, skipping the encoding step done by the library.
hasty iron
#

source param?

crystal wind
#

Yeah

#

People are implementing this with youtube_dl, but it doesn't have any dependencies with it right?

hasty iron
#

why would you need ytdl for local files

pliant gulch
#

You need FFmpeg

fallow mauve
crystal wind
crystal wind
hasty iron
#

what? didn’t you say you have a local file

#

i dont see why ytdl is even mentioned here

crystal wind
hasty iron
#

ok

#

have you even tried something?

crystal wind
# unkempt canyon

Not really, I don't really know where to start. I need to understand this first.

fallow mauve
#

half my lines of code are for one command lmao

#

i have over 100 lines too

pliant gulch
jade jolt
fallow mauve
#

lol

crystal wind
#

As a @commands.command?

fallow mauve
jade jolt
#

uh

#

i forgot i made it a while back

fallow mauve
#

oof

crystal wind
jade jolt
#

think it was an eval with no external imports

hasty iron
#

no

cloud dawn
#

Most commands are around 2000 lines considering everything is an object in python.

hasty iron
#

lines don’t affect anything

crystal wind
#

I see

jade jolt
#

the lib im using doesnt even have a command handler

pliant gulch
#

Make your own

cloud dawn
#

Method does affect something like speed but tbh if you want a fast bot don't use python.

jade jolt
#

its all in the messageCreate function

jade jolt
#

sooo

hasty iron
#

why cant you use decorators

stark hearth
#

what is a good way for implementing music commands without youtube_dl

pliant gulch
#

If you can't use decorators just manually register them or some other way

cloud dawn
jade jolt
#

because its not using python xp

pliant gulch
#

There is no reason you need to copy discord.py exactly lol

jade jolt
#

ok fine ill try it

#

ill make my own

flat solstice
#
    @commands.command(description = "Lets users locate a specfic suggestion via it's message ID or link.", usage = "sug <[messsage link|ID] | [phrase]>", aliases = ["find", "find-sug", "search", "search-sug"])
    async def test_sug(self, ctx, search: Union[discord.Message, str]):
        suggestions = self.bot.get_channel(id = self.suggestions)
        if search == discord.Message:
            await ctx.reply(embed = search.embeds[0].copy(),) # components = """Needs a button linking to the message"""
        else:
            with ctx.typing():
                matches = 0
                output = " "
                messages = await suggestions.history(limit = None, before = None, after = None, around = None, oldest_first = None).flatten()
                for message in messages:
                    if search in message.content:
                        matches += 1
                        output = (f"[{message.embeds[0].title()}]({message.jump_url})" + output)

                embed = Embed(title = f"I found `{matches}` suggestions matching `{search}`.", description = output)
                await ctx.reply(embed = embed)```So I have this command which I'm using to copy a embed msg from a specific channel and repost it if a msg link or ID is provided. I then also want it to accept a str which will contain a search phrase, if it finds the phrase in the title of a embed in the suggestions channel then I want it to make a string of all of the embeds which contain that string. I am getting this error ```py
ERROR:cogs.error_handler:TypeError: 'in <string>' requires string as left operand, not Message (In test_sug)
Traceback:
  File "/home/snowyjaguar/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/modmail/cogs/some_commands.py", line 24, in test_sug
    if search in message.content:```
pliant gulch
#

Should be easy anyhow, command handlers are really just a glorified string parser

stark hearth
cloud dawn
jade jolt
hasty iron
stark hearth
cloud dawn
#

they got a site

hasty iron
#

they cant just be like "here, break the law"

stark hearth
#

ty for that

fallow mauve
#

im giving my bot a feature where you can use the command <mobprofile [mob name] and it will show you the stats of a minecraft mob, not even halfway done with the profiles lmao

hasty iron
#

that should be easy with some kind of api

patent lark
jade jolt
#

yee

#

anything is easy with some api

fallow mauve
jade jolt
#

not bad

hasty iron
#

and im sure, considering how popular mc is there would be some apis that do that

fallow mauve
hasty iron
#

so you’re writing the data manually?

fallow mauve
#

data?

hasty iron
#

for the mobs

fallow mauve
#

yeah

cloud dawn
hasty iron
#

that sounds like pain

patent lark
#

yep.

fallow mauve
#

its actually pretty fun imo

cloud dawn
#

You'd miss a lot of things though

fallow mauve
#

although finding the transparent pngs for the mob emojis is a pain

cloud dawn
#

The api also has things like weakness and drop change etc.

fallow mauve
#

i dont want it that complicxated yet. my friend wanted me to add things like where it shows the mobs health while wearing armor and im not adding that yet

jade jolt
#

yeah thats complicated

fallow mauve
#

mhm

jade jolt
#

i could help

fallow mauve
#

nah

#

maybe later

jade jolt
#

well if u need help hmu

hasty iron
#

aren’t there like 3 mobs who can wear armor??

jade jolt
#

all can

#

if you use commands

fallow mauve
#

lmao

cloud dawn
fallow mauve
#

this is a minecraft SMP im making it for, commands are against the rules

jade jolt
#

o.o

cloud dawn
#

i see an ender dragon flexing in leather armor rn

fallow mauve
#

silverfish wearing a pumpkin as a helmet 👀

jade jolt
#

silverfish in prot 4 netherite armor

fallow mauve
#

creeper with elytra

patent lark
#

!ot

unkempt canyonBOT
fallow mauve
#

sry

#

this got way out of hand lol

cloud dawn
#

Well if no ones got an issue i don't see why the chat has to be quite imo

jade jolt
#

ya

patent lark
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

cloud dawn
#

It's just that ot conversations can bury questions sometimes and that is annoying.

jade jolt
#

mhm

fallow mauve
#

so i have a question

jade jolt
#

hm?

fallow mauve
#

this started out as a bot-related conversation and moved away from that, do you expect us to switch channels every time the topic of conversation changes even though its the same conversation?

jade jolt
#

they want that, yes

fallow mauve
#

no offense to the mods btw

#

just asking

cloud dawn
fallow mauve
#

ok

#

snow is about to give us a long lecture, hes still syping lmao

jade jolt
#

mhm

patent lark
#

changing or stopping an ot conversation is completely up to the people talking, whether they get warned for breaking a rule is in their hands. this isnt the channel for a conversation about MC.

fallow mauve
#

ok

jade jolt
#

ok

cloud dawn
fallow mauve
#

mhm

patent lark
#

indeed. i didnt mean to be rude if i was.

fallow mauve
#

u werent

#

i was just making sure that i understood what was expected of me and u were helping 😉

cloud dawn
#

Actually i think i'm just going to ask staff what their though would be on the matter. This has gotten me curious.

fallow mauve
#

ok

patent lark
#

yeah, i mean maybe an OT conversation wouldnt be all that bad given that there are no on-going questions in the channel as of now, but rules are rules.

fallow mauve
#

very true, i dont wanna get banned like i have in other servers

#

MDK's to be specific

patent lark
#

you wouldnt get banned, ive gotten verbally warned a few times about having an OT conversation here, it isnt a very strict rule that is always watched for. but respectfully, i follow it

cloud dawn
patent lark
#

it just depends on the situation i guess.

fallow mauve
#

any ideas for features i should add to my bot? lets move to a bot-related topic now shall we?

jade jolt
#

hmm

#

whats in your bot already

fallow mauve
#

lemme show screenshot of help menu

jade jolt
#

okay :)

cloud dawn
#

update the help menu incomming

jade jolt
#

^^^

fallow mauve
cloud dawn
#

Update the help command

fallow mauve
#

?

patent lark
#

update it

jade jolt
#

yes

#

update it

fallow mauve
#

what do u mean

cloud dawn
#

😂

fallow mauve
#

u guys weird

jade jolt
#

embeds

patent lark
#

make an advanced paginated help command

fallow mauve
jade jolt
#

mine uses buttons

cloud dawn
#

Using subclassing

patent lark
#

ive only subclassed a help command a couple times :p

fallow mauve
cloud dawn
#

subclassing is like making a second child ducky_lemon

fallow mauve
#

-_-

patent lark
#

andy!

jade jolt
#

and heres my awful help command

#

wow quality!

#

thanks imgur for being as bad as i remember

pliant gulch
#

You wouldn't want to be inheriting genes from a first child 😅

fallow mauve
#

i thought i heard never gonna give you up playing in the other room for a sec... phew

jade jolt
#

its a good song

fallow mauve
#

wrong

jade jolt
#

not wrong

cloud dawn
fallow mauve
#

its only good if you turn the volume down all the way

jade jolt
#

nah

pliant gulch
jade jolt
#

my help commands code is ugly too

fallow mauve
jade jolt
#

userinfo?

fallow mauve
#

is that complicated?

jade jolt
#

no

fallow mauve
#

ok... pls explain it to me then

cloud dawn
patent lark
#

mine lol

fallow mauve
jade jolt
#

ok bet thats urs

#

show the code

fallow mauve
patent lark
#

lmao

fallow mauve
pliant gulch
cloud dawn
jade jolt
pliant gulch
#

Code is public in my bots repo

#

😔

jade jolt
#

👀

fallow mauve
jade jolt
#

if u want to

#

ill show mine after

fallow mauve
#

-_-

cloud dawn
#

slash commands will eliminate help commands anyways

fallow mauve
#

im not using slash commands, they suck imo

pliant gulch
jade jolt
#

the lib i use hasnt got anywhere close to that

fallow mauve
#

what if i wanted to make a diceroll command, how do i randomize responses?

jade jolt
#

random.choice

fallow mauve
#

ok

#

where in the code?

jade jolt
#

the command

patent lark
# patent lark
class Help(commands.Cog, name="Snow is weird"):
    def __init__(self, bot):
        self.bot = bot
        self.cmds_per_page = 6

    def get_command_signature(self, command: commands.Command, ctx: commands.Context):
        aliases = "|".join(command.aliases)
        cmd_invoke = f"[{command.name}|{aliases}]" if command.aliases else command.name

        full_invoke = command.qualified_name.replace(command.name, "")

        signature = f"{ctx.prefix}{full_invoke}{cmd_invoke} {command.signature}"
        return signature

    async def return_filtered_commands(self, walkable, ctx):
        filtered = []

        for c in walkable.walk_commands():
            try:
                if c.hidden:
                    continue

                elif c.parent:
                    continue

                await c.can_run(ctx)
                filtered.append(c)
            except commands.CommandError:
                continue

        return self.return_sorted_commands(filtered)

    def return_sorted_commands(self, commandList):
        return sorted(commandList, key=lambda x: x.name)

    async def setup_help_pag(self, ctx, entity=None, title=None):
        entity = entity or self.bot
        title = title or self.bot.description

        pages = []

        if isinstance(entity, commands.Command):
            filtered_commands = (
                list(set(entity.all_commands.values()))
                if hasattr(entity, "all_commands")
                else []
            )
            filtered_commands.insert(0, entity)

        else:
            filtered_commands = await self.return_filtered_commands(entity, ctx)

        for i in range(0, len(filtered_commands), self.cmds_per_page):
            next_commands = filtered_commands[i : i + self.cmds_per_page]
            commands_entry = ""

            for cmd in next_commands:
                desc = cmd.short_doc or cmd.description
                signature = self.get_command_signature(cmd, ctx)
                subcommand = "Has subcommands" if hasattr(cmd, "all_commands") else ""

                commands_entry += (
                    f"• **__{cmd.name}__**\n``\n{signature}\n``\n{desc}\n"
                    if isinstance(entity, commands.Command)
                    else f"• **__{cmd.name}__**\n{desc}\n    {subcommand}\n"
                )
            pages.append(commands_entry)

        await Paginator(title=title, color=0xCE2029, entries=pages, length=1).start(ctx)

    @commands.Cog.listener()
    async def on_ready(self):
        print(f"{self.__class__.__name__} cog has been loaded\n-----")

    @commands.command(
        name="help", aliases=["h", "commands"], description="Need help?"
    )
    async def help(self, ctx, *, entity = None):
        if not entity:
            await self.setup_help_pag(ctx)

        else:
            cog = self.bot.get_cog(entity)
            if cog:
                await self.setup_help_pag(ctx, cog, f"{cog.qualified_name}'s commands")

            else:
                command = self.bot.get_command(entity)
                if command:
                    await self.setup_help_pag(ctx, command, command.name)

                else:
                    await ctx.send("Entity not found.")``` lol
jade jolt
#

oh

#

and mine

cloud dawn
#

jeez snow nitro flex

patent lark
#

xD

fallow mauve
#

and yes, ive switched to dark mode

patent lark
jade jolt
# patent lark ```py class Help(commands.Cog, name="Snow is weird"): def __init__(self, bot...
local commandList = {
            e = "Evaluate code you send",
            lcmd = "Gets last used command",
            respond = "Respond with a message",
            ping = "Pong",
            help = "Gets help..?"
            }
            
local commandPerms = {
            --[[ 
                1; Everyone,
                2; Mod,
                3; Admin,
                4; Owner
                ]]--
            e = "4",
            lcmd = "4",
            respond = "1",
            ping = "1",
            help = "1"
            }
if cmd == PREFIX..'help' then
        helpstring = ""
        for i, v in next, commandList do
            helpstring = helpstring.."- Command: "..i.." [ "..v.." ]\nRequired Level: "..commandPerms[i].."\n" 
        end
        message.channel:send("\`\`\`\nPermission List\n"..permList.."\n\`\`\`\n\`\`\`diff\nCommands\n"..helpstring.."\n\`\`\`")
        commandUsed('help', message.author.name, message.channel.id)
    end
cloud dawn
# fallow mauve where?
return message.channel.send(random.randint(1, 6))
``` *realizing he made all his commands in on_command*
jade jolt
#

i have to

patent lark
#

oh no..

jade jolt
#

mine doesnt have a proper command handler 😂

patent lark
#

on_message?

#

@cloud dawn

cloud dawn
cloud dawn
fallow mauve
#

i have to go, ill figure this out later

jade jolt
pliant gulch
#

The worst feeling ever

#

😔

cloud dawn
patent lark
#

you do.

jade jolt
# cloud dawn Why not?
local cmd, arg = string.match(message.content, '(%S+) (.*)'); cmd = cmd or message.content
``` is how i get the command name and the arguments (if any)
cloud dawn
hasty iron
#

is that lua or something

cloud dawn
#

😂

jade jolt
#

uh

cloud dawn
#

no pls no lua

jade jolt
#

possibly

jade jolt
#

all args?

hasty iron
#

wow no converters? shit lib

cloud dawn
#

Wait what? my head is so confused of what you want to do?

pliant gulch
#

Using something as low level like lua might as well use a discord wrapper in C

jade jolt
#

it only gets the first, if i want more ill have to match it with regex and split it

patent lark
# cloud dawn menudocs i see now

yeah, i got that code a while back when i wasnt familiar with making things paginated, and honestly ive only re-written it once or twice for another bot of mine, i really like it.

pliant gulch
#

Its a niche language imo

#

I don't see it being used in discord programming

jade jolt
#

eh i like it

hasty iron
#

lol roblox

cloud dawn
jade jolt
pliant gulch
patent lark
#

i learned lua about 4 months ago lol, i havent known lua for long. i learned it to make a cheating script for roblox.

pliant gulch
#

😔

#

Not even gonna attempt to make my own in C

slate swan
#

is there a way to put a cooldown on a cooldown? instead of people just being able to spam a command and it saying this command is on cooldown over and overagain

pliant gulch
#

nor CPP

hasty iron
#

cuz bad

pliant gulch
#

bad at lower level langauges

jade jolt
#

low level is fun

hasty iron
#

C sockets are a pain

patent lark
#

well, cooldown on a command ^

cloud dawn
#

I made a mobile application in lua the program i made it in was called "corona" before the outbreak and i made a mario ripoff that could jump infinitely when hitting his head against the underside of the hit box

hasty iron
#

windows and unix have different impls

pliant gulch
#

Yikes imagine C impl for voice

jade jolt
#

but then again, lua doesnt even have string.split

pliant gulch
#

If you want to use lua just use like

#

crystal or something, the syntax is super close

jade jolt
#

funny i have

slate swan
patent lark
#

hosts bot on linux

cloud dawn
#

Right now the only usage for lua is to rip off people playing roblox

jade jolt
cloud dawn
#

😳

hasty iron
#

they’ll start hosting on windows because it’s superior obviously

jade jolt
#

dont you say those words ever again in your life

pliant gulch
#

Why would you host on windows

cloud dawn
#

i really only localhost on windows.

pliant gulch
#

I'd rather not host on windows and have like couple of undiscovered vulnerbilities turn my vps into a bot

jade jolt
#

yuppp

patent lark
#

it makes me cringe to think people use replit to host discord-bots 😢

jade jolt
#

i know :(

cloud dawn
#

if repl.it would ever stop existing this chat's activity would be reduced to 10% of it currents activity.

jade jolt
#

exactly

hasty iron
#

just buy it and shut it down

patent lark
#

you're right, and i hate that you're right

patent lark
jade jolt
#

ill try

slate swan
#

how do i put a cooldown on cooldownerror

cloud dawn
jade jolt
#

smart

patent lark
#

sad sad

cloud dawn
#

Small sacrifice to pay.

#

snow i'd give you 50% of every customer you can bring in.

patent lark
patent lark
cloud dawn
patent lark
hasty iron
#

subclass asyncio.Lock to sleep before releasing and use that

#

you could have a dict of them

patent lark
#

once you offered the profit, i was interested

jade jolt
#

evil

fast hedge
#

heyyy can anyone give me a quick hand with something>

jade jolt
#

what is it

cloud dawn
jade jolt
#

uh

patent lark
#

interesting statement.

fast hedge
#

To put it simply im building a embed command that sets color of banner by key word !BTO. But I want to allow the user to customize the description by typing in discord and not code

fast hedge
jade jolt
#

uhhhh

hasty iron
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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
cloud dawn
#

im in