#discord-bots

1 messages Β· Page 28 of 1

cold sonnet
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

cold sonnet
#

you got this?

slate swan
#
@commands.command()
    async def roles(self, ctx, member: discord.Member):
        """
        don't mind this
        """
        member = ctx.author or member
        embed = discord.Embed(title=f"Roles {member} have: ", description=f"\n".join([role.name for role in member.roles]), color=discord.Colour.dark_theme())
        await ctx.send(embed=embed)
``` no response πŸ˜”
short relic
cold sonnet
#

you need this if you wanna work with members

cold sonnet
#

you switched that

short relic
slate swan
cold sonnet
#

yeah

cold sonnet
short relic
cold sonnet
#

both codes seem good to me

slate swan
# cold sonnet yeah
    @commands.command()
    async def selfroles(self, ctx, member: discord.Member):
        member = member or ctx.author  
        embed = discord.Embed(title=f"Roles {member} have: ", description=f"\n".join([role.name for role in member.roles]), color=discord.Colour.dark_theme())
        await ctx.send(embed=embed)
``` sstill no response
lone lichen
#

Add role b4 the message and see if it sends the message

cold sonnet
#

that's smart

cold sonnet
lone lichen
#

Nvm

lone lichen
slate swan
#

And I’ve enabled all intents I can from dev portal

lone lichen
slate swan
#

Still the same

short relic
lone lichen
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
cerulean solstice
#
Traceback (most recent call last):
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/Astro/venv/lib/python3.8/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: 'Guild' object has no attribute 'text_channel_count'

help pls, Im not good with embeds

@bot.command(aliases=['Serverinfo', 'ServerInfo'])
async def serverinfo(ctx):
    embed = discord.Embed(title = f"{ctx.guild.name} Info", color = discord.Colour.blue())
    embed.add_field(name = ':2093wumpus: Server ID', value = f"{ctx.guild.id}", inline = True)
    embed.add_field(name = ':5955squaredownloadupdate: Created On', value = ctx.guild.created_at.strftime("%b %d %Y"), inline = True)
    embed.add_field(name = ':owner: Owner', value = f"{ctx.guild.owner}", inline = True)
    embed.add_field(name = ':admin: Members', value = f'{ctx.guild.member_count} Members', inline = True)
    embed.add_field(name = ':5505discordchannelsfromvega: Channels', value = f'{ctx.guild.text_channel_count} Text | {ctx.guild.voice_channel_count} Voice', inline = True)
    embed.add_field(name = ':7080redearth: Region', value = f'{ctx.guild.region}', inline = True)
    embed.set_thumbnail(url = ctx.guild.icon_url)
    embed.set_footer(text = ":star: β€’ Duo")    
    embed.set_author(name = f'{ctx.author.name}', icon_url = {ctx.message.author.avatar_url})
    await ctx.send(embed=embed)
short relic
lone lichen
#

Keep it as it is and print it out

short relic
#

πŸ€” πŸ€”

cold sonnet
#

and same with voice channels

cold sonnet
cerulean solstice
# cold sonnet replace guild.text_channel_count with len(guild.text_channels)
File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/Astro/venv/lib/python3.8/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: 'Context' object has no attribute 'len'
cold sonnet
#

not ctx.len()

slate swan
#

Code?

cerulean solstice
slate swan
cold sonnet
#

len(ctx.guild.text_channels)

#

I didn't see ctx at the start...

cerulean solstice
#

ok

cold sonnet
slate swan
cerulean solstice
# cold sonnet I didn't see ctx at the start...
 File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/Astro/venv/lib/python3.8/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: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.author.icon_url: Scheme "{<asset url='/avatars/898629552702644317/21e8c0bc6288730afd9fc82f8b5aba7d.webp?size=1024'>}" is not supported. Scheme must be one of ('http', 'https').

after fixing that i get this
what should i do?

slate swan
#

Still no response

cold sonnet
#

let it just be icon_url = ...

cerulean solstice
cold sonnet
#

k

cerulean solstice
cold sonnet
#

πŸ‘

limber bison
#

how can i stay running a file in puTTy if even i close the terminal ??

#

plssss ans

cold sonnet
#

wrong channel

#

check pins

#

eh it doesn't say much

short relic
# cold sonnet you printed it after add_roles...
@bot.command()
async def redeem(ctx, code):
    if code == "deptrainhatsv":
        role = ctx.guild.get_role(1006198515438981170)
        print(role)
        await ctx.send("key successfully redeemed")
    else:
        await ctx.send("key not found")

i dont have add tho

cold sonnet
#

and it doesn't print?

cerulean solstice
#
main.py:22: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?
  meme = discord.Embed(title=f"{data['title']}", Color = 0xff0000()).set_image(url=f"{data['url']}")
#

do i need? to share the code

cold sonnet
#

color = 0xff0000

short relic
cold sonnet
#

no ()

cerulean solstice
#

same error

cold sonnet
#

hm, shouldn't be

slate swan
#

@slate swan here?

short relic
cerulean solstice
# cold sonnet hm, shouldn't be
main.py:22: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?
  meme = discord.Embed(title=f"{data['title']}", color = 0xafc4ee()).set_image(url=f"{data['url']}")

the code is

@bot.command(aliases=['Meme'])
async def meme(ctx):
  content = get("https://meme-api.herokuapp.com/gimme").text
  data = json.loads(content)
  meme = discord.Embed(title=f"{data['title']}", color = 0xafc4ee()).set_image(url=f"{data['url']}")
  await ctx.send(embed=meme)
cerulean solstice
cold sonnet
#

you didn't remove the ()

cerulean solstice
#

ohk

short relic
#

why is it not adding the role lol maybe it cant get the role?

cold sonnet
#

that only needs guilds intents and that's enabled by default

#

check if it's the right id

cerulean solstice
#
File "main.py", line 23
    await ctx.send(embed=meme)
    ^
SyntaxError: invalid syntax
ξΊ§ 
cold sonnet
#

probably didn't close a bracket

cerulean solstice
#

thanks

drowsy prairie
#
    try:
        keyword = sys.argv[1]
    except:
        raise Exception('typing keyword. ex) python ./search.py aaaa')  

    execute(keyword) 

def loginbot():
    prefix = '!'
    intents = discord.Intents.all()

    client = commands.Bot(command_prefix=prefix, intents = intents)
    
    @client.command(name = keyword)
    async def _Search(ctx):
        main()

    with open('token.txt', 'r') as f:
        token = f.read()


    client.run(token)

if __name__ == "__main__":
    loginbot()```

```TypeError: Name of a command must be a string.```

It's a program that searches.
What does this error mean and how do I fix it?
slate swan
#

i wonder what does "Name of a command must be a string" means

drowsy prairie
#
    execute(keyword) 

def loginbot():
    prefix = '!'
    intents = discord.Intents.all()

    client = commands.Bot(command_prefix=prefix, intents = intents)
    
    @client.command(name = "ff")
    async def _Search(ctx):
        main()

    with open('token.txt', 'r') as f:
        token = f.read()

    client.run(token)

i changed it but search name should be "ff" but "<class 'ast.keyword'>" this sentence is being searched

slate swan
#

is there a variable for the prefix ?

slate swan
#

you need to use a command argument

slate swan
slate swan
#

!d discord.ext.commands.Bot.get_prefix

unkempt canyonBOT
#

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

Retrieves the prefix the bot is listening to with the message as a context.

Changed in version 2.0: `message` parameter is now positional-only.
slate swan
#

oh ty

#

you can await bot.get_prefix(<a message object>) to get the bot's prefix

#

ok

cerulean solstice
#
File "main.py", line 128, in kick
    await member.send("You have been kicked from {member.guild.name} reason: {reason}")
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/abc.py", line 1013, in send
    channel = await self._get_channel()
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/member.py", line 299, in _get_channel
    ch = await self.create_dm()
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/member.py", line 142, in general
    return await getattr(self._user, x)(*args, **kwargs)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/user.py", line 764, in create_dm
    data = await state.http.start_private_message(self.id)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50007): Cannot send messages to this user

Traceback (most recent call last):
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/Astro/venv/lib/python3.8/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: HTTPException: 400 Bad Request (error code: 50007): Cannot send messages to this user

i got this error when using the kick command
this is my code:

@bot.command(aliases=['Kick'])
@commands.has_permissions(kick_members = True)
async def kick(ctx,member : discord.Member, *, reason= "No reason was provided"):
  await member.send("You have been kicked from {member.guild.name} reason: {reason}")
  await member.kick(reason=reason)
cerulean solstice
near sail
drowsy prairie
#

Can a discode bot send only messages without a command?
What should I do if I can?

vale wing
cerulean solstice
#

but i prefer to use aliases

dire pier
#
class MyHelpCommand(commands.MinimalHelpCommand):
    def get_command_signature(self, command):
        return f"{self.context.clean_prefix}{command.qualified_name} {command.signature}"

    async def _cog_select_options(self) -> list[discord.SelectOption]:
        options: list[discord.SelectOption] = []
        options.append(discord.SelectOption(
            label="Home",
            emoji="🏠",
            description="Go back to the main menu.",
        ))

        for cog, command_set in self.get_bot_mapping().items():
            filtered = await self.filter_commands(command_set, sort=True)
            if not filtered:
                continue
            emoji = getattr(cog, "COG_EMOJI", None)
            options.append(discord.SelectOption(
                label=cog.qualified_name if cog else "No Category",
                emoji=cog.emoji, #<----------------
                description=cog.description[:100] if cog and cog.description else None
            ))

in another file...

class Useful(commands.Cog):
  """Lots Of Useful Commands."""
  COG_EMOJI = "🧰"

  def __init__(self, client):
    self.client = client
    self.expr = ""
    self.emoji = "🧰" #<----------------------

how would i put the emoji next to the dropdown menu? how do i access self.emoji?

drowsy prairie
#
        
        async def send_msg(channel : channelid):
            await channel.send('search rank[{}] server[{}]'.format(rank, title))```
Discord bot doesn't send messages to channel What's the problem?
slate swan
#

and you didn't declare the channel to send the message in

cerulean solstice
sick birch
cerulean solstice
#

i see

slate swan
#

how to use
if "..." in "string" ?

velvet haven
#

Can we have more than one owner for a bot

silk fulcrum
slate swan
silk fulcrum
#

!e py if "s" in "string": print("true") else: print("false")

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.

true
mossy jacinth
#

can someone please help me?

slate swan
#

if "<@&632317308035137578>" in message.content

slate swan
silk fulcrum
slate swan
silk fulcrum
#

!d discord.Message.mentions

slate swan
unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

pearl shoal
#

what is the attribute to show description of user in whois command

#

?

#

like the about me

swift pumice
#

i think thats not possible

silk fulcrum
#

yeah, that is not

#

at least in dpy, idk about discord API

pearl shoal
#

ok

#

thankssad

swift pumice
pearl shoal
#

what can we show in whois coand/

#

!whois

slate swan
ebon island
#

Is there a way to batch mute a list of users in one API call rather than each individually?

vale wing
ebon island
#

Understood. Thanks! Just wanted to optimize calls required, maybe what I can do is just do Asyncio.gather since it would be faster I'd expect than simple iteration

vale wing
vale wing
ebon island
#

But iteration on a large number of users will be very slow... Hmm, I guess this is something to consider, good callout Evenifix!

#

I think I will need a restriction on users in a given channel to minimize concurrent edits

#

Since if on many many servers with many many users each that can be loooots of requests

slate swan
#

why would you want the timeout on a large number of users, seems improper

ebon island
#

It is for freestyle rap, I am building a module to automatically mute and unmute users depending on the cipher rotation

#

It is an automatic Cipher moderation tool which provides a valuable service to our Niche community

#

Since in very large servers it can very easily get quite chaotic so the intent is to automate the process of taming the ciphers so that server owners can more easily host events

#

And automating it 24/7 means that people can expect that anytime they log on ciphers will be orderly and clean

#

Hope that sufficiently answers your question

wicked atlas
#

@ebon island If you really wanted to lower the number of API calls you make, you could change the Speak permission on the voice channel to False, which will by default mute anyone who joins it. Then just mute and unmute a single person using the API at a time.

ebon island
#

I like that idea! Is that muting suppression or just regular mute? Meaning is it the red mute or gray mute?

wicked atlas
#

gray mute, but they cannot unmute themselves unless someone with the Mute Members permission does it for them

limber bison
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: asyncio.run() cannot be called from a running event loop

fix ??

ebon island
#

Otherwise I might consider using stages as the basis because that way users are automatically not coming in as speakers and must opt in in order to participate

limber bison
# limber bison ```discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ...
async def load2():

    for filename in os.listdir('./commands'):
        if filename.endswith('.py'):
            await client.reload_extension( f'commands.{filename[:-3]}')
        elif not filename.endswith('.py'):
            filenametemp =  filename
            for filename in os.listdir(f'./commands/{filenametemp}'):
                if filename.endswith('.py'):
                    await client.reload_extension(f'commands.{filenametemp}.{filename[:-3]}') 

@client.command()
@commands.is_owner()
async def reload1(ctx):
    asyncio.run(load2())
    await ctx.send("done")```
ebon island
#

I have not used stages that much but I imagine it would do something similar to what is intended anyway and we would not have to worry as much about the number of API calls because my main worry about the number is from additional people who would just be listeners who would need to be muted and unmuted as well whereas if it is just participants I think that number will stay manageable and the number of API requests will not become as much of an issue as ultimately we can limit the number of active participants at any one given time

wicked atlas
#

Have stages been added to the documentation yet?

#

I haven't checked

ebon island
#

I am not sure on that but I assumed they would be similar in operation to regular voice channels but I suppose that is something that I need to look into as well, good call out!

wicked atlas
slate swan
slate swan
#

blocking for loop dogepray

silk fulcrum
#

your user has default discord avatar (no custom avatar)

#

you can check if user.avatar is None and then not use .url attr

silent portal
#

Versuch einfach nur user.avatar, sollte auch funktionieren

#

@slate swan Machst du einen AV Command? Wenn ja wΓΌrde ich das anders machen

glad cradle
#

!rule 4

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
#

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

#

@bot.slash_command(guild_ids = [979159861197688963], description = "test")
async def test(ctx):
await ctx.respond("Worked!")

slate swan
#

i need some help

#

ModuleNotFoundError: No module named 'discord_slash'

quaint epoch
#

!d disnake.ext.commands.Bot.slash_command

unkempt canyonBOT
#

@slash_command(*args, **kwargs)```
A shortcut decorator that invokes [`slash_command()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.slash_command "disnake.ext.commands.slash_command") and adds it to the internal command list.
quaint epoch
#

dpy don't have it

slate swan
#

yes, the import isn't working sir

quaint epoch
#

update disnake

#

python -m pip install disnake --upgrade

limber bison
regal pulsar
quaint epoch
#

i can't read minds

regal pulsar
#

discord_slash πŸ’€

quaint epoch
#

just use disnake 🐍

regal pulsar
silk fulcrum
silk fulcrum
quaint epoch
#

πŸ‘€

silk fulcrum
#

!d discord.app_commands.AppCommand

unkempt canyonBOT
#

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

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

New in version 2.0...
silk fulcrum
#

also this

rose arch
#

hi

silk fulcrum
#

hi

rose arch
#

i an new

silk fulcrum
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.

rose arch
silk fulcrum
rose arch
#

done that

silk fulcrum
#

select difdiculty and type on left

rose arch
#

done

silk fulcrum
#

to read

austere vale
#
  @commands.command()
  async def gallery(self, ctx): 
    PreviousButton = nextcord.ui.Button(emoji='⬅️')
    NextButton = nextcord.ui.Button(emoji='➑️')
    await paginator.simple(PreviousButton=PreviousButton,
    NextButton=NextButton,).start(ctx, pages=embed)
``` could someone help me use paginator? it throws the same error whether its Simple or simple even though i thought i was following the documentation https://github.com/soosBot-com/Pagination
slate swan
#

Can someone help me?I don't know how to send generated link to webhook

#

This is my code

#

a

glad cradle
austere vale
glad cradle
#

it's Simple

#

paginator.Simple(..)

austere vale
glad cradle
austere vale
#

if i do import Paginator, it says "No module named Paginator"

silk fulcrum
#

install it

glad cradle
austere vale
glad cradle
austere vale
winter cairn
#

i have a venv with pycord installed in it, it shows pycord in pip freeze, but when i run it, it just says "no module named discord"

glad cradle
#

in theory nextcord is a fork of Discord.py, it should have the ui kit

#

you will have problems with the module probably, install also Discord.py

#

or copy the code and change it for your case

austere vale
glad cradle
winter cairn
glad cradle
#

are you getting any errors?

#

also I noticed that you are using ctx but it is not defined in your function

cold sonnet
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

flint widget
#

What library are most people using instead of discord py?
I've been looking at disnake but not sure if there's a more popular one that people can recommend

slate swan
flint widget
sick birch
flint widget
#

Oh really??

sick birch
#

Yup

flint widget
glad cradle
flint widget
#

Oh that's great, saves me a lot of hassle then, I'll just take a look over it and see what's changed

slate swan
#
@client.command()
@commands.has_role('General Officer')
async def mute(ctx, member: discord.Member):
   mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
   await member.add_roles(mutedRole)
   await member.send(f"You have been temporarily muted in **{ctx.guild.name}** by user: **{ctx.author}**.")
   channel = 999759936122794017
   embed = discord.Embed(
        title = "Moderation Notice",
        description = f"{ctx.author} has executed the command: **MUTE** on {member}.",
        color = 0xe74c3c #RED
        )
   embed.set_footer(text = f"ID - {member.id}")
   await ctx.send(embed = embed)
   await channel.send(embed = embed)

This performs ctx.send but does not with channel.send. Any ideas as to why this is happening?

vocal snow
#

you should use guild.get_channel instead

slate swan
#

Ohh okay.

slate swan
vocal snow
#

of?

#

!d discord.Guild.get_channel

unkempt canyonBOT
#

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

Note

This does *not* search for threads.

Changed in version 2.0: `channel_id` parameter is now positional-only.
vocal snow
#

you call this on a Guild object like ctx.guild

#

subclass discord.Client or whatever you're using and annotate command_list

slate swan
#

is that an error or your linter's warning?

vocal snow
#

linter warning prolly

silk fulcrum
#

if you want custom attributes (AKA variables) for bot, then you need to subclass Bot class and add them into __init__ method or use classvars

slate swan
#

yeah subclassing would be the deal then

vocal snow
#

you don't need to add them to _init_

slate swan
#

except for the init you can use classvars too

#
class MyClient(Client):
    attr = {}
``` will do
torn spear
#

What is the simplest way to do embed pagintion?

slate swan
#

yes, but why do you even need that for a class variable

silk fulcrum
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.
silk fulcrum
#

hmm or not

silk fulcrum
slate swan
# torn spear What is the simplest way to do embed pagintion?

create your own paginator class,
add list of embeds as an attribute for the class
add an index attribute to the class with beginning value as 0
on each button/reaction click change the index to +1 or -1 and edit the message accordingly using that list attribute with embeds

silk fulcrum
slate swan
# slim grotto Wdym?

you can use the init dunder and define the command_list attribute there, but why there when you can use class variables?

torn spear
silk fulcrum
#

is that a slash command?

torn spear
past heath
#

does anyone know if i have to use a database for a mute command now or what since if a member already has a role that lets them able to talk the muted role has no affect even regardless of the role hierarchy i made it where when i mute the member it takes all the roles away which works but when the time runs out or they get unmuted the member cant get their roles back anyone know how to deal with this?

silk fulcrum
slate swan
# silk fulcrum that's not the simpliest way..
class Paginator:
   embeds: list[Embed]
   index = 0
   message: Message
   
   async def next_page(self,):
       self.index += 1
       await message.edit(embed = self.embeds[index]
   
   async def prev_page(self):
       self.index -= 1
       await message.edit(embed=embed(self.index)


@command()
async def foo(ctx):
    embeds = [...]
    pag = Paginator()
    pag.embeds = embeds
    pag.message = await ctx.send/reply(embed=embeds[0])
    # add emojis
    try:
        while True:
            event = await bot.wait_for...
            # check emoji
            await pag.next_page() # for next page
            await pag.prev_page() # for previous page
        
    except TimeoutError:
           ...

#

i typed it all on a phone so

silk fulcrum
#

YOU typed it all on a phone so

slate swan
#

wes

#

sorry my cat jumped on my laptop

#

dont mind the indentations lol

silk fulcrum
silk fulcrum
slate swan
#

!d discord.ext.commands.Context.from_interaction

unkempt canyonBOT
#

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

Creates a context from a [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction"). This only works on application command based interactions, such as slash commands or context menus.

On slash command based interactions this creates a synthetic [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") that points to an ephemeral message that the command invoker has executed. This means that [`Context.author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") returns the member that invoked the command.

In a message context menu based interaction, the [`Context.message`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.message "discord.ext.commands.Context.message") attribute is the message that the command is being executed on. This means that [`Context.author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") returns the author of the message being targetted. To get the member that invoked the command then [`discord.Interaction.user`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.user "discord.Interaction.user") should be used instead.

New in version 2.0.
torn spear
#

Okay

slate swan
#

tf this is cursed

past heath
slate swan
#

use timeouts and you can remove the timeout anytime you want to

past heath
slate swan
#

!d discord.Member.timeout

unkempt canyonBOT
#

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

Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").

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

This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit "discord.Member.edit").
torn spear
#
PageCounterStyle = discord.ButtonStyle()```
Does `discord.ButtonStyle()` take any arguments?
torn spear
unkempt canyonBOT
#

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

New in version 2.0.
tough lance
#

It isn't a function

mental hollow
#

Resolved.

cold tide
#
@bot.command()
async def priavtedm(ctx):
  if ctx.channel.id==998928038047780935 or ctx.channel.id==1004484809848016966:
        emb3=discord.Embed()
        emb3=discord.Embed(title="private dm sentβœ…",description=f"Check your inbox {ctx.author} !",color=0xffff00)
        await ctx.reply(embed=emb3)
        embed2=discord.Embed(title="test",description="pv dm",color=0xffff00)
        embed2.add_field(name="Generated info:",value=random.choie(privatedm))
        await ctx.author.send(embed=embed2)
#

First await ctx sends the last one doesn't im not sure why

golden tapir
#

why when i say the key word hint help it still says zero when it tells you who said yes and no

lone lichen
golden tapir
#

ok

cold tide
golden tapir
#
async def on_message(message):
  user_message = str(message.content)
  word = ["hello", "money", "bot"]
  rng = random.choice(word)
  if message.author == client.user:
    return
  if message.content.startswith("%start"):
    print(rng)
  if message.content.startswith(rng):
    await message.channel.send("Congrats you found the word, the word was " + rng)
  if user_message == "%hint":
    await message.channel.send("Poll time, want a hint? say 'hint yes'if you want a hint, say 'hint no' if you dont want a hint you have 1 minute to decide")
    yes = 0
    no = 0
    if user_message == "hint yes":
      yes += 1
    if user_message == "hint no":
      no += 1
    for i in range(5, 0, -1):
      print(i)
      time.sleep(1)
      if i == 1:
        await message.channel.send("Times up! The amount of people who said yes is " + str(yes) + " the amount of people who said no is " + str(no))
client.run(token)
lone lichen
lone lichen
cold tide
#

Wym

#

Like into terminal?

lone lichen
#

print(embed2)

cold tide
#

Alr

lone lichen
#

Yes I wanna see what it prints

cold tide
#

Nope

lone lichen
cold tide
#

Its doesnt primt

#

into terminal

lone lichen
#

Then embed is the issue here

cold tide
#

Well i cant seem to find the issue

cold tide
#

Its not

#

I did that here

#
  • it would show as a syntax error
lone lichen
#

Can u send a ss so I can read code easier

cold tide
#

Ill just send it all

lone lichen
lone lichen
cold tide
#
@bot.command()
async def priavtedm(ctx):
  if ctx.channel.id==998928038047780935 or ctx.channel.id==1004484809848016966:
        emb3=discord.Embed()
        emb3=discord.Embed(title="private dm sentβœ…",description=f"Check your inbox {ctx.author} !",color=0xffff00)
        await ctx.reply(embed=emb3)
        embed2=discord.Embed(title="test",description="pv dm",color=0xffff00)
        embed2.add_field(name="Generated info:",value=random.choice(privatedm))
        await ctx.author.send(embed=embed2)β€Š
#

thats just it nothing else.

lone lichen
#

Ye but It’ s indented weird on my phone

cold tide
#

You on pydroid?

lone lichen
#

I’ m on my phone rn πŸ˜‚

cold tide
lone lichen
cold tide
#

Run it thru ur pc

#

idk

lone lichen
#

Send a screenshot πŸ˜‚

cold tide
#

Im on phone rn

#

LOL

golden tapir
#

same

lone lichen
#

Ohh okok

cold tide
#

Pydroid BBPleading

lone lichen
#

Where is privatedm defined

cold tide
#

i think emb2 needs defining

cold tide
#

Thats the error

lone lichen
cold tide
#

Nawh not the issue

lone lichen
#

Like class variable or whatever

cold tide
#

@lone lichen

lone lichen
#

Yes?

lone lichen
#

Insude random.choice

cold tide
#

Read from there

#

i fixed that lol dw

lone lichen
#

Can u send the code u have rn

deep osprey
#

How to read the .txt file which the user sent?

lone lichen
#

!d discord.Message.attachments

unkempt canyonBOT
lone lichen
#

This may help

deep osprey
#

also, is there a tutorial for web scraping?

lone lichen
#

There is many

deep osprey
#

what's the good one?

lone lichen
#

Idk probably the docs from whatever library ur using

cold tide
#
@bot.command()
async def priavtedm(ctx):
  if ctx.channel.id==998928038047780935 or ctx.channel.id==1004484809848016966:
        emb3=discord.Embed()
        emb3=discord.Embed(title="private dm sentβœ…",description=f"Check your inbox {ctx.author} !",color=0xffff00)
        await ctx.reply(embed=emb3)
        embed2=discord.Embed(title="test",description="pv dm",color=0xffff00)
        embed2.add_field(name="Generated info:",value=random.choice(privatedm))
        await ctx.author.send(embed=embed2)β€Šβ€Š
#

Still not working

lone lichen
#

Where is privatedm defined

cold tide
#

Ive defined ir

#

heres new cose

lone lichen
#

I’ m blind

#

The object inside random.choice

#

Whats that

cold tide
#

variable which equals "test"

#

I havent defined inline

#

I think

lone lichen
#

?

cold tide
#

i havent defined inline

lone lichen
#

Does that work?

cold tide
#

no...

deep osprey
#

@cold tide Can you come in private for a sec?

cold tide
#

random.choice works inside value

#

Sure

lone lichen
cold tide
#

The variable which it will random.choice

lone lichen
#

Yes but what type is it

cold tide
#
privatedm="test"
#

thats all it is

lone lichen
#

I dont think u can put a string inside random.choice

#

Mby u can but I assume u cant

cold tide
#

You can lol trust me

lone lichen
#

do privatedm = [β€œtest”]

cold tide
#

it would of shown syntax errors

golden tapir
#

@lone lichen that didnt work

lone lichen
golden tapir
#

putting the variables in a class

lone lichen
#

Show code

lone lichen
cold tide
#

Wym?

lone lichen
#

It wont show syntax error for that

cold tide
#

Oh

#

It just returns to private dm "test"

lone lichen
cold tide
#

No...

pale turtle
#

!e
import random
print(random.choice("test"))

unkempt canyonBOT
#

@pale turtle :white_check_mark: Your 3.11 eval job has completed with return code 0.

t
cold tide
#
privatedm="test"
random.choice(privatedm)
#thats what it does
golden tapir
# lone lichen Show code
import time
class vars():
    yes = 0
    no = 0
client = discord.Client()
@client.event
async def on_message(message):
  user_message = str(message.content)
  word = ["hello", "money", "bot"]
  rng = random.choice(word)
  if message.author == client.user:
    return
  if message.content.startswith("%start"):
    print(rng)
  if message.content.startswith(rng):
    await message.channel.send("Congrats you found the word, the word was " + rng)
  if user_message == "%hint":
    await message.channel.send("Poll time, want a hint? say 'hint yes'if you want a hint, say 'hint no' if you dont want a hint you have 1 minute to decide")
    if user_message == "hint yes":
      yes += 1
    if user_message == "hint no":
      no += 1
    for i in range(5, 0, -1):
      print(i)
      time.sleep(1)
      if i == 1:
        await message.channel.send("Times up! The amount of people who said yes is " + str(yes) + " the amount of people who said no is " + str(no))
client.run(token)
lone lichen
golden tapir
#

@lone lichen

pale turtle
#

@cold tide I don't know if what I am saying is even correct, but maybe it mistakens the privatedm for the command function, not the variable. Try to call the variable something else maybe

lone lichen
#

Is variable global?

lone lichen
golden tapir
#

i dont know much ab classes

lone lichen
#

If you define a variable in on message it will redefine every time a message is sent

golden tapir
#

where can i put it

lone lichen
#

Outside of on_message

#

That would make it global which is not rly the best way, depends on ur use case u could have a db or json or something

golden tapir
#

i got a ereor

lone lichen
lone lichen
pale turtle
# cold tide I have

Still doesn't work? Did you change the var in the random.choice and the global var?

golden tapir
cold tide
#

Huh?

lone lichen
golden tapir
#

no

#
import discord
import random
from discord.ext import commands
import time
yes = 0
no = 0
token = 
client = discord.Client()
@client.event
async def on_message(message):
  user_message = str(message.content)
  word = ["hello", "money", "bot"]
  rng = random.choice(word)
  if message.author == client.user:
    return
  if message.content.startswith("%start"):
    print(rng)
  if message.content.startswith(rng):
    await message.channel.send("Congrats you found the word, the word was " + rng)
  if user_message == "%hint":
    await message.channel.send("Poll time, want a hint? say 'hint yes'if you want a hint, say 'hint no' if you dont want a hint you have 1 minute to decide")
    if user_message == "hint yes":
      yes += 1
    if user_message == "hint no":
      no += 1
    for i in range(5, 0, -1):
      print(i)
      time.sleep(1)
      if i == 1:
        await message.channel.send("Times up! The amount of people who said yes is " + str(yes) + " the amount of people who said no is " + str(no))
client.run(token)
lone lichen
# cold tide

I think with 2.0 they changed some methods so they only accept positional arguments

cold tide
#

How to fix??

golden tapir
#

@lone lichen

lone lichen
cold tide
#

@lone lichen the issue is you cant use random.choice function in a test=discord.Embed(title)

lone lichen
#

!d discord.ext.commands.Bot

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). 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.10)") 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.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
cold tide
#

@lone lichen can we go dms??

lone lichen
lone lichen
golden tapir
#

@lone lichen

#

what am i sposed

lone lichen
golden tapir
#

to be looken at

lone lichen
cold tide
#

Accept me @lone lichen

golden tapir
#

ik

lone lichen
golden tapir
#

but where

lone lichen
#

Then try to think how it would help u

golden tapir
#

yeah

#

i just read the page

#

and i see nothing

#

@lone lichen

lone lichen
#

Click the blue hyperlink

golden tapir
#

i did

#

yeah

#

nope i dont see anything

#

just tell me pls

lone lichen
#

Do you know what wait_for does?

golden tapir
#

no

lone lichen
#

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.

golden tapir
#

well

#

i want to wait 5 sedonds for people to vote yes or no to a hint

#

and when done

#

i want it to say howmany peole said yes and howmany peo;le say no

#

so @lone lichen what should i do?

lone lichen
#

So basically u wanna send something and then wait 5 seconds for multiple people to vote on it?

golden tapir
#

more like 60 secs

#

i did 5 for a test

lone lichen
#

You can do that with reactions easily

golden tapir
#

no

#

peole saying hint yes

#

or peole saying hint no

lone lichen
#

Then just wait five seconds, and get all messages between now and five seconds ago and see how many of them are hint yes and how many of them are hint no

golden tapir
#

ig

#

no

#

the bot waits 60

#

and eveytime some one says hint yes or hint no

#

it adds one point to the right var

#

so peole know who won

lone lichen
#

It can wait 5 sec or 60 sec or 100 years

golden tapir
#

you know what

#

i am gonna re write the whole thing

#

useing bot

#

instead of client

lone lichen
#

You can just wait x amount of seconds and afterwards check how many yeses and nos u got

golden tapir
#

yes

#

but

#

when ge prints how many peole said yes and no

#

he just prints 0

#

for both

lone lichen
#

Yes cus u indented it wrong

#

Ur whole code wont work as u intend

golden tapir
#

what the correct indet

dense coral
#

Why? who is know?

#

Code:

@reset.command()
async def role(ctx, role:nextcord.Role=None):
  with open("messages.json", "r") as f:
    user = json.load(f)
  if role == None:
    embed=nextcord.Embed(title="Error!", description=f"You did not use the command correctly.\nPlease be sure to use `!reset-messages role [@role/id/name]`", color=0xff0000)
    await ctx.send(embed=embed)
    return
  roles = nextcord.utils.find(lambda r: r.name == role.name, ctx.guild.roles)
  for i in roles:
      del user[str(i.id)]
      new = json.dumps(user, indent=4)
      with open("messages.json", "w") as write_file:
        write_file.write(new)
      embed=nextcord.Embed(description=f"**All messages reset for `{role.name}`**", color=0x00ff1e)
      embed.set_author(name="Done!",icon_url="https://images-ext-1.discordapp.net/external/vhSiwNAMWMj7Bl6Dpsz6nUzUQO-9E4EIp7TsIs5wBQw/%3Fv%3D1/https/cdn.discordapp.com/emojis/788751803743338506.gif")
      await ctx.send(embed=embed)```
lone lichen
dense coral
lone lichen
dense coral
#

and its?

lone lichen
golden tapir
#

why am i getting spamed this

dense coral
lone lichen
lone lichen
golden tapir
#

i cant

#

that got spammed

#

and i cant run

golden tapir
#

i litterly cant run it

lone lichen
#

I wouldnt use replit

golden tapir
#

ok

lone lichen
#

Yes It’ s replit issue

golden tapir
#

does anyone know what is happening

#

on there side?

lone lichen
#

Did u run it?

#

What happened?

#

Dwdw

#

Send more code

dense coral
lone lichen
#

Is there more to error?

#

guild_ids should be a list

#

Since u made a function to fet the ids u should call it

#

ids()

#

And it would help if ids function returned a list of ids

#

Now it returns void

dense coral
#

I know

#

change to guild_ids = [ids]

lone lichen
#

No

dense coral
#

It must be a list

lone lichen
#

guild_ids=ids()

lone lichen
dense coral
#

And also check that you have activated the slash command in the bot's Api

lone lichen
#

But it doesnt return ids cus he didn’t implement that

lone lichen
#

@slate swan your ids function must return list of ids

#

What do u want ids to get?

#

Rn it gets the row for one guild

#

Where do u have stored ids that u want to have in guild_ids

#

Get it from there

#

And you dont need interaction parameter in ids function

#

Depends on how u stored it

#

If you have a table with all guilds you should probably just get all ids

#

Select id from guilds

#

And now u got all guild ids

lone lichen
#

Yes probably, depends on what library ur using

#

And return the result

tribal horizon
#

How many Discord.py forks are there? I am not looking for an exact number. I am looking for an estimate.

lone lichen
tribal horizon
#

I used Pycord a little bit.

lone lichen
#

Like u can fork it rn if u want and there will be one more

alpine swan
#

So, I've been looking into discord.ext.commands.Bot, trying to put it into a custom class to so it contains state, but it seems like using the commands.Bot extension is more for 'static' commands? Can provide code if this isnt clear

lone lichen
#

Then u can overwrite events etc.

#

Just like any other subclassing

alpine swan
#

commented stuff cant figure out how to do

import os
import discord 
from discord.ext import tasks, commands
from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

class CustomBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.members = True
        intents.messages = True
        super().__init__(command_prefix='!', intents)
        self.important_info = 2
        
    async def on_ready(self):
        print(f'{self.user} has connected to Discord!')
        
    # this doesnt work, does not get set as a command 
    #async def test(ctx):
    #   await ctx.send(important_info)

bot = CustomBot()

@bot.command()
async def test(ctx):
    #cant do this
    #await ctx.send(important_info)
    pass
    
bot.run(TOKEN)
#

I can do it as a discord.Client though using on_message event

alpine swan
#

mmm k I'll look into those

tribal horizon
#

I used pycord a little bit. I never heard of disnake.

lone lichen
#

I love em

tribal horizon
#

It's interesting.

lone lichen
lone lichen
alpine swan
#

ah yeah that'll probably work

lone lichen
#

Mhm

#

And it will be way more organised

#

@slate swan any luck with ur problem?

#

Did u change anything?

#

Show me

#

Yes It’ s because ids doesn’t return anything

#

Print cursor.fetchall() first

#

So you see if ur on the right path

#

Did u make it return the result?

#

Ok great

#

Glad it works now

alpine swan
#

mmm doing something wrong, looks good by documentation...

import os
import discord 
from discord.ext import tasks, commands
from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

class CustomCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.important_info = 2
      
        
    @commands.command()
    async def test(ctx):
       await ctx.send(important_info)

intents = discord.Intents.default()
intents.members = True
intents.messages = True
bot = commands.Bot(command_prefix="!", intents=intents)

bot.add_cog(CustomCog)
    
bot.run(TOKEN)

TypeError: cogs must derive from Cog

#

dont think cogs have an on active

vagrant brook
#

CustomCog(bot)

alpine swan
#

ah

vagrant brook
#

you need an instance, not a class

gusty shard
#
@commands.cooldown(1,10,commands.BucketType.user)
@bot.command()
async def test(ctx):
    sent_message = await ctx.channel.send("Waiting for response...")
    res = await bot.wait_for(
        "message",
        check=lambda x: x.channel.id == ctx.channel.id
        and ctx.author.id == x.author.id
        and x.content.lower() == "x",
        timeout=10,
    )
    if res.content == "x":
        await message.reply(".")
@calis.error
async def calis_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        await ctx.reply('Wait `{e:.1f}` sec.'.format(e = error.retry_after))
    elif isinstance(error, commands.CommandInvokeError):
        await sent_message.delete() < #IT'S NOT WORKING```

how can i make the bot delete sent_message?
#

im working on it for 1.5 hours

#

and still cant find the solution

#

can somebody help me please?

vagrant brook
#

is sent_message a global variable or sth

#

!d discord.TextChannel.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
vagrant brook
#

btw theres a delete_after kwarg

gusty shard
#

i didnt think it

#

thank you so much

limber bison
#

async def withdraw(self, ctx, amount: int , all:str = None):

#

how can i make command which accsept int + all string ??

echo lagoon
#

amount, *, all?

#

the Asterix means everything after, consider as part of that 1 var regardless of spaces

limber bison
#

like it will work when i type !withdraw 1 all

#

i want to make amount optional \

echo lagoon
#

oh, add default val for amount too then?

hushed galleon
#

discord.py allows using typing.Optional to specify optional arguments in the middle

golden tapir
#

why does my bot say there is 0 peole who said yes even tho i said yes

#
client = discord.Client()
@client.event
async def on_message(message):
  user_message = str(message.content)
  word = ["hello", "money", "bot"]
  rng = random.choice(word)
  if message.author == client.user:
    return
  if message.content.startswith("%start"):
    print(rng)
  if message.content.startswith(rng):
    await message.channel.send("Congrats you found the word, the word was " + rng)
  yes = 0
  no = 0
  if user_message == "%hint":
    await message.channel.send("Poll time, want a hint? say 'hint yes'if you want a hint, say 'hint no' if you dont want a hint you have 1 minute to decide")
    if user_message == "yes":
      yes += 1
    if user_message == "no":
      no += 1
    for i in range(5, 0, -1):
      print(i)
      time.sleep(1)
      if i == 1:
        await message.channel.send("Times up! The amount of people who said yes is " + str(yes) + " the amount of people who said no is " + str(no))
client.run(token)
silk fulcrum
golden tapir
#

well

#

how could i fix

silk fulcrum
#

use commands.Bot instead of discord.Client and enable all intents via bot = commands.Bot(..., intents=discord.Intents.all())

#

and also enable them on dev portal

golden tapir
#

but i need the if statements

#

i cant use that in bot

hushed galleon
#

your logic needs to be rewritten to work asynchronously

silk fulcrum
#

In bot you can upgrade to @bot.command(), but if you want to stay with that if trash then sure, bot won't affect it

golden tapir
#

will it fix my problem?

silk fulcrum
#

also this doesn't work

silk fulcrum
golden tapir
#

ok

silk fulcrum
#

Why isn't there any pin about intents, maybe I should make one

silk fulcrum
hushed galleon
#

considering they said their bot got to the point where it said how many answered at all means their on_message event was firing normally

golden tapir
#

didnt work

#

still zero

hushed galleon
#

and using @bot.command() is a good idea, but it doesnt influence how you'd write the logic for this kind of command

silk fulcrum
hushed galleon
#

you'll need another listener or a wait_for to handle receiving messages in the chat until your timeout

silk fulcrum
#

why am I so sure he didn't change client to bot somewhere

golden tapir
#
bot = commands.Bot(command_prefix="%", intents=discord.Intents.all())
@bot.listen()
async def on_message(message):
  user_message = str(message.content)
  word = ["hello", "money", "bot"]
  rng = random.choice(word)
  if message.author == bot.user:
    return
  if message.content.startswith("%start"):
    print(rng)
  if message.content.startswith(rng):
    await message.channel.send("Congrats you found the word, the word was " + rng)
  yes = 0
  no = 0
  if user_message == "%hint":
    await message.channel.send("Poll time, want a hint? say 'hint yes'if you want a hint, say 'hint no' if you dont want a hint you have 1 minute to decide")
    if user_message == "yes":
      yes += 1
    if user_message == "no":
      no += 1
    for i in range(5, 0, -1):
      print(i)
      time.sleep(1)
      if i == 1:
        await message.channel.send("Times up! The amount of people who said yes is " + str(yes) + " the amount of people who said no is " + str(no))
bot.run(token)
silk fulcrum
#

why @bot.listen(), why not .event

#

well listen exists so I guess there is no problem with this

golden tapir
#

it still didnt work

#

still bot zero

#

when my bot told who said yes and no

silk fulcrum
#

oh wait you're about this ?

golden tapir
#

yes

silk fulcrum
past heath
#

trying to set up timeouts but i keep getting a AttributeError: 'Member' object has no attribute 'timeout' but i cant see where im going wrong

#
@commands.command()
    @commands.has_permissions(kick_members=True)
    async def mute(self, ctx, member: discord.Member, *, time:str, reason=None):
        time_in_seconds = humanfriendly.parse_timespan(time)
        await member.timeout(until = datetime.timedelta(seconds=time_in_seconds), reason=None)
        await ctx.send("timed out")```
golden tapir
#

is ctx.message a thing

silk fulcrum
#

yes

golden tapir
#

like is there a way to check user message using ctx?

silk fulcrum
#

but don't overuse it

golden tapir
#

wdym

silk fulcrum
#

for example there exists ctx.author instead of ctx.message.author

#

and so on

silk fulcrum
silk fulcrum
past heath
golden tapir
#

why doesnt this work

#

it said hello when it printed it

#

but it never sent that

silk fulcrum
past heath
#

alright will do

#

WELL DAMN

#

No wonder

golden tapir
#

why doesnt it work

past heath
#

im on ver 1.7.3 lemme upgrade rq

silk fulcrum
# golden tapir

you are trying to do the same thing using ctx.message.content and check if it is your word, it won't be it, at least because ctx.message.content will start with %start

#

you need to use argument or wait_for

silk fulcrum
#

ctx.message represents message with execution of command

#

so this will be ctx.message.content: !start

#

or whatever prefix you have

golden tapir
#

ah

past heath
#

i have to await cogs?

golden tapir
#

would this work?

silk fulcrum
silk fulcrum
golden tapir
#

what is wrong

#

why almost

silk fulcrum
#

you can't wait_for some word

golden tapir
#

no

silk fulcrum
#

you need to pass type (message) into wait_for

golden tapir
#

i am waiting for the variable

silk fulcrum
#

wait_for('message')

golden tapir
#

i am confused

silk fulcrum
#

and to wait for certain thing you need to pass check

golden tapir
#

i am waiting for the user to send

silk fulcrum
#

how to use checks must be in examples I provided

lilac shuttle
#
import os
import asyncio

## - Bot - ##
import discord
from discord.ext import commands

client = commands.Bot(command_prefix='.')
#ClientToken = '-/-'
ClientChannel = -/-

@client.event
async def on_ready():
    print('Bot is online. Posting message..')
    channel = client.get_channel(ClientChannel)
    await channel.send('test.')
    
    
client.run('-/-')

is there anything wrong with this

silk fulcrum
silk fulcrum
lilac shuttle
#

its something wrong with client.run()

silk fulcrum
#

also don't name commands.Bot instance client

silk fulcrum
lilac shuttle
#
: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
silk fulcrum
#

try it and see?

lilac shuttle
#

tried resetting and making a new one

#

did nothing

lilac shuttle
#

always something with mac

limber bison
#

how can i stop defould help command

silk fulcrum
unkempt canyonBOT
#

remove_command(name, /)```
Remove a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list of commands.

This could also be used as a way to remove aliases.

Changed in version 2.0: `name` parameter is now positional-only.
silk fulcrum
past heath
#

so i just upgraded my python version now im getting "'BotBase.load_extension' was never awaited discord.py"

#

how do i await it

silk fulcrum
#

add await before it

#

await bot.load_extension

heavy folio
#

Ye it has changed on dpy 2.0

past heath
#
async def setup(bot):
    await bot.add_cog(CogName(bot))```
#

i also need to add that in each cog?

vagrant brook
#

ye it has to be async

silk fulcrum
#

yes

vagrant brook
#

ok

rugged shadow
#

ok

alpine pewter
#
@bot.slash_command(description='Activate your token.')
@commands.has_permissions(administrator = True)
async def nitrado(interaction : Interaction, token : str = SlashOption(description='Enter your token here!')):

I was checking into how to make a command locked to a certain perm, am I doing something wrong here by chance? I had a friend test it, it didn't work.

vagrant brook
#

what library are you using

silk fulcrum
#

looks valid, I'm not really familiar with pycord slash commands, more dpy but seems absolutely fine, so what does not work?

silk fulcrum
vagrant brook
alpine pewter
#

I'm looking at it, not sure what I'm missing lol

silk fulcrum
#

nvm im just dumbass

#

I don't know anything

alpine pewter
#

I'm not sure if there's an import I'm missing or what, I truly can't find it. Lol

silk fulcrum
#

so is there an error? or what?

vagrant brook
#

try

alpine pewter
#

I'm sorry for wasting your time, my friend is just dumb

vagrant brook
#

nextcord.ext.application_checks

alpine pewter
#

It works. Lol Thank you though πŸ˜„

alpine pewter
silk fulcrum
#

no me stupid

vagrant brook
#

well

#

or just check permissions yourself

alpine pewter
#

Yeah, I should've. I figured my buddy could handle it
I was wrong sad_pepe_juice

silk fulcrum
#

well, that's most likely problem with ur db, you're getting no id or wrong id, which can't be found. or probably the channel was deleted

#

try printing rows to see what you get

#

this doesn't look like you printed rows

#

put print(rows) here

#

below this line

near sail
#

Maybe tc is a str? It must be an int

#

Yeah it is a string

silk fulcrum
#

int(tc)

near sail
#

id=int(tc)

past heath
silk fulcrum
past heath
#

literally no error

#

bot just not responding

limber bison
#

vc = guild.get_channel(info["vcid"])
vc.set_permissions(member , connect=True)
error : 'NoneType' object has no attribute 'set_permissions'

#

info["vcid "] its id of vc from database

alpine pewter
#
@bot.slash_command(description='Activate your token.')
@application_checks.has_role('Obelisk Perm')
async def nitrado(interaction : Interaction, token : str = SlashOption(description='Enter your token here!')):

    try:
        embed = nextcord.Embed(
            title="`Nitrado Obelisk`", 
            description=f"`🟒` `> System Success` \nYour token has been registered!\nResponse: `({token})`", color=3066993
            )
        
        clientGuildId = str(interaction.guild.id)
        db.collection('nitrado').document(clientGuildId).set({'token' : token})

        await interaction.response.send_message(embed=embed, ephemeral=True)

Can anyone by chance help with this? For the @application_checks.has_role('Obelisk Perm') if a user does not have the permission, it will simply reply with "Failed To Respond" how would I go about error handling this with a response if it's a slash command?

silk fulcrum
past heath
#

    await bot.load_extension("utility")

    await bot.load_extension("reactions")

    await bot.load_extension("help")

    await bot.load_extension("moderation")

    await bot.load_extension("fun")```
#

thats what i was supposed to do correct?

silk fulcrum
past heath
#
async def setup(bot):
    await bot.add_cog(utility(bot))```
silk fulcrum
past heath
#

then did tha for all the cogs

#

is there something more i need to do?

#

i see some things online but idk they dont seem to work either

silk fulcrum
#

@bot.event
async def on_command_error

vagrant brook
past heath
#

ill show u the whole like main page

#
from distutils.log import error
import os
import discord
import asyncio
from dotenv import load_dotenv
from discord.ext import commands

from help import MyHelpCommand
load_dotenv()

token = os.getenv("BOT_TOKEN")

intents= discord.Intents.default()
intents.members = True
intents.presences = True
intents.messages = True
intents.reactions =True

bot = commands.Bot(command_prefix = ",", intents=intents)
bot.help_command=MyHelpCommand()
bot.reaction_roles = []


@bot.event
async def on_ready():
    print("Your bot has successfully connected!")

    await bot.load_extension("utility")

    await bot.load_extension("reactions")

    await bot.load_extension("help")

    await bot.load_extension("moderation")

    await bot.load_extension("fun")

bot.run(token)```
alpine pewter
silk fulcrum
#

lists do not work like that, dicts to

#

!e py xplvlratio = {1: '100', 2: '255', 3: '475'} print(xplvlratio[3])

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.

475
vocal snow
#

..why

pliant gulch
#

member can't even be None

#

It's a required argument

limber bison
#

async def hello(self , ctx , amount : typing.optional[int] , all : str = None)

Why this giving error when I type , ?hello all

cursive barn
#

is it giving a TypeError or a ValueError

limber bison
#

But i don't want to initialise it

cursive barn
#

so when you have two optional arguments in a discord command, it will always assign the value to the first one

silk fulcrum
#

Optional

limber bison
#

Correct in code

cursive barn
#

my suggestion would be to accept an optional string argument and inside your command try casting it to an integer. like ```py
@commands.command()
async def hello(self, ctx, arg: str = None):
try:
arg = int(arg)
# The argument passed is for an amount
except ValueError:
# The argument passed is for a string

silk fulcrum
#

also why would you do Optional for one argument and for second = None

limber bison
silk fulcrum
#

you didn't get me...

limber bison
#

Casino bot !!!

cursive barn
limber bison
#

Thanks 😳

cursive barn
#

you would need to modify the try/except for something like ```py
try:
amount = int(arg)
except ValueError:
if arg == 'all':
amount = # Query for the amount to use

give them amount

slate swan
#

you can always just use isinstance

cursive barn
slate swan
#

well it depends if he does use an annotation

cursive barn
#

you have to attempt to typecast and handle the error if it fails

#

even if he doesn't use annotation it would still come in as string, no?

slate swan
#

does* lol

limber bison
#

Ohh got it nvm

#

Ignore

slate swan
#

What's this?

silk fulcrum
#

modal?

slate swan
#

Oh

#

Cool

#

Is it possible to edit an embed, without it saying "edited" in the bottom corner?

silk fulcrum
#

no

slate swan
silk fulcrum
#

what changed?

slate swan
#

Entries: 0 -> Entries: 1

silk fulcrum
#

idk

glad cradle
slate swan
#

how do i make a slash command response private (that "only you can see" message thing)

#

i know how to do it normally interaction.response.send_message

silk fulcrum
#

ephemeral attr

vocal snow
#

*kwarg

slate swan
#

oh its a kwarg

vocal snow
#

!d discord.InteractionResponse.send_message

unkempt canyonBOT
#

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

Responds to this interaction by sending a message.
slate swan
#

oh thank you

#

oh true/false

#

nice

swift pumice
#

how do i change the bots pfp every 24 hours?

glad cradle
swift pumice
spring flax
#

How can I get this to return like 11+11 instead of what it currently returns, which is [1, 1]+[1, 1]

def generate_sum() -> str:
    operation = choice(OPERATIONS)
    start = choices(NUMBERS, k=2)
    end = choices(NUMBERS, k=2)
    return f"{start}{operation}{end}"
#

I tried the join method but it didn't help

vocal snow
#

why don't you just use random.randint instead?

spring flax
vocal snow
spring flax
#

okay thanks

drowsy prairie
#
    @client.command()
    async def on_message(ctx, log):
        channel = client.get_channel(1006552645730840630) #channel id here
        await channel.send(log)

def checkServerPlayers(title, url, keyword):
    query = keyword.lower()
    doc = getDoc(url)
    rows = doc.select('#serverPage tr > td > a')
    for row in rows:
        name = row.text.lower()

        if query in name: 

            log = (
                "name : {}\r\n"
                "full name : {}\r\n"
                "----------------------------------------\n"
            )
            bot_messages(log)
            print(log.format(title, name))```
#

I want to automatically print out the name that the user wants to search for on the channel after writing the command. What method should I use?

slate swan
#

!d discord.File

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=..., description=None)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
swift pumice
#

Why are self bots against the discord tos?

slate swan
swift pumice
#

What if a self bot user says that he isnt a bot

#

?

echo wasp
slate swan
swift pumice
slate swan
#

Ah

swift pumice
slate swan
#

well it isn't allowed

#

you could do that with a regular discord bot

swift pumice
#

No, bots sadly cant use slash commands :(

lone lichen
#

If ppl were just using them to bump I think they wouldnt be

silk fulcrum
#

self bots can't

#

or you mean use them like execute?

lone lichen
#

Like

#

Bots cant trigger them

silk fulcrum
#

oo

unkempt hawk
#

Can someone link some resource on how create a discord.py cluster for HA? TLDR I want to deploy our bot in my Kubernetes cluster and run an instance on all nodes, but one event should only be processed once. How do I achieve that?

swift pumice
#

How???

swift pumice
silk fulcrum
swift pumice
#

like disboard /bump

swift pumice
fickle sky
#

is there something i did wrong in my code i use pycord

#

because the bot aint replying to me

silk fulcrum
fickle sky
#

also uhm i reseted the token sooo uhh

fickle sky
fickle sky
silk fulcrum
fickle sky
#

no console errors

silk fulcrum
#

what are you typing?

fickle sky
#

hello

torn sail
#

You may have to enable message content intents

silk fulcrum
#

oh yeah

torn sail
#

Idk how to do that in pycord tho

fickle sky
#

what that/

silk fulcrum
#

also don't name commands.Bot instance client

fickle sky
silk fulcrum
#

(was checking docs to make sure)

torn sail
silk fulcrum
#

^^

silk fulcrum
#

= False 😳

outer blaze
#

can someone send me the code of unban for python

silk fulcrum
#

no spoonfeed here

#

!d discord.Guild.unban

unkempt canyonBOT
#

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

Unbans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

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

thanks

silk fulcrum
#

If you read an example called "Waiting for a user reply:", you could see how check must look like:

        def check(m):
            return m.content == 'hello' and m.channel == channel```, so that is a function that receives a message object and returns True if custom conditions are met and False otherwise. In this example check function checks if the message was sent in a current channel (so it won't count messages from other channels) and if the message content is "hello". Note that check function should not be asynchronous (not `async def`). And in the wait_for you specify type and your check function. So let's make another example:
```py
    def check_input(message):
        return message.channel == ctx.channel and message.author == ctx.author
    
    m = await bot.wait_for('message', check=check)``` In this example check function checks if message channel is current (ctx) channel and author is same
#

I did my best to explain what to do πŸ˜”

#

please what?:(

#

and then people are asking me why am I so rude lemao

#

idk, lemme check, you said so?

#

i though you are still not understanding what to do

#

oh you just copied my example...

#

spoiler: that was an example

#

error?

#

!paste also this

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

silk fulcrum
#

that's also to not spam the channel...

#

this way to get channel id looks not very good

#

but anyways you tell members how to mention it

chrome latch
#

hey any idea what i need to learn if i wan to create my own discord.py like library

silk fulcrum
chrome latch
silk fulcrum
chrome latch
#

oh ool

silk fulcrum
torn sail
glad cradle
torn sail
#

These are links to get started with the discord api if u want https://discord.com/developers/docs/topics/gateway https://discord.com/developers/docs/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.

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.

#

yeah

drowsy prairie
#
    query = keyword.lower()
    doc = getDoc(url)
    rows = doc.select('tbody > tr > td > a')
    for row in rows:
        name = row.text.lower()

        if query in name: 
            log = (
                "name: {}\r\n"
                "full name : {}\r\n"
                "----------------------------------------\n"
            )
            print(log.format(title, name))
            f.write(log.format(title, name))
    async def on_message(message):
        await message.channel.send(log)```
how to bot is send message without command 
this is not working..
chrome latch
unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
torn sail
#

!d discord.TextChannel.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
drowsy prairie
#

Is there a way to send a message without using async?

glad cradle
drowsy prairie
glad cradle
drowsy prairie
glad cradle
fickle sky
#

hey

#

is there any problem with my code the buttons the >hello command with buttons dont work tho :(

sacred merlin
#
@client.event
async def is_owner(message):
    owners = ('283224945843109888')
    if message.author.id == owners:
        return owners

Are two IDs possible in a list? I tried and it doesn't work, can someone please solve this? Or can't it be solved?

drowsy prairie
# glad cradle do you get any errors when you turn the function into `async def...`?

If i use async def, there will be no value in the title, name
and error is RuntimeWarning: coroutine 'execute' was never awaited

    print('===================================')
    print('>> name : {}'.format(keyword))
    print('===================================')

    findKeyword(keyword)

    print('>> end.')

    async def findKeyword(keyword):
    url = 'link'
    
    for i in range(1, 2):
        doc = getDoc(url)
        checkServers(doc, keyword)
        
        url = getNextUrl(doc) ```
brazen raft
slate swan
#
@bot.command()
async def online(ctx):
    role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="940644669652631663")
    await member.add_roles(role)

I've got an error, could anyone help?

supple dragon
#

!e x=range(1,2,2 )
for n in x:
print(n)

unkempt canyonBOT
#

@supple dragon :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
supple dragon
#

!e x=range(1,2,5 )
for n in x:
print(n)

unkempt canyonBOT
#

@supple dragon :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
slate swan
#

!e @bot.command()
async def online(ctx):
role = discord.utils.get(bot.get_guild(ctx.guild.id).roles, id ="940644669652631663")
await member.add_roles(role)

supple dragon
#

!e x=range(1,10,5 )
for n in x:
print(n)

unkempt canyonBOT
#

@supple dragon :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 1
002 | 6
hushed galleon
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
hushed galleon
#

also note that the ID should be an integer instead of a string

sacred merlin
brazen raft
#

Discord applications can be made a team where other users can be part of

#

commands.is_owner checks for these team members too

hushed galleon
#

^ or alternatively you can specify the owner_ids= argument in your commands.Bot() constructor

brazen raft
#

Good to know

zealous jay
#

@supple dragon

slate swan
#

How would i go about making a whitelist command? Something what will look a little bit like this: !whitelist @slate swan Bot: given the @slate swan role to @slate swan

supple dragon
zealous jay
#

no problem haha

hushed galleon
slate swan
#

there's a good chance even that returns None πŸ˜” and there's no endpoint for fetching a single role either
kinda hate that impl that even utils.get returns None even if all the roles are passed into the iterable

burnt obsidian
rocky hornet
#

whats the best way to store guild settings in db

sacred merlin
burnt obsidian
#

I keep getting an error with vsc that says this ```py
line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'channle'

rocky hornet
#

read

rocky hornet
#

πŸ₯£

torn sail
#

channel, not channle

burnt obsidian
slate swan
hushed galleon
main moss
#

Hello guys, my bot keeps speeding/slowing down randomly while playing music and i dont know why or what is causing this problem, in the screenshots you can see that i am using ffmpeg with a link and these ffmpeg options. Does anyone know why this problem is occuring?

sacred merlin
# slate swan Ye Make list like @client.event async def on_message(message): owner = ["id ...
import discord
import asyncio
from discord import Intents
from discord.ext import commands

intents = discord.Intents.default()
intents.typing = True
intents.presences = True
intents.members = True

client = discord.Bot(intents=intents)

@client.event
async def is_owner(message):
    owners = ["id_user", "id_user"]
    if message.author.id == owners:
        return
    else:
        await message.channel.send("You don't have permission to use this command")

@client.event
@commands.check(is_owner)
async def on_message(message):
    if message.content == "test":
        await message.channel.send("Hello world!")

client.run("TOKEN")

Yes, I did that too but it still doesn't work. They tried to use the command and got a message that they don't have permission.