#discord-bots

1 messages · Page 320 of 1

stone gate
#

yep

final iron
#

Is the slash command hidden in the integrations Ui?

stone gate
#

sorry idk what you mean by that my english isnt the best-

#

its probably a super stupid problem but i am getting really tired-

final iron
#

Cog you’re loading doesn’t match the class name

stone gate
#
async def setup_hook():
    await client.load_extension("commands.db")``` its this, the file is called db.py
#

should i rename it?

glacial topaz
#

Do any of y’all know how to keep a bot online

final iron
final iron
#

!d discord.app_commands.CommandTree.sync

unkempt canyonBOT
#

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

Syncs the application commands to Discord.

This also runs the translator to get the translated strings necessary for feeding back into Discord.

This must be called for the application commands to show up.
final iron
#

Look at the return type

stone gate
#

and how should i use it? sorry- i am really better with like, an example that applies to my situation-

final iron
#

!d discord.app_commands.AppCommand.name

unkempt canyonBOT
stone gate
#

so something like, for command in app_commands (or smth like that)
print(name)?

final iron
#

It’s just a very simple loop

#

name is an attribute

stone gate
#

i still dont understand ;;;;

#

sorry;;;;

#
async def setup_hook():
    await client.load_extension("commands.test")
    for command in client.app_commands:
        print(command.name)``` like this?;;;
#

i just need to know where i should loop and how, its really hard for me to understand things like that without doing it successfully first

glacial topaz
#

So I’m asking if there’s any like trusted cloud hosting providers or is there another way to keep it online

turbid condor
#

just look use the command !hosting

glacial topaz
#

!hosting

unkempt canyonBOT
#
Discord Bot Hosting

Using free hosting options like repl.it or Heroku for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.

See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.

You may also use #965291480992321536 to discuss different discord bot hosting options.

stone gate
#

Ah no i was just dumb and moved it

#
async def sync(ctx):    
    await client.tree.sync()
    print('[Bot] Commands synced successfully')
    for command in client.commands:
        print(command.name)```
#

thats how it looks now (i had the app_commands but i got an error saying "discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'app_commands")

patent lark
#

Hello.

#

Could someone give me an example of how i would use discord.CategoryChannel.edit() whilst specifying overwrites parameter?

#

Im a bit confused on how it works

#

@sick birch?

final iron
#

it returns a list of AppCommands

stone gate
#

AH I THINK I GOT IT

#
``` should i be getting this?
#

it says that mejora IS getting synced-

#

but in the list it isnt there?

#

@final iron (forgot to reply)

final iron
#

click manage on your bot

#

then click on the command and show a screenshot

final iron
#

If you actually type in the command in the chat does it come up? Instead of clicking on the bot

#

Also check if it shows in direct messages

stone gate
final iron
#

Are you sure the code you're running is the code you're showing?

#

Did you save etc.

stone gate
#

yeah

#

i ctrl+s every like every 5 seconds

#

i been just closing VSC every once in a while

#

and i make sure its the right one-

final iron
#

No clue then

#

I'd post in the discord.py server as you'll most likely be able to fix it

stone gate
#

i... closed and opened discord and now its there...

#

4 hours for this

#

thanks for the help anyways, and sorry for being so dumb about it

rotund flame
shrewd apex
stone gate
shrewd apex
#

hmm ok ig upto personal preference

vale wing
slate swan
#

Lol

winter token
#

!paste

low hearth
#

can i choose from my buttons class which buttons i wanna use?

#

or only create new class

vale wing
low hearth
#

or example of instance

#

@vale wing

gleaming inlet
#

I wanted to start building a discord bot on replit but when I test run it, it errored out. I think Discord blocks replit. Is there another cloud hosted editor that I can quickly touch code and run? Not something I want running 24/7. Just an on/off kinda development.

vale wing
vale wing
#

Y do you even need cloud

gleaming inlet
#

I switch machines

vale wing
gleaming inlet
low hearth
#

can i find message in channel by embeds?

hybrid light
#

How should I access owner id?

vocal snow
hybrid light
shrewd fjord
hybrid light
#

So how can I give access to the command only to the person who created the channel?

rugged shadow
#

if your bot created the channel for example

#

otherwise you might just have to listen for channel creates and record those

slate swan
#

hello guys, i've started trying to learn how to code Discord Bot and recently when i'm running it, it just doesn't execute any of my command
I haven't touched anything and the last time i used it it was working, the events are still working and when i'm looking at the logs in my console there's nothing and I was wondering if you guys could help ? MikoDogeza

slate swan
#

yessir

slate swan
# golden portal show code
import discord
import config

from discord import Member
from discord.ext.commands import has_permissions, MissingPermissions
from discord.ext import commands
from discord import FFmpegPCMAudio

intents = discord.Intents.all()
client = client = commands.Bot(command_prefix="!", intents = intents)

@client.event
async def on_ready():
    print("*****************************************")
    print('{0.user} est opérationelle'.format(client))
    print("*****************************************")

@client.event
async def on_member_join(member):
    channel = client.get_channel(1067144368839983226)
    await channel.send("Bienvenue !")
    print("new member")

@client.command()
async def hello(ctx):
    await ctx.send("Hello I'm {0.user}".format(client))
    print("message send")

async def join(ctx):

    if ctx.author.voice:
        channel = ctx.message.author.voice.channel
        await channel.connect()

    else:
        await ctx.send("you aren't in a voice channel")

@client.command(pass_context = True)
async def leave(ctx):

    if ctx.voice_client:
        await ctx.guild.voice_client.disconnect()
        await ctx.send("Bye Bye ! :wave:")

    else :
        await ctx.send("i'm not currently in a voice chat")

@client.event
async def on_message(message):
    if message.content == "feur":
        await message.delete()
        await message.channel.send("do not send that")
        print(message)



@client.command()
@has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member,reason=None):
    await member.kick(reason=reason)
    await ctx.send(f'{member} has been kicked \nReason : {reason}')

@kick.error
async def kick_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You don't have the permissions")

@client.command()
@has_permissions(ban_members=True)
async def ban(ctx, member: discord.Member,reason=None):
    await member.kick(reason=reason)
    await ctx.send(f'{member} has been banned \nReason : {reason}')

@ban.error
async def ban_error(ctx, error):
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("You don't have the permissions")

client.run(config.TOKEN)
golden portal
#

should've pasted it in a pastebin service but it's fine

slate swan
#

yeah sorry OguriAnnoyed

slate swan
#

alright thank you i'll try to fix it

golden portal
#

welcome

slate swan
spark nimbus
glad cradle
#

or pip show discord.py

fiery girder
#

i am getting some wierd commandinvokeerror on my code

#

i dont know what i should do or what its suppose to mean

#

the code of the command

#

it dont work on app commands and it gives error in the prefix command

daring ravine
#

i have a problem i want to add message.content.includes or startswith but the problem it says py 'str' object has no attribute 'content'
this is my code

import discord
import responses

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():
    TOKEN = 'removed for discord purposes'
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)

    @client.event
    async def on_ready():
        print(f'{client.user} is now running!')


    @client.event
    async def on_message(message):
        if message.author == client.user:
            return  
        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.run(TOKEN)
#
import random
import time
def handle_response(message) -> str:
    clock = time.time


    p_message = message.lower()

    if p_message == 'اهلا':
        return 'هلا يالطيب!'
    
    if p_message == 'عشوائي':
        return str(random.randint(1,6))
    
    if p_message == "help":
        return "مرحبًا، لقد دخلت إلى قسم المساعدة، يرجى انتضار فريق المساعدة للوصول اليك، حظًا سعيدًا"
    
    if p_message == "كيف الحال":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك؟":
       return "الحمد لله طيب" 
    
    if p_message == "حسراتن لمايس":
        return "Chatteru من عبالله RUBY / LEXIAN/ SKERCRO/ RUBIAN و خالد Nag3ah/ Oklonz"
    
    if message.content.startswith('!') & p_message == 'time':
        return 'the time is'```
#

second one is the responses code

#

look at the last code, .content.startswith('!') and content.includes all dont work

#

please help ive had this problem since yesterday and i wasnt able to fix it

#

can someone help

naive briar
naive briar
#

!traceback

unkempt canyonBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

daring ravine
#

theres no trace back

#

litteraly just says str object has no attribute 'content'

#
Chaterru#5501 is now running!
lexarubian said; d" كوماند-بوت
'str' object has no attribute 'content'```
#

this is everything in my console

#

/terminal

naive briar
#

Then it'd be difficult to find where the error occurred 🫠

daring ravine
#
   if message.content.startswith('!') & p_message == 'time':
        return 'the time is'```
naive briar
#

Do you have any error handler that's just printing out the error?

daring ravine
#

here i type message.content.startswith('!') when i remove that everything works it does say 'str' object has no attribute 'content'

#

its in that line and im 100% sure it is

naive briar
#

This is why we type hint things shrug

daring ravine
#

what?

naive briar
#

It looks like you're passing a string into the user_message argument of the function send_message, which in turn, is passing the string to the message argument of the handle_response function

daring ravine
#

look im a begginer i dont really fully undertsand what you just said, but i just want to know what can i modify to make it work

naive briar
#

Which part did you not understand?

fiery girder
daring ravine
#

it looks like you're passing a string into the user_message i dont understand how on earth can you pass a string on a user message and what can i do to modify that nonsense

fiery girder
#
@bot.commands
async def time(ctx):
   ctx.reply(time)
daring ravine
fiery girder
#

the thing you are doing is inefficient async def commands are the thing you should do

daring ravine
naive briar
daring ravine
fiery girder
#

first do

bot = discord.ext.commands.Bot()
bot.intents = discord.Intents.all()
bot.command_prefix = "!"
daring ravine
#

okay wait

naive briar
#

Don't

daring ravine
#

why?

fiery girder
#

are you gonna say to setup app commadns?

naive briar
#

intents argument of the commands.Bot is required, you're not passing any into it in that codeblock

#

command_prefix also

daring ravine
#

ok guys im confused as hell

fiery girder
#

oh i didnt do the code block thingy

#

i havent made normal command in months

naive briar
#

Then where did it come from?

fiery girder
#
bot = discord.ext.commands.Bot(intents = discord.Intents.all(),command_prefix = "!")
#

here you go

fiery girder
naive briar
#

No, you'd get

AttributeError: module 'discord' has no attribute 'ext'

From that thing

fiery girder
#
from discord.ext import commands
bot = commands.Bot(intents = discord.Intents.all(),command_prefix = "!")
#

happy now?

naive briar
#

Good

fiery girder
#

i havent made normal commands in months i am sticking to the hybrid commands

fiery girder
daring ravine
#

okay wait

naive briar
daring ravine
naive briar
#

If you're using a sane library like discord.py, anyway

daring ravine
#

but how does it know which command i want to use

#

i have !help !errors !time so how will it knoiw

fiery girder
fiery girder
naive briar
daring ravine
#

how do i even register it?

fiery girder
#

@native granite

#

it tagged someone lol

naive briar
#

I'll send the official example

fiery girder
#
@bot.command()
async def roll(ctx, dice: str):
    """Rolls a dice in NdN format."""
    try:
        rolls, limit = map(int, dice.split('d'))
    except Exception:
        await ctx.send('Format has to be in NdN!')
        return

    result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))
    await ctx.send(result)
``` @daring ravine
#

its a bit complicated lemme send you a simple one

naive briar
fiery girder
#
@bot.command(description='For when you wanna settle the score some other way')
async def choose(ctx, *choices: str):
    """Chooses between multiple choices."""
    await ctx.send(random.choice(choices))```
naive briar
#

There's also the docs that goes into more details

patent lark
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

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

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

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
daring ravine
#

okay guys what... i just want , i just want to be able to use content.include i dont want all this stuff can i please just get what should i do and edit to be able to use content thats all i dont want any "better" ways i just want content to be useable, im a begginer, really small beginner so everything your typing is gibbresh to me if i ever want to edit it i cant because its way too complicated for me , if yall can just say how i can use content or just stop helping me because i WILL waste your time because i wouldnt understand a thing and i will just waste you're time asking and asking and over and over again, please i just need that or you dont have to help me i dont want to waste anyones time

patent lark
daring ravine
#
    import random
import time
def handle_response(message) -> str:
    clock = time.time


    p_message = message.lower()

    if p_message == 'اهلا':
        return 'هلا يالطيب!'
    
    if p_message == 'عشوائي':
        return str(random.randint(1,6))
    
    if p_message == "help":
        return "مرحبًا، لقد دخلت إلى قسم المساعدة، يرجى انتضار فريق المساعدة للوصول اليك، حظًا سعيدًا"
    
    if p_message == "كيف الحال":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك؟":
       return "الحمد لله طيب" 
    
    if p_message == "حسراتن لمايس":
        return "Chatteru من عبالله RUBY / LEXIAN/ SKERCRO/ RUBIAN و خالد Nag3ah/ Oklonz"
    
    if message.content.startswith('!') & p_message == 'time':
        return 'the time is'```
#

this is my respone code

#

see the last two lines
they dont work i get a error saying

'str' object does not have a attribute 'content'```
patent lark
#

yes

daring ravine
#
import discord
import responses

from discord.ext import commands
bot = commands.Bot(intents = discord.Intents.all(),command_prefix = "!")

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():
    TOKEN = 'safteyreasons'
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)

    @client.event
    async def on_ready():
        print(f'{client.user} is now running!')


    @client.event
    async def on_message(message):
        if message.author == client.user:
            return  
        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.run(TOKEN)
patent lark
#

because message is a string in this case

daring ravine
#

this is my bot code

patent lark
#

so message is not returning a discord.Message

daring ravine
#

okay so how do i make it return a discord.Message

patent lark
#

if you want to use the .content() attribute, you must be sure this main class has this attribute

naive briar
patent lark
#

So typing message to discord.Message

daring ravine
patent lark
#

typehint **

daring ravine
#

does this work

import discord
import random
import time
def handle_response(message) -> str:
    clock = time.time


    p_message = discord.Message.lower()

    if p_message == 'اهلا':
        return 'هلا يالطيب!'
    
    if p_message == 'عشوائي':
        return str(random.randint(1,6))
    
    if p_message == "help":
        return "مرحبًا، لقد دخلت إلى قسم المساعدة، يرجى انتضار فريق المساعدة للوصول اليك، حظًا سعيدًا"
    
    if p_message == "كيف الحال":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك":
       return "الحمد لله طيب" 
    
    if p_message == "كيف حالك؟":
       return "الحمد لله طيب" 
    
    if p_message == "حسراتن لمايس":
        return "Chatteru من عبالله RUBY / LEXIAN/ SKERCRO/ RUBIAN و خالد Nag3ah/ Oklonz"
    
    if message.content.startswith('!') & p_message == 'time':
        return 'the time is'```
patent lark
#

message: discord.Message

daring ravine
#

look at the 7th line

#

is that all i had to do?

patent lark
#

I’m on mobile so this looks confusing, let me hop on my computer

daring ravine
#

okay

naive briar
daring ravine
naive briar
#

What

patent lark
#

.content is coming from discord.Message

#

!d discord.Message.content

unkempt canyonBOT
daring ravine
#

i removed .content and now it says
unsupported operand type(s) for &: 'bool' and 'str'

patent lark
patent lark
#

Because message is a string in your case

naive briar
#

& doesn't do the thing you might think it does

daring ravine
#

how ,on earth do i make it not a strinng please

naive briar
#

!d and

unkempt canyonBOT
#
and

6.11. Boolean operations


or_test  ::=  and_test | or_test "or" and_test
and_test ::=  not_test | and_test "and" not_test
not_test ::=  comparison | "not" not_test
``` In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: `False`, `None`, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true. User-defined objects can customize their truth value by providing a [`__bool__()`](https://docs.python.org/3/reference/datamodel.html#object.__bool__) method.

The operator [`not`](https://docs.python.org/3/reference/expressions.html#not) yields `True` if its argument is false, `False` otherwise.
daring ravine
#

ohh

#

well i used to code c# and it used &&

#

heh

#

i removed and

#

now i ahve this code

   if p_message.startswith('!'):
        return 'the time is'```
#

its not working

#

i said !hi but it didnt work

patent lark
#

i don’t understand a lot of this

twilit grotto
twilit grotto
#

yeah ik lol

daring ravine
#

i dont understand

patent lark
#

where do you even call handle_response

twilit grotto
#
message: discord.Message
naive briar
daring ravine
#

no i switched that back to

#
p_message = message.lower()
patent lark
#

def handle_response(message: discord.Message):

naive briar
#

Please note that you need some OOP knowledge to use discord.py comfortably

naive briar
#

And what's the current problem?

patent lark
#

you still need to typehint

#

message

#

parameter

#

to discord.Message

daring ravine
#

wait let me google typehint real quick

naive briar
#

Type hints will not make any difference

patent lark
patent lark
daring ravine
#

oh ok but where do i put it?

patent lark
#

Bro.

naive briar
patent lark
daring ravine
#

i swear to god im not a troll im just a beginner okay

naive briar
#

It's just there to tell the viewers what type an argument is, or occasionally, for the library to parse it for its process

naive briar
twilit grotto
patent lark
#

Yes

twilit grotto
patent lark
#

Yes ^^^

naive briar
patent lark
#

He’s trying to use .content

patent lark
twilit grotto
#

no he's passing the message from on_message event

patent lark
#

so he needs to typehint his message parameter to discord.Message

daring ravine
#

guys i dont want it to be a string if its not what i should use then idont want it to be a string, how the hell do i not make it a string ive asked like 3 times and didnt get a single clear answer

patent lark
naive briar
#

They're casting it into a string before passing it to the function

twilit grotto
#

oh i didn't see that i thought we were talking about the first argument

low hearth
#

anyone knows can i add file attach in my modal?

#

or only text info?

glad cradle
#

but if you require attachments from your users then you can do that in an app_command type hinting a parameter with discord.Attachment

slate swan
#

hi guys...

cloud dawn
#

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

slate swan
#

hol on

cloud dawn
#

Please use the paste service to not flood the chat.

slate swan
#

yes

#

ofcourse

slate swan
cloud dawn
#

So from my understanding you send the command -> User sends message with attachment -> If file name ends with .mp3 or .wav send info else ...

slate swan
#

i had problems with my commands who weren't working and didn't print anything so thanks to the doc someone sent me i guess i had to use the sync() function but i didn't really understand how to use it, can someone please explain to me ?

here is the code : https://paste.pythondiscord.com/WA2Q

final iron
#

client = client = commands.Bot

#

You only need 1 declaration

slate swan
#

alright chef

digital sleet
#

does anyone know why this doesnt work?

#

import nextcord
from nextcord import Permissions
from nextcord.ext import commands
import sqlite3
import re

class BoostNotify(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.Cog.listener()
    async def on_member_update(self, before, after):
        if not before.premium_since and after.premium_since:
            # User has started boosting the server
            print(f"{after.display_name} has boosted the server! Yer")

def setup(bot):
    bot.add_cog(BoostNotify(bot))```
patent lark
#

Yeah

#

Looks like the code is outdated

#

In the newer versions, your setup and extension loading must be asynchronous

#

Oh this is nextcord

glad cradle
#

nah

For questions and discussions ... Discord.py and other relevant Python libraries.

glad cradle
digital sleet
#

its like it just ignores it but i verified the cog loads with a print statement

glad cradle
#

in the if

digital sleet
# glad cradle in the if

idk i just assumed thats bes way to do it but it doesnt owrk.
I want it to check if a user boosts the server it will send a print statement

glad cradle
#

wait how are you testing that?

digital sleet
#

ive got 4 accounts all with nitro so i have another 6 boosts

glad cradle
#

add a print outside the if to check if the event is dispatched at all for that change on the member object

digital sleet
#

for debugging purposes

#

but this, i literally cannot get to function at all

glad cradle
fading marlin
#

Do you have the members intent enabled?

digital sleet
#

i just got it chuck an error

Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\nextcord\client.py", line 490, in _run_event
    await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
TypeError: BoostNotify.on_message() takes 1 positional argument but 2 were given
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\site-packages\nextcord\client.py", line 490, in _run_event
    await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
TypeError: BoostNotify.on_message() takes 1 positional argument but 2 were given```

```py
    @commands.Cog.listener()
    async def on_message(message):
        if message.type == nextcord.MessageType.premium_guild_subscription:
            print("test")```
#

nvm got it to work

glad cradle
glad cradle
digital sleet
rotund flame
#

😭 nextcord

slate swan
dim wing
#

it's been a couple of month (years maybe) i haven't coding with discordpy... So discordpy isn't dead??

patent lark
#

For a very long time at least.

hushed galleon
# patent lark I doubt discord.py will die.

well when danny left in 2021 due to his frustrations with discord's decisions, they didnt have a maintainer willing to continue developing discord.py so it stayed in limbo for six months, only until danny came back to try consolidating the python discord bot community

patent lark
#

That was a sad time

#

I contributed to pycord for a while.

#

Im glad d.py came back.

hushed galleon
#

has he appointed someone to take over the repository if he has to leave again? or will it "live on" in the form of more unofficial forks?

patent lark
uneven hearth
#

Has discord implemented a dropdown menu inside modals already?

hushed galleon
#

as sent last month by someone in the discord developers server (allegedly):

it's been suggested ever since they were added, they said it was coming, half built it for the pc version but stopped development due to mobile issues, then they abandoned it from the looks of it and right now it's still a suggestion

vapid parcel
#

Docs for Banners.

#

to get a users banner.

#
    @commands.hybrid_command(name="avatar")
    @commands.guild_only()
    async def avatar(self, ctx, member: discord.Member = None, type: AvatarChoices = AvatarChoices.display):
        """Shows your avatar or the mentioned member's avatar!"""
        if not member:
            member = ctx.author

        if type == AvatarChoices.display:
            avatar_url = member.display_avatar.url if member.display_avatar else member.default_avatar.url
        else:
            avatar_url = member.avatar.url

        embed = discord.Embed(
            title=f"{member.display_name}'s Avatar",
            color=main_color
        )

        embed.set_image(url=avatar_url)

        await ctx.send(embed=embed)```


This is for avatar, but wanna do one for banners, i just need the docs.
hushed galleon
unkempt canyonBOT
#

property banner```
Returns the user’s banner asset, if available.

New in version 2.0.

Note

This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.fetch_user).
hushed galleon
#

i didnt realize the discord api provided banners, thought it'd be locked from bots like the about me

vapid parcel
winter hare
#

why do i get this error and how do i fixt it

  File "c:\Users\trace\Desktop\chicken chicken\chicken wing\ticket.py", line 155, in setup
    await client.add_view(TicketView(client))
TypeError: object NoneType can't be used in 'await' expression```
```py
class TicketView(discord.ui.View):
    def __init__(self, client:commands.Bot):
        super().__init__(timeout=None)
        self.client = client

    @button(label="Close Ticket", style=discord.ButtonStyle.primary,custom_id="close_ticket")
    async def close_ticket(self, button: discord.ui.Button, interaction: discord.Interaction):
        
        await interaction.response.send_message(view=confirm())


async def setup(client:commands.Bot):
    await client.add_view(TicketView(client))```
hushed galleon
#

you dont need to await add_view()

#

adding a view only has to tell pycord what functions it should call when it receives a component interaction, which internally is done by adding a few dictionary keys, so it doesn't need to make any API calls or whatnot

winter hare
#

im not using pycord but i see what u mean thanks

hushed galleon
#

oh i assumed pycord given the discord import and (button, interaction) parameter order

kindred epoch
#

where can i host a personal bot for free?

patent lark
#

Depends on how efficient you want it to be.

#

A free hoster won't likely be a good option it terms of effiency.

kindred epoch
patent lark
#

Not much?

#

to replit you go

#

😂

final iron
kindred epoch
sick birch
final iron
#

I dunno maybe

#

Haven’t really looked into it

#

If Oracle is a no go then Digital Ocean with GitHub credits ig

patent lark
#

Discord.py version is latest version, python is latest version

shrewd fjord
patent lark
#

I fixed it now, had to forcereinstall

vale wing
patent lark
#
def check_dependencies():
    assert pycord_version == "2.5.4", (
        "you don't have necessary version of Pycord."
        " Please install the version specified in requirements.txt"
    )

    flags = subprocess.CREATE_NO_WINDOW if sys.platform == "win64" else 0
    ffmpeg_output = None
    try:
        ffmpeg_output = check_output(
            ("ffmpeg", "-version"), text=True, creationflags=flags
        ).strip()
    except (FileNotFoundError, CalledProcessError) as e:
        if sys.platform == "win64":
            print("Downloading FFmpeg...")
            download_ffmpeg()
        else:
            raise RuntimeError("ffmpeg was not found") from e
    if sys.platform == "win64" and ffmpeg_output:
        ffmpeg_timestamp = extract_ffmpeg_timestamp(ffmpeg_output)
        if ffmpeg_output == OLD_FFMPEG_CONF or (
            ffmpeg_timestamp and ffmpeg_timestamp < NEWEST_FFMPEG_TIMESTAMP
        ):
            print("Updating FFmpeg...")
            download_ffmpeg()

    try:
        opus.Encoder.get_opus_version()
    except opus.OpusNotLoaded as e:
        raise RuntimeError("opus was not found") from e
```   Keeps raising ``RuntimeError("ffmpeg was not found")``

``pip show`` will show output, running ``python -m ffmpeg --version`` returns`` "No module named ffmpeg.__main__; 'ffmpeg' is a package and cannot be directly executed"`` i force reinstalled ffmpeg twice, not sure what to do.
glad cradle
#

i didn't know it was possible to install ffmpeg with pip, in my pc i installed it separately, maybe you can try this

patent lark
#

Alright.

shrewd fjord
glad cradle
#

that's not true btw

#

never had issues with it

vale wing
#

If you use docker you can just install it via dockerfile

burnt vale
#

Hi, im trying to get data from sqlite3 and counting how many rows the table has. how do I do this?

#

Example:
data in table "stocks":
a
b
c
d

#

I want it to count the number of rows it has, for example on top, there's 4 rows

shrewd fjord
shrewd fjord
dim wing
shrewd fjord
naive briar
burnt vale
naive briar
patent lark
burnt vale
#

But my table name is shop and column is stock

#

I want to count the lines in stock

shrewd apex
#

sup

robust fulcrum
#

Hi

fiery girder
#
023-11-09 09:47:41 ERROR    discord.client Ignoring exception in on_command_error
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/container/main.py", line 288, in on_command_error
    await ctx.reply(
  File "/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/context.py", line 741, in reply
    return await self.send(content, reference=self.message, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/context.py", line 1024, in send
    return await super().send(
           ^^^^^^^^^^^^^^^^^^^
  File "/home/container/.local/lib/python3.11/site-packages/discord/abc.py", line 1561, in send
    data = await state.http.send_message(channel.id, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/container/.local/lib/python3.11/site-packages/discord/http.py", line 681, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.

idk how i am exeding in rate limit my bot is litrelly idle

fiery girder
#

no

#

i have set it up on solarhosting

fiery girder
shrewd fjord
#

Its just maybe solarhosting uses shared ip like replit too?

fiery girder
#

maybe cause i have seen it blocked many times

#

it should be rate limit per bot not per ip

shrewd fjord
#

Hm dead

#

Well technically yes, but you sometime get blocked by cloudfare

#

And will be unable to use the API

fiery girder
#

my hosting is blocked by cloudfare multiple times

shrewd fjord
#

Then no luck 💀

fiery girder
#

but this is the only best fre hosting with no coins and shit and 1gb ram and 80% cpu there is no better

shrewd fjord
#

Check if solarhosting has kill 1 cmd like replit xd

fiery girder
#

nope did nothing

shrewd fjord
#

Rip

#

Turn the bot off, wait some like 30 mins or so

fiery girder
#

well i am tired ill go each lunch bye

fiery girder
#

bye

burnt vale
#

Hi @shrewd fjord

#

Why can’t I split the string?

naive briar
#

\ isn't the same as /

glad cradle
#

uwu

naive briar
lyric owl
#

Alright

naive briar
#

Yummy free role

shrewd fjord
#

Me only uwu guy here

sinful trench
#

hey i need help

#

how to make active bot forever ?

turbid condor
#

Host it

#

Check !hosting command for more info

thin raft
#

what's the type of connection discord bots and discord use? sockets?

#

i have no idea what to search on google

shrewd fjord
#

Yes

glad cradle
# thin raft what's the type of connection discord bots and discord use? sockets?

Discord's API is based around two core layers, a HTTPS/REST API for general operations, and persistent secure WebSocket based connection for sending and subscribing to real-time events.

https://discord.com/developers/docs/reference#api-reference

Discord Developer Portal

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

shrewd fjord
glad cradle
shrewd fjord
slate swan
#

Or just

Get webhook notifications whenever Discord creates an incident, updates an incident, resolves an incident or changes a component status.

shrewd fjord
#

Need to scrape manually anyway think

glad cradle
#

didn't knew about this until 1 min ago

vale wing
glad cradle
#

400ms

vale wing
#

Host is in austria with 1gbps speed

glad cradle
#

did you transfer it?

vale wing
#

No cause I got old price which is cheaper

glad cradle
#

still i don't face 270ms with my local instance

vale wing
#

If they ever decide to update price I will transfer to USA

glad cradle
#

uwu

slate swan
#

!hosting

unkempt canyonBOT
#
Discord Bot Hosting

Using free hosting options like repl.it or Heroku for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.

See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.

You may also use #965291480992321536 to discuss different discord bot hosting options.

shrewd fjord
shrewd fjord
stark nexus
#

I was making a leaderboard fuction for my minigame bot
It worked pretty well

#

But i want let it have pages
So i edit the code to this

@client.hybrid_command(description='Show score leaderboard') 
async def leaderboard(ctx):

    leaderboard = db.score.find().sort("score", pymongo.DESCENDING)

    paginator = commands.Paginator()

    for user in leaderboard:

        paginator.add_line(f'{user["user"]} - {user["score"]} points')

    for page in paginator.pages:

        embed = discord.Embed(title='Tableturf top players ![Tableturf](https://cdn.discordapp.com/emojis/1171831352136564777.webp?size=128 "Tableturf")', description=page,         color=0x2B32E4)
        await ctx.send(embed=embed)```
#

Why result is this?

shrewd fjord
stark nexus
#

Showing like in pages

#

Have buttons and can change pages

stark nexus
shrewd fjord
#

I dont think this is how commands.Paginator works ig, meh not sure never used this class 💀 better to create own

#

I think your leaderboard has 3 users only

#

!d discord.ext.commands.Paginator

unkempt canyonBOT
#

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

len(x) Returns the total number of characters in the paginator.
shrewd fjord
#

Are you sure add_line creates a page everytime?

kind roost
#

help me

shrewd fjord
kind roost
#

?

robust fulcrum
fiery girder
#

how do i make my bot perform a task every day

#

like i want a function to be active once every day

shrewd fjord
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

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

pass a datetime obj or something forgor in time=...

slate swan
#

Can I use pygame and turtle with dpy ?

glad cradle
#

the what

#

they are synchronous so they would Block the Bot's event loop

#

!blocking

unkempt canyonBOT
#
Asynchronous programming

Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.

What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:

import discord

# Bunch of bot code

async def ping(ctx):
    await ctx.send("Pong!")

What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.

async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!

glad cradle
#

but if you find a way to run them without Block the event loop then sure ig

gentle epoch
#

this is a nice spot

final iron
sharp bay
#
import discord
from discord.ext import commands

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

@client.event
async def on_ready():
    print("Bot is ready!")
    print("-------------")

@client.command()
async def on_message():
    if message.author == client.user:
        return
    
    if message.content.startswith('hi'):
        await message.channel.send('Hello!')

client.run('')```
"NameError: name 'Intents' is not defined" what does it mean and how to fix
final iron
#

This is basic Python

sharp bay
final iron
#

This’ll error out anyway

#

!resources

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.

final iron
#

I’d probably start with the fundamentals, then move over to intermediate libraries

sharp bay
#

but it doesnt reply to messages

final iron
#

Show your current code

static holly
#

hi, discord is buggy actualy?

#

i have no idea why my contextual menu is not loaded in discord app...

#

i dont have any error, and the debug command return all cog loaded

sharp bay
slate swan
final iron
#

Unless you’re using it for self botting it is

final iron
final iron
static holly
final iron
#

What library version, and python version

final iron
#

Were they working before and just stopped, or did you just add them

#

Your original message infers that they just randomly broke

static holly
#

@final iron no it doesn't work since I coded these features from the beginning

upbeat blade
#

How do i make slash commands? I can’t seem to figure it out.

#

Help is much appreciated.

slate swan
upbeat blade
#

The gist doesn’t work, invalid link.

slate swan
#

@final iron how do i print a message?!!?!?

final iron
slate swan
final iron
#

What

#

Is it an application command, event, prefixed command

#

I’m going to need more information than that

#

Also what do you mean by “a message”? The message content?

slate swan
#

print (aaaa)

final iron
#

I know what print is

slate swan
#

Wow.

final iron
#

???

slate swan
# final iron ???

what does this code do

import asyncio


class UppercaseMeta(type):
    def __new__(cls, name, bases, dct):
        uppercase_dct = {key.upper(): value for key, value in dct.items() if callable(value)}
        return super(UppercaseMeta, cls).__new__(cls, name, bases, uppercase_dct)


class MyClass(metaclass=UppercaseMeta):
    async def async_method(self):
        await asyncio.sleep(1)
        print("Async Method")


obj = MyClass()


def log_execution_time(func):
    async def wrapper(*args, **kwargs):
        import time
        start_time = time.time()
        result = await func(*args, **kwargs)
        end_time = time.time()
        print(f"Execution time: {end_time - start_time} seconds")
        return result
    return wrapper


obj.async_method = log_execution_time(obj.async_method)


async def main():
    await obj.async_method()

# Run the event loop
asyncio.run(main())```
final iron
#

I mean the function name is very telling. It’s for logging execution time

slate swan
upbeat blade
#

Timeout commands so difficult 😭😭💀💀

sick birch
golden portal
#

me when await member.timeout(datetime.timedelta(days=1))

sick birch
#

exactly

#

Saves you from the hassle of worrying about un-timeing out on time, handling disconnects, bot going complete offline, etc

upbeat blade
#

im new to python.

#

my bad.

sick birch
#

no prob. are you using the built in timeout feature?

sick birch
#

ah, might be why

naive briar
ashen locust
#

when i do " pip install discord.py" or install disnake it gives me the error

Could not build wheels for aiohttp, frozenlist, multidict, yarl, which is required to install pyproject.toml-based projects

then it tells me to install Microsoft Visual C++ 14.0 or greater which I already have but it still doesnt work.

naive briar
#

yarl (a dependency of aiohttp (a dependency of discord.py)) doesn't support Python 3.12 yet

ashen locust
#

oh ok thanks

#

3.11 works?

naive briar
#

Yes

ashen locust
#

thanks

#

also is discord.py discontinued so will i have to use some fork of it or no?

#

nvm

shrewd fjord
ashen locust
#

oh ok thanks

icy night
#

can someone help me with bot? pls

#

i need to write bot that will disconnect a specific user from voice channel on server

patent lark
icy night
# patent lark Send your current code and we can help you.

import discord
from discord.ext import commands

Создаем экземпляр бота

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

Указываем ID мембера, которого хотим отключать

member_id = 123456789

Функция, которая проверяет все голосовые каналы на сервере

async def check_voice_channels():
# Получаем список всех голосовых каналов на сервере
voice_channels = bot.get_guild(987654321).voice_channels
# Перебираем все каналы
for channel in voice_channels:
# Получаем список всех мемберов в канале
members = channel.members
# Перебираем всех мемберов
for member in members:
# Если мембер совпадает с указанным ID
if member.id == member_id:
# Отключаем его от канала
await member.move_to(None)
# Выводим сообщение в консоль
print(f'Отключил {member.name} от {channel.name}')

Команда, которая запускает проверку голосовых каналов

@bot.command()
async def check(ctx):
# Вызываем функцию проверки
await check_voice_channels()
# Отправляем сообщение в чат
await ctx.send('Проверил все голосовые каналы.')

Запускаем бота с токеном

bot.run('TOKEN')

#here description on russian but you will understand

patent lark
#

member.move_to(None) should disconnect the user

icy night
#

yeah

patent lark
#

Can you show me your error.

icy night
#

i not tried to boot them yet

#

for now

patent lark
#

Then why are you asking for help.

icy night
#

sry, i wanned to code review, not fix(for now)

#

is there misstakes?

patent lark
#

Um. There are some parts of the code that are unnecessary.

#

But i guess it should work.

icy night
#

k, thx

covert trellis
#

Hi, I have a question about discord messages scrapper
Is it possible to create this without using discord API?

brazen raft
#

I think it's against the terms of service to gather server/user information without their consent, and at that point just use a client, but it will probably not be a good scraper

slate swan
uneven hearth
#

Can someone help me please?
I'm trying to bring as a default input the variable that has been received from the building function but I keep getting this annoying limit.
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components: Must be between 1 and 5 in length.

This is my code:

class EditEmbed(ui.Modal):
    def __init__(self, embed_title):
        super().__init__(title="Edit Embed", timeout=None, custom_id="edit embed")
        self.embed_title = embed_title

        self.embed_title_input = ui.TextInput(label="Title", style=discord.TextStyle.short, placeholder="Insert Title", required=True, max_length=100, custom_id="title", default=embed_title)
naive briar
uneven hearth
naive briar
#

If you did it the same way as the example do, you can just access it from self since they are class variables

#

!e

class A:
    var = 0
    def something(self):
        print(var)

A().something()
unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 6, in <module>
003 |     A().something()
004 |   File "/home/main.py", line 4, in something
005 |     print(var)
006 |           ^^^
007 | NameError: name 'var' is not defined. Did you mean: 'self.var'?
naive briar
#

Good explanation

uneven hearth
#

Yep, but you're doing it with a function

#

So you're basically saying I need to create a function that will include all the inputs?

naive briar
#

No?

uneven hearth
#

So..?

naive briar
#

So what?

uneven hearth
#

I'm incapable of using the self

naive briar
#

I don't understand what that means

uneven hearth
#

Thus I don't understand how to solve this

naive briar
uneven hearth
#

Like here

naive briar
#

That example isn't using any function to create any either

#

It's setting the name and feedback text inputs as the class variables

#

Or am I misunderstanding something

uneven hearth
#

Aren't they being inserted into the modal as text inputs?

#

As name and feedback

naive briar
#

Yes? But they're also being set as class variables, that's how discord.py get them

uneven hearth
#

Yes I know

#

Sooo what are you suggesting to do

#

That's the code

naive briar
#

Just set your text inputs as class variables, instead of setting them as just attributes that discord.py won't recognise

uneven hearth
#

I did it

final iron
uneven hearth
#

Because it gives me
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components: Must be between 1 and 5 in length

final iron
#

Are you adding them?

uneven hearth
#

Mhm

#

You mean by this way right?

final iron
#

Show it

#

That is not what I meant

uneven hearth
final iron
#

!d discord.ui.Modal.add_item

unkempt canyonBOT
#

add_item(item)```
Adds an item to the view.

This function returns the class instance to allow for fluent-style chaining.
final iron
#

If you’re doing it in the init you need to add them with this

naive briar
#

If you don't need to set TextInputs dynamically, you're just making life harder for nothing this way

uneven hearth
#

Thanks I figured it out

robust fulcrum
brazen raft
#

One of its dependencies has a beta release for 3.12

robust fulcrum
#

aiohttp?

brazen raft
#

Ye

robust fulcrum
#

will other deps work?

brazen raft
#

I haven't encountered errors from other dependencies for 3.12

robust fulcrum
#

kk'

#

ty

brazen raft
#

👍

fiery girder
#

can you make hybrid commands with cogs?

#

i tried but it giving error

#
  File "d:\Projects\Python\FedxD PlayPal\main.py", line 27, in <module>
    import handlers
  File "d:\Projects\Python\FedxD PlayPal\handlers\__init__.py", line 2, in <module>
    from handlers import setup
  File "d:\Projects\Python\FedxD PlayPal\handlers\setup.py", line 32, in <module>
    class Setup(Cog):
  File "d:\Projects\Python\FedxD PlayPal\handlers\setup.py", line 35, in Setup
    @commands.hybrid_command(name="setup", description="Setup The Bot")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\abbas\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\hybrid.py", line 893, in decorator
    return HybridCommand(func, name=name, with_app_command=with_app_command, **attrs)  # type: ignore  # ???

  File "C:\Users\abbas\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\hybrid.py", line 503, in __init__
    super().__init__(func, **kwargs)
  File "C:\Users\abbas\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 406, in __init__
    self.callback = func
    ^^^^^^^^^^^^^
  File "C:\Users\abbas\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 513, in callback
    self.params: Dict[str, Parameter] = get_signature_parameters(function, globalns)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\abbas\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 130, in get_signature_parameters
    raise TypeError(f'Command signature requires at least {required_params - 1} parameter(s)')
TypeError: Command signature requires at least 1 parameter(s)```
#

the error

#

i got this issue resolved but my hybrid commands wont work it just dont show on the app command but it works on the prefix commands

hushed galleon
#

have you synced your command tree?

fiery girder
#

yes

#

do i have to do it in all cogs?
or just the main file

#

i have it on my main file

fiery girder
hushed galleon
#

you have to load your cogs/extensions first, then sync your tree once

fiery girder
#
async def setup_hook(self):
        await self.tree.sync()
        print(f"Synced slash commands for {self.user}.")
        await self.add_cog(handlers.setup.Setup(self))
        await self.add_cog(handlers.lvlhandler.LevelHandler(self))
        await self.add_cog(handlers.money.Money(self))
        await self.add_cog(handlers.profile.Profile(self))
        print(f"Loaded Cogs for {self.user}.")```
#

this good?

hushed galleon
#

so yeah, put the sync at the end

fiery girder
#

oh ok

#

lemme check

#

it worked

#

thanks

fiery girder
#
@discord.ext.tasks.lopp()
hushed galleon
#

err basically yeah

fiery girder
#

i dont think so they do

hushed galleon
unkempt canyonBOT
#

bot/cogs/reminders.py lines 494 to 495

@tasks.loop(minutes=10)
async def send_reminders(self):```
hushed galleon
#

oh yeah i forgot it was documented

#

what wasn't documented was the fact that it works across multiple instances of one class

#

pretty convenient for refreshing my server statuses

fiery girder
#
@tasks.loop(minutes=1)
    async def interest():
        db.execute("SELECT * FROM tasks WHERE name = ?", ("interest",))
        task = db.fetchone()
        servers = []
        if task is None:
            db.execute("INSERT INTO tasks VALUES (?, ?)", ("interest", 0))
        else:
            if task[1] == 2:
                db.execute("UPDATE tasks SET minutes = ? WHERE name = ?", (0, "interest"))
                db.execute("SELECT * FROM guilds")
                guilds = db.fetchall()
                for guild in guilds:
                    serverdb = sql.connect(f"servers/{guild[0]}.db")
                    server = serverdb.cursor()
                    server.execute("SELECT * FROM profiles")
                    profiles = server.fetchall()
                    servers.append(serverdb)
                    for profile in profiles:
                        bank = profile[2]
                        interest = profile[3]
                        interest = interest / 100
                        interest = interest * bank
                        bank += interest
                        server.execute(
                            "UPDATE profiles SET bank = ? WHERE user_id = ?",
                            (bank, profile[0]),
                        )
                for server in servers:
                    server.commit()
                    server.close()
                print("Bank Interest Updated")
            else:
                db.execute(
                    "UPDATE tasks SET minutes = ? WHERE name = ?", (task[1] + 1, "interest")
                )

        main_db.commit()

i dont think this have worked ever

#

cause else it would create a thing

#

a row in a db

slate swan
#

Debug

fiery girder
#

it didnt even made a db thing idk what is wrong twith this

slate swan
#

As said, debug

fiery girder
#

ok i guess

slate swan
#

Put some logs and check where it's failing or where it's not acting the way you want

hushed galleon
#

if its in a class you need the self parameter, same way you fixed your hybrid command

fiery girder
#

oh

#

i guess that should fix the thing

#

the maindb still dont have the thing entered

#

so i guess its not working

fiery girder
#

its something off with the loop command else is sorted

#

it would atleast print something when it runs which it is not doing

hushed galleon
#

where did you start the loop?

fiery girder
#

in the Cog

#

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

hushed galleon
#

!paste

fiery girder
hushed galleon
#

you uh messed up the indentation, but regardless the loop hadnt been started anywhere

fiery girder
#

it the paste thingy fking the indentation wait lemme fix it

hushed galleon
unkempt canyonBOT
#

bot/cogs/reminders.py line 156

self.send_reminders.start()```
fiery girder
#

do i have to like call the command in the loop?

hushed galleon
#

well if your loop was already running you wouldn't really need to start it again

#

you need to call .start() somewhere outside of it

fiery girder
#

so i just need to call it once

#

oh

#

i can make owner commands to start and stop the loop

hushed galleon
fiery girder
#

oh

robust fulcrum
#

guys can we load an extension from an absolute path?

naive briar
#

If you can import it as a module, sure

robust fulcrum
naive briar
#

No

robust fulcrum
#

hmm, thats a issue

shrewd fjord
#

Demn

robust fulcrum
# naive briar No

i have path issues in relative paths, is there any way i can pass it absolute path?

shrewd fjord
#

Maybe use regex or something or glob

#

It it glob or blob 💀

robust fulcrum
#

glob

robust fulcrum
shrewd fjord
#

Its looking for a module

#

Try adding init.py

#

Not sure what are you trying to do but since catty knows the context he may help u better

robust fulcrum
#

it tf still not worked

#

tbh python is really bad at paths

#

i feel it easy in js

shrewd fjord
#

Its just a skill issue 🤓

#

What are you trying to do anyway

robust fulcrum
robust fulcrum
shrewd fjord
#

Its not like python is "bad at paths" its just you not knowing how to do in python but in js

naive briar
robust fulcrum
#

ye i guess i am wrong

shrewd fjord
robust fulcrum
#

i am lazy to restart my bot everytime

shrewd fjord
#

I would use disnake tbh 💀

naive briar
#

You can reload extensions using bot.reload_extension with a prefix command, maybe vibing

naive briar
#

How and where are you running the bot?

shrewd fjord
robust fulcrum
#

i runnign using
python -m src

naive briar
#

Python might be taking the current working directory when you run python stuff.py

robust fulcrum
#

i tried doing src.extensions.test.ext

naive briar
#

(I don't really know though NPCDryadSmug)

robust fulcrum
#

it not worked

shrewd fjord
#

Sec

robust fulcrum
#

i am confused with what i doing

sick birch
#

you shouldn't have to specify src

robust fulcrum
#

i didn't

#

but still not worked

sick birch
#

Usually I have a src/bot/exts so I can do from bot imports exts or similar

robust fulcrum
#

i fixed it

#

somehow

#

i changed it to
await self.load_extension(".extensions.test.ext")

#

i added "." in front

shrewd fjord
#

Lol wtf i was about to tell it but then catty came in so i just didnt send the message 💀💀💀

naive briar
hushed galleon
robust fulcrum
#

thank you all though

sick birch
#

favor absolute imports if possible

robust fulcrum
#

i again got error

#

discord.ext.commands.errors.ExtensionNotFound: Extension '.extensions.test.ext' could not be loaded.

shrewd fjord
#

Huh more sus

robust fulcrum
#

this is my file struct

hushed galleon
hushed galleon
#

i suggest naming it test_ext.py instead so it can be imported via .extensions.test_ext

shrewd fjord
#

You can use pathlib ig

kind roost
#

help me

sick birch
kind roost
#

@shrewd fjord

kind roost
sick birch
kind roost
#

but its not walking

#

@sick birch

sick birch
#

Do you have a virtual environment activated?

#

Is the VSCode interpreter version the same as what pip refers to?

#

!dashmpip

unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

sick birch
# kind roost

your_package is supposed to be the name of your package. Try py -3 -m pip install discord.py

sick birch
#

Replace <bot-file>.py with whereever your main bot is

sick birch
kind roost
sick birch
# kind roost

No, in your terminal, when you run the command, run your main bot file by specifying it's path

grim rock
shrewd fjord
#

Like use

birth_year instead of Birth_year

grim rock
#

done thanks..

#

ig ik you

shrewd fjord
#

;-; from where

grim rock
#

idk

#

its just ik u

shrewd fjord
#

Um ok ig, lets not talk about this stuff here, its off-topic xd

grim rock
#

interaction object changed author attribute to user?

shrewd fjord
unkempt canyonBOT
grim rock
#
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\avira\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\app_commands\tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\avira\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\app_commands\commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\avira\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\app_commands\commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'update' raised an exception: AttributeError: 'Interaction' object has no attribute 'author'
#

see

shrewd fjord
#

This .user will return Member obj if its in guild, and will return User if dm channel

shrewd fjord
grim rock
#

does this mean interaction.author never existed?

shrewd fjord
#

Yes

#

it exists in commands.Context aka ctx

grim rock
#

yea

#

i rember now

shrewd fjord
grim rock
kind roost
#

Help me token is not défini ?

sick birch
grim rock
#

DATABASE is updated but showing error on terminal and discord

frigid fable
#

Hi guys, I had a question please. I'm a beginner to python(still learning) and my first project would be a discord bot that would display live match results(for exemple). I wanted to know if it was possible to retrieve this data from a website to display it with the bot ? Thanks in advance 🙂 !

slate swan
#

that sounds like a lot but its not difficult once you learn what an api/websocket is

final iron
#

More or less 10 lines of code

#

For a simple implementation

#

Look into aiohttp, discord.py and http requests in general

frigid fable
#

thank you very much guys, I'll look into this

grim rock
#

!d discord.User

unkempt canyonBOT
#

class discord.User```
Represents a Discord user.

x == y Checks if two users are equal.

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

hash(x) Return the user’s hash.

str(x) Returns the user’s handle (e.g. `name` or `name#discriminator`).
grim rock
#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild).

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User).

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User) instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User) instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s handle (e.g. `name` or `name#discriminator`).
grim rock
unkempt canyonBOT
grim rock
unkempt canyonBOT
#

property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.id)
grim rock
#
@bot.tree.command(name="getuser", description="get user description")
@app_commands.describe(userid = "discord id of user")
async def getuser(interaction: discord.interactions, userid: discord.Member.id):
    c.execute('SELECT * FROM userdata WHERE user_id = ?', (userid,))
    user_data = c.fetchone()
    if user_data:
        userid, username, birth_year, biodrop = user_data
        embed = discord.Embed(title=f"{username}", description=f"Used ID: `{userid}`\nBirth Year: `{birth_year}`, Biodrop: {biodrop}", color=0xff0000)
        await interaction.response.send_message(embed=embed, ephemeral=True)
    else:
        await interaction.response.send_message("no info found in database", ephemeral=True)


ERROR:

Exception has occurred: TypeError
unsupported type annotation <property object at 0x00000203AE09CC70>
  File "D:\Projects\Python\D4\memberInfoBot\bot.py", line 94, in <module>
    @bot.tree.command(name="getuser", description="get user description")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported type annotation <property object at 0x00000203AE09CC70>

stark nexus
#

how suppose i do the command only check able by the user who used command?

#

like this

cloud dawn
#

!d discord.MessageFlags.ephemeral

unkempt canyonBOT
vapid parcel
#
    @commands.hybrid_command(name="banner")
    @commands.guild_only()
    async def banner(self, ctx, member: discord.Member):
        """Shows the banner of the mentioned member in the server."""

        user_id = member.id 

        try:
            user = await self.bot.fetch_user(user_id)
        except discord.NotFound:
            embed = discord.Embed(
                title=f"Error",
                description="User not found.",
                color=error_color
            )
            await ctx.send(embed=embed)
            return

        try:
            banner_url = user.banner.url

            embed = discord.Embed(
                title=f"{user.display_name}'s Banner",
                color=main_color
            )

            embed.set_image(url=banner_url)

            await ctx.send(embed=embed)
        except AttributeError:
            embed = discord.Embed(
                title=f"{user.display_name}'s Banner",
                description="This user is poor and can't afford NITRO.",
                color=main_color
            )
            await ctx.send(embed=embed)
#

How to get a banner from a user for that GUILD

#

Kinda like a display pfp/avatar but display banner..?

cloud dawn
#

!d discord.Member.banner

unkempt canyonBOT
#

property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.banner)
cloud dawn
#

It should return the current guild banner if member is used. If user is used then it would be a global banner.

pure garden
#

How can i send a Webhook message like i have a Webhook link, and i want to send something to that webhooks

unkempt canyonBOT
#

classmethod from_url(url, *, session=..., client=..., bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook) from a webhook URL.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) instead of `InvalidArgument`.
golden portal
#

!d discord.Webhook.send

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

Sends a message using the webhook.

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

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

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

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) instead of `InvalidArgument`.
final iron
#

https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
These types can be translated to Python or discord.py types and used as typehints for slash commands.
STRING ->
- str
- app_commands.Range[str, min_length, max_length]
INTEGER -> does not support IDs
- int
- app_commands.Range[int, min_value, max_value]
BOOLEAN -> bool
USER -> in a guild, you will receive a member regardless of typehint, but it will not have presence data
- discord.User
- discord.Member
- Union[discord.Member, discord.User]
CHANNEL -> Union containing any number of these types is supported
- discord.Thread
- discord.abc.GuildChannel - all below
- discord.CategoryChannel
- discord.ForumChannel
- discord.StageChannel
- discord.VoiceChannel
- discord.TextChannel - text, news
ROLE -> discord.Role
MENTIONABLE -> Union with any combination of USER and ROLE
NUMBER ->
- float
- app_commands.Range[float, min_value, max_value]
ATTACHMENT -> discord.Attachment

Notes:

grim rock
final iron
#

discord.Member if it's sent in a guild, discord.User if not

grim rock
#

discord.User is a int type or str type?

final iron
#

Neither

#

discord.User is the type

final iron
#

!d discord.User

unkempt canyonBOT
#

class discord.User```
Represents a Discord user.

x == y Checks if two users are equal.

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

hash(x) Return the user’s hash.

str(x) Returns the user’s handle (e.g. `name` or `name#discriminator`).
grim rock
#

okkkk

grim rock
#

what is this image feild called?

turbid condor
robust fulcrum
#

guys why my bot is not coming online and not working?

from rich import print
from pathlib import Path
from discord import Intents
from discord.ext import commands
from .utils.watcher import ExtsWatcher


class MyBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    async def setup_hook(self) -> None:
        print("[bold green]Bot is ready![/bold green]")
        print(
            "[bold green]Logged in as[/bold green]: [bold blue]"
            + str(self.user)
            + "[/bold blue]",
        )
        await self.load_extension(".extensions.test_ext", package=__package__)
        watcher = ExtsWatcher(self, Path(__file__).parent / "extensions")
        await watcher.start()


bot = MyBot(command_prefix=".", intents=Intents().all())
(.venv) ╭─ pwsh  dbot    ≢  17s 765ms⠀                                       .venv 3.11.3     11,11:23  
╰─ python -m src
2023-11-11 11:23:55 INFO     discord.client logging in using static token
Bot is ready!
Logged in as: honey singh#4433
final iron
#

You need to use start

#

!d discord.Client.start

unkempt canyonBOT
#

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

A shorthand coroutine for [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login) + [`connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.connect).
robust fulcrum
#

__main__.py

from .bot import bot
from .constants import Constants

if __name__ == "__main__":
    bot.run(Constants.TOKEN, reconnect=True)

final iron
#

Why are you importing a variable

robust fulcrum
#

i guess something is blocking my code

#

looks like th watcher is blocking

#

my bot worked when i remove that

robust fulcrum
final iron
#

Sure, but answer the question

#

What benefits does importing your bot object have over just running it directly in the file

robust fulcrum
#

but my this is blocking, idk how to fix it

class ExtsWatcher:
    def __init__(self, bot: Bot, exts_path: Path) -> None:
        self.bot = bot
        self.exts_path = exts_path

    async def start(self) -> None:
        while self.exts_path.exists():
            try:
                async for changes in awatch(self.exts_path):
                    if not self.exts_path.exists():
                        raise FileNotFoundError

                    for change in sorted(changes, reverse=True):
                        change_type = change[0]
                        change_path = change[1]

                        ext_path = Path(change_path)

                        if (ext_path.suffix == ".py") & (
                            ext_path.stem.split(".")[-1] == "ext"
                        ):
                            if change_type == Change.deleted:
                                if "extensions." + str(ext_path.stem):
                                    print("deleted")

            except FileNotFoundError:
                continue
#
    async def setup_hook(self) -> None:
        print("[bold green]Bot is ready![/bold green]")
        print(
            "[bold green]Logged in as[/bold green]: [bold blue]"
            + str(self.user)
            + "[/bold blue]",
        )
        await self.load_extension(".extensions.test_ext", package=__package__)
        watcher = ExtsWatcher(self, Path(__file__).parent / "extensions")
        await watcher.start()
shrewd fjord
#

Run it parallel,,

robust fulcrum
#

i use threading module for that right?

shrewd fjord
#

Yeah

#

You can use create_task from asyncio too maybe

#

Uh wait Thread target do not accept async functions i think

final iron
#

!d asyncio.to_thread

unkempt canyonBOT
#

coroutine asyncio.to_thread(func, /, *args, **kwargs)```
Asynchronously run function *func* in a separate thread.

Any \*args and \*\*kwargs supplied for this function are directly passed to *func*. Also, the current [`contextvars.Context`](https://docs.python.org/3/library/contextvars.html#contextvars.Context) is propagated, allowing context variables from the event loop thread to be accessed in the separate thread.

Return a coroutine that can be awaited to get the eventual result of *func*.

This coroutine function is primarily intended to be used for executing IO-bound functions/methods that would otherwise block the event loop if they were run in the main thread. For example:
shrewd fjord
#

!e
from threading import Thread

async def f():
...
Thread(target=f).start()

unkempt canyonBOT
#

@shrewd fjord :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | /lang/python/default/lib/python3.12/threading.py:989: RuntimeWarning: coroutine 'f' was never awaited
002 |   self._target(*self._args, **self._kwargs)
003 | RuntimeWarning: Enable tracemalloc to get the object allocation traceback
shrewd fjord
#

Huh just a runtime error

robust fulcrum
shrewd fjord
robust fulcrum
# unkempt canyon

not worked

C:\Users\dell\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py:1923: RuntimeWarning: coroutine 'ExtsWatcher.start' was never awaited
  handle = None  # Needed to break cycles when an exception occurs.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
#
    async def setup_hook(self) -> None:
        print("[bold green]Bot is ready![/bold green]")
        print(
            "[bold green]Logged in as[/bold green]: [bold blue]"
            + str(self.user)
            + "[/bold blue]",
        )
        await self.load_extension(".extensions.test_ext", package=__package__)
        watcher = ExtsWatcher(self, Path(__file__).parent / "extensions")
        await to_thread(watcher.start)
final iron
#

You don’t call it

robust fulcrum
#

oops

#

me dumb

robust fulcrum
robust fulcrum
shrewd fjord
final iron
#

The function you’re passing

robust fulcrum
#

i get error then

final iron
#

Which is…?

robust fulcrum
#

2 mins

robust fulcrum
final iron
#

Yeah, like the documentation and I said, you need to pass a function object

#

It’s clear you haven’t checked the documentation as it literally shows an example

robust fulcrum
#

the func is sync in docs

robust fulcrum
#

i guess to_thread is for sync functions

final iron
#

start doesn’t need to be asynchronous

#

You’re not awaiting any coros

robust fulcrum
final iron
#

No

#

You’re not awaiting any coros so it doesn’t need to be asynchronous in this situation

robust fulcrum
#

oh you mean i make the start func sync

#

but i can't do

#

cause i have to load cogs in that

#

and some async stuff

final iron
#

You’re not loading any cogs in it in the code sample you showed

robust fulcrum
#

i wana make it work atleast now

final iron
#

What’s wrong with loading your cogs in setup_hook as you are now

robust fulcrum
#

is there any other way than to_thread?

final iron
robust fulcrum
#

i fixed it

#
        asyncio.get_event_loop().create_task(
            ExtsWatcher(self, Path(__file__).parent / "extensions").start()
        )
#

thank you all though

shrewd fjord
#

Was telling you can use create_task from asyncio lol

worldly sonnet
#

how can i make captcha slover?

robust fulcrum
shrewd fjord
worldly sonnet
#

any

#

any captcha

#

how to solve like login captcha

shrewd fjord
#

💀💀Nah i aint helping in illegal activities xd

#

But if its not, just let me tell you,. If you like ever created a captcha solver somehow, you wont be able to keep up the amount of captchas are now here these days, every morning every new captcha, But yeah you can create one with manually collecting vast amount of datas

smoky patrol
#

Hey

#

I have a problem with a ping logger my code is not detecting here and everyone as a role

#

Does anyone know how to fix this

vale wing
smoky patrol
#

how can i detect it

rugged shadow
#

wait no

rugged shadow
vale wing
#

!d discord.Message.mention_everyone

unkempt canyonBOT
#

Specifies if the message mentions everyone.

Note

This does not check if the @everyone or the @here text is in the message itself. Rather this boolean indicates if either the @everyone or the @here text is in the message and it did end up mentioning.

rugged shadow
#

^

glad cradle
#

uwu

smoky patrol
#

possible to split it between here and everyone

#

cause mention_everyone returns only true and not the role name

vale wing
#
if message.mention_everyone and "@everyone" in message.content```
#

Like that

smoky patrol
#

the content is empty

vale wing
#

Enable message content intent

smoky patrol
#

okay thx

fresh notch
#

if i reply to a message with a command is it possible to get the id of the message i replied to

final iron
#

!d discord.ext.commands.Context.author

unkempt canyonBOT
fresh notch
# final iron Yes

no not this, for example if i reply to ur message with a command i want the bot to be able to get your id

unkempt canyonBOT
#

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

New in version 1.5.

fresh notch
#

ty

fiery girder
#
word = random.choice(get_words())
display_word = ""
for letter in word:
  if letter in guessed_letters:
     display_word += letter
  else:
     display_word += "_"

why this now working with discord

#

does forloop dont go well with discord bots?

final iron
#

Define “not working”

fiery girder
#

this what came up for word riddle

#

it just not processing words it keep gliching out words as you play

fiery girder
final iron
fiery girder
#

else it should display _

#

but it only give 2 for the word riddle with is 6 long

#

when i guess correct words it goes crazy as hell

final iron
#

Do some debugging then

#

Print the values you’re comparing

fiery girder
#

@final iron come in dm ill show u

final iron
#

You can show me here just fine

fiery girder
#

i cant show like every responce here with ease you can jsut join the test server and can leave later

final iron
#

No

#

You can show everything here just fine