#discord-bots

1 messages · Page 835 of 1

unkempt canyonBOT
surreal sierra
#

but I already got my bot that I have spent much time on coding so I dont wanna switch library and having to change all the code. just start over everything, is not disnake pretty much the same as dpy? so I dont have to change all the code

slim ibex
#

you won't have to change tons of code

steady berry
#

but i want to msg it privatly to the {user}

slim ibex
#

there are some differences like avatar_url to avatar.url i think

surreal sierra
#

ah okay

quick gust
steady berry
#

ok

quick gust
crystal kayak
#

I've been trying to change my discord bot's language from javascript to python

slim ibex
#

from ..utils.converters import TimeConverter gnarly import

steady berry
#

so is this correct

slim ibex
#

pass_context is old

steady berry
#

so how to use it

slim ibex
#

!d discord.DMChannel

unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

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

hash(x) Returns the channel’s hash.

str(x) Returns a string representation of the channel
slim ibex
#

you can only send dms if the users DMChannel is open

alpine vault
#

I am trying to patch commands.Context.send before invoking a command. But the patched the patched function does not seem to take effect and it works as if nothing has happened, how do I go about doing this?
This is what I am trying to do :
Patched send :

def send(content=None, **kwargs):
    patch_message = "This command was invoked by an edit"
    if content is not None:
        return commands.Context.send(patch_message + "\n" + content, **kwargs)
    return commands.Context.send(patch_message, **kwargs)

Invoke :

    @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
        for i in self.bot.interim.get_list()[::-1]:
            # Traversing through the reversed heap means that
            # the first match will be the last edit made to the message
            if (
                i.id == payload.message_id
                and payload.emoji.name == "🔁"
                and payload.user_id == i.author.id
            ):
                ctx = await self.bot.get_context(i)
                ctx.send = send
                await self.bot.invoke(ctx)

But the contents of the command send by the bot through this appears without patch_message, how do I go about solving this?

autumn hollow
#

I am trying to make a easy discord.py bot. It was supposed to send back a Hello message to me. But it didn't respond. I do this in replit.com
Code:

import os
import discord

client = discord.Client()

@client.event
async def on_ready():
  print("We have logged in as {0.user}".format(client))

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

  elif message.content.startswith('!hello'):
    await message.channel.send('Hello!')

client.run(os.getenv('TOKEN2'))

Error Code:

Ignoring exception in on_message
Traceback (most recent call last):
  File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 16, in on_message
    await message.channel.send('Hello!')
  File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
modest plover
#
import disnake
from disnake.ext import commands

class Timeout(commands.Cog):
  """Mutes/timeouts a user."""
  
  def __init__(self, bot: commands.Bot):
    self.bot = bot
  
  @commands.slash_command()
  async def timeout(self, inter, user: disnake.Member, until = int, reason = None):
    """Mutes/timeouts a member for up to 28 days in the future."""
    await member.timeout(duration=until, member=user, reason=reason)
  
def setup(bot):
    bot.add_cog(Timeout(bot))

This doesn't load.

#
import disnake
from disnake.ext import commands
import os
from dotenv import load_dotenv

load_dotenv()

token = os.environ["token"]
bot = commands.Bot(test_guilds=[938194100639895713])

bot.load_extensions("commands")

@bot.event
async def on_ready():
    print(f"{bot.user} is loading into developer mode...")

bot.run(token)
rocky lantern
#

hello Hi guys, how are you? I'm new to bot programming and I'm trying to prepare myself on the subject I'm from Brazil but I didn't find anyone who can help me I joined this server and I think something can solve the error who can help me thank you very much I don't know what this error is (the one to the right)

slim ibex
#

Intents

#

Enable them in the dev portal

#

and don’t use replit

rocky lantern
#

like?

slim ibex
#

I usually enable all intents

rocky lantern
#

oh and because I only know from the replit :/

rocky lantern
slim ibex
#

oh wait

rocky lantern
#

ok ok

slate swan
#

what are you talking about?

#

thats not a thing, never was

slim ibex
#

ye that’s what I thought

#

I said something dumb again

#

💀

slate swan
slim ibex
#

ik ik

#

no offense taken

rocky lantern
#

I understand that is the replit does not work?

#

I'm using google translator and the translation is kinda funny

rocky lantern
slate swan
slim ibex
#

just search up discord dev portal

slim ibex
#

I’m gonna take a break to prevent any dumb stuff from coming out from me 🗿💀

slim ibex
#

Ty I’ll be back later.

slate swan
#

cya

slim ibex
#

But even though I say dumb shit sometimes I’ve learned a lot here from helping others

maiden fable
flat solstice
#

How can I get around a py ImportError: attempted relative import beyond top-level packageerror? I'm trying to import a string from main.pythat I'm thinking the bot can't see.
I have a bot part of my code as well as a dashboard in jango and I want my jango file(s) to be able to import properties from my main bot file (i.e. the bots name) but I'm testing it with a strin rn. This is my file tree https://sourceb.in/gaXkgivbfr and i want to import my bot instance from main.py into the views.py file.

I asked this a little while ago in #help-dumpling and didn't get a response before it went dormant and in that time I have relized I could get certain bot attributes from hikaris RestApp(), couldn't I?

velvet tinsel
#

hi

rocky lantern
rocky lantern
#

wow ok now i can try again by replit? and I really want to learn about it

rocky lantern
#

oh my god thank you so much my bot is up and running thanks for everything Ashley,Moai

#

it's working ❤️

slate swan
#

Guys guys, how do I react with custom emojis

blissful bone
#

hey im having a type error heres my code

import disnake
from disnake.ext import commands
from disnake.utils import get
def is_user(func):
    def wrapper(ctx):
        return not ctx.author.id == 582279365912559631 or 792112180346355743
    return commands.check(wrapper)
class devCommands(commands.Cog):
         
    
    def __init__(self, bot):
        self.client = bot
    
        
        # SERVERS COMMAND GIVES ALL SERVERS AND IDS 
        @bot.command(name='servers', help='')
        @commands.has_role(938775667452043365)
        async def servers(ctx):
            lists = []
            for guild in bot.guilds:
                lists.append(f"{guild.name} (id: {guild.id})")
                beepu= ("\n".join(lists))
            embed=disnake.Embed(title="Servers", description= beepu, color=0xFF5733)
            await ctx.send(embed=embed)
           
    
    


    

    
        
    @commands.command(name = 'leave', aliases = ['boot'], help = 'makes the bot leave a server')
    @commands.has_role(938773073862217761 or 938775667452043365)
    async def leave(self, ctx, guild_id):
        await self.client.get_guild(int(guild_id)).leave()
        await ctx.send(f"I left: {guild_id}")    
        
    
    
    
    
    @commands.command(name = 'tshoot', aliases = ['ts','t'], hidden = True)
    @is_user
    async def shoot(self,ctx,shoot_type = None):
        if shoot_type == None:
            await ctx.send('begining trouble shoot')
            Chan_name = []
            for channel in ctx.guild.text_channels:
                if str(channel.type) == 'text':
                    Chan_name.append(channel.name)

            role_name = []
            for channel in ctx.guild.roles:

                role_name.append(channel.name)
              
            if "ripple_logs" not in Chan_name:
                await ctx.send('ripple loggs ❌ ')
            else:
                await ctx.send('ripple logs ✅')
        
def setup(bot):
    bot.add_cog(devCommands(bot))
#

and heres my error

#
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/disnake/client.py", line 515, in _run_event
    await coro(*args, **kwargs)
  File "/home/container/bot.py", line 83, in on_ready
    raise e
  File "/home/container/bot.py", line 79, in on_ready
    bot.load_extension(cog)
  File "/home/container/.local/lib/python3.9/site-packages/disnake/ext/commands/common_bot_base.py", line 488, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/container/.local/lib/python3.9/site-packages/disnake/ext/commands/common_bot_base.py", line 419, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.devCommands' raised an error: TypeError: Callback must be a coroutine.
#

any help

#

granted im a bit confused on what a coroutine is

maiden fable
slate swan
#

dumb question but please just tell lol

flat solstice
slate swan
modest plover
#

It's not what the command does, it's that it doesn't register to the test guild

warped hemlock
#

hello guys

#

i am trying to make an assitant in python

#

nd i am a linux user

slate swan
warped hemlock
#

anyone here who can help me

quick gust
unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
flat solstice
# slate swan I want to get the emoji from the message

oh so user sends a emoji in a message and then you want to do something with it it? I think you'd just want to check if lib.Emoji in message.content to see if it has emoji's then maybe a for emojis in message.content but I'm not sure exactly

slate swan
quick gust
#

nope

#

lol

quick gust
#

I dont see anything wrong

warped hemlock
#

hey

#

please help me

quick gust
warped hemlock
#

to making a assitant

modest plover
modest plover
#

Do you mean a discord bot or like something like what Siri is on ios or cortana on windows?

maiden fable
#

Since it returns a string only

#

Not objects of discord.Emoji or smth

fresh iron
#

if i install enhanced discordpy library do i have to uninstall original rapptz discordpy

maiden fable
#

It's preferred but not necessary

modest plover
#

It's advised to do so

quick gust
slate swan
visual island
#

it works only on custom emoji

slate swan
#

nvm

#

thanks

visual island
#

maybe try typehint to Union[disnake.Emoji, str]?

maiden fable
#

U will have to use a library

visual island
maiden fable
#

And make an API call whenever the command is invoked? Yea totally a great idea haha

slate swan
maiden fable
#

I know of a lib

#

Smh

#

There was something like that

slate swan
#

rip its not on pypi

maiden fable
#

!pypi emoji

unkempt canyonBOT
slate swan
maiden fable
#

?

#

U cannot use it as a converter?

slate swan
maiden fable
#

Okay...?

slate swan
# maiden fable Okay...?

like whenver I try to upload an emoji, it simply says- expected a Bytes object and says it got a SteamReader object

maiden fable
#

use BytesIO

slate swan
maiden fable
#

Hmm, I gotta go rn anyways, try looking into it again else will help u in an hour

brisk zodiac
#

what is the best website for 10 years old kid to learn python

hoary cargo
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.

slate swan
maiden fable
brisk zodiac
#

wow ty

slate swan
maiden fable
hoary cargo
#

the halo channel

maiden fable
#
from io import BytesIO

# if you have an image or anything that saves to a stream
buffer = BytesIO()
im.save(buffer, "png")  # 'save' function for PIL, adapt as necessary
buffer.seek(0)

# if you have some bytes
buffer = BytesIO(my_bytes)

# if you have some text
my_text = "Don't do drugs kids"
buffer = BytesIO(my_text.encode("utf8"))  # change encoding as necessary

await ctx.send(file=discord.File(fp=buffer, filename="whatever.png")) 

Take a look at this too, @slate swan

maiden fable
#

!d discord.Guild.create_custom_emoji

unkempt canyonBOT
#

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

Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
slate swan
maiden fable
#

@slate swan also try doing

with open(file) as f:
    emoji_file = bytes(f) 

or smth

#

!d bytes

unkempt canyonBOT
#

class bytes([source[, encoding[, errors]]])```
Firstly, the syntax for bytes literals is largely the same as that for string literals, except that a `b` prefix is added:

• Single quotes: `b'still allows embedded "double" quotes'`

• Double quotes: `b"still allows embedded 'single' quotes"`

• Triple quoted: `b'''3 single quotes'''`, `b"""3 double quotes"""`

Only ASCII characters are permitted in bytes literals (regardless of the declared source code encoding). Any binary values over 127 must be entered into bytes literals using the appropriate escape sequence...
magic ore
#

f.read()

maiden fable
#

It's an image file tho

slate swan
maiden fable
#

Okay then

quaint epoch
#

guys why my pycharm not loading

#

i uninstalled, restarted, repaired, all twice

#

still nothing

maiden fable
quaint epoch
#

thanks

surreal ledge
#

i was programming a basic bot there isnt any error but the bot isnt replying can someone help me with this

maiden fable
#

Code

surreal ledge
#

the program: import os
import discord

client = discord.Client()

@client.event
async def on_ready() :
print ('we have logged in as{0.user}'.format (client))

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

if message.content.startswith('$hello'):
await message.channel.send ('hello!')

my_secret = os.environ['']
client.run(my_secret)

maiden fable
#

The token

surreal ledge
maiden fable
#

What u sending

surreal ledge
slate swan
#

So is it?

maiden fable
hoary cargo
#

i feel confused about this chat

maiden fable
#

Why tho

hoary cargo
#

what token mike Kek

maiden fable
#

Lol

hoary cargo
#

this part tho

maiden fable
#

Lmao

kindred drum
#

How would I check if someone has the @ everyone permission in a event listener

placid skiff
verbal tiger
#

hey I'm new to this can someone just help me in making a script that count numbers in discord?

potent spear
verbal tiger
potent spear
verbal tiger
#

then I will try to make changes on it to learn

verbal tiger
#

like send 1 then 2 then 3

potent spear
verbal tiger
#

but I really don't know from where to start

potent spear
#

learn how to make a simple bot first which responds on commands

verbal tiger
potent spear
#

<@&831776746206265384> this isn't up-to-date anymore, can this be updated / removed from pins?

visual yarrow
potent spear
visual yarrow
#

What is outdated about it? Do you have time to write an updated version yourself? If so, you could post it here and get the mods/admins to check it out.

#

Or you could open an issue on the community meta repository.

slate swan
placid skiff
#

wdym?

final shard
#

How will I be able to send all bot errors in a channel?

placid skiff
final shard
#

thats complicated

placid skiff
#

To get the members of a server your bot needs to be in that server

#

otherwise he can't access the member of the server

silent portal
#

Hey, is there a way I can get a Bots Embed Message content? Or like the title or smth?

quick gust
#

yes

#

!d discord.Message.embeds

unkempt canyonBOT
quick gust
#

returns a list of embeds

#

!d discord.Embed.title

unkempt canyonBOT
quick gust
#

u can then use this

silent portal
#

oh ok ty

hoary cargo
vital widget
#

I'm using repl to host my bot but it is recognizing my bot token as a name because of the periods in it. it there a way to fix it?

quick gust
#

your token should be a string

#

token = "your_token"

slate swan
cold sonnet
#

and he missed a @ in the decorator too

storm fable
#

Hey Guys, I'm trying to code a message log. If the message gets edited, the bot should send the unmodified message in the channel. How I do that. The "on_message_edit" has no "message" or "ctx"?

slate swan
#

wrong params

#

wait

#

!d discord.on_message_edit

unkempt canyonBOT
#

discord.on_message_edit(before, after)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") receives an update event. If the message is not found in the internal message cache, then these events will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.

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

The following non-exhaustive cases trigger this event...
slate swan
#

it takes a before and an after arg as well

storm fable
slate swan
#

before and after are Message object there.

sick birch
#

It provides you with before and after though

storm fable
visual yarrow
#

And anyone else is welcome to comment too 👀

storm fable
maiden fable
#

👀

slate swan
storm fable
neat pagoda
#

Help

    ticket = await ticket_category.create_text_channel(
        f"{ctx.author.name}-{ctx.author.discriminator}", overwrites=overwrites

I get this error:

Ignoring exception in on_component
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(args, kwargs)
File "main.py", line 1650, in on_component
ticket = await ticket_category.create_text_channel(
AttributeError: 'str' object has no attribute 'create_text_channel'
any ideas on how to fix?

sick birch
#

what is ticket_category?

#

The name of the category?

neat pagoda
#

yes

#

so all tickets are in the same category

sick birch
#

It needs to be the object, not the name

neat pagoda
#

wdum

sick birch
#

It needs to be the category object, not the name

neat pagoda
#

ok

sick birch
#

Do you have the ID of the category?

neat pagoda
#

but I've already defined ticket_category with

TICKET_CATEGORY_NAME = "Active Tickets"

ticket_category = TICKET_CATEGORY_NAME
sick birch
#

Yes, use the ID rather than the name

#

guild.get_channel(ID), will return discord.CategoryChannel

slate swan
sick birch
#

You don't even need 2 variables for the same thing

#
ticket_category_id = 12345678912345678
slate swan
sick birch
#

doubtful

neat pagoda
#

I'll make the most out of these, thx

#

still doesn't create channel

#

:/

slate swan
neat pagoda
#

it says, str object has no value "create_text_channel"

#

@slate swan ^

slate swan
#

not a str

slate swan
neat pagoda
#

I need the ticket_category so it creates in within he category

slate swan
#

its a literal str

neat pagoda
#

where do i put the ticket_category?

slate swan
#
@bot.command()
async def test(ctx):
    if ctx.channel == "943621025495646260":
        embed=discord.Embed(title="Channel Check", description="True")
        await ctx.send(embed=embed)
    else:
        lol1 = discord.Embed(title="False",description="",color=0x9208ea,timestamp = datetime.utcnow())
        await ctx.send(embed=lol1)
#

why this code not work?

slate swan
slate swan
#

it will always be False

scarlet rune
slate swan
#

so what i need to do?

#

and you need the id attr

neat pagoda
#

get rid of the description=" " lol

slate swan
neat pagoda
#

since there is no desc

slate swan
#
@bot.command()
async def test(ctx):
    if ctx.channel == 943621025495646260:
        embed1 = discord.Embed(title="True",description="",color=0x9208ea,timestamp = datetime.utcnow())
        await ctx.send(embed=embed1)
    else:
        embed2 = discord.Embed(title="False",description="",color=0x9208ea,timestamp = datetime.utcnow())
        await ctx.send(embed=embed2)
slate swan
#

i tried still not working

slate swan
#

like this?

#

yes

#

Ty worked

#

yw

neat pagoda
#

I tried

    ticket = await ctx.create_text_channel(ticket_category,
        f"{ctx.author.name}-{ctx.author.discriminator}", overwrites=overwrites
    )
#

still has no value "create_text_channel"

slate swan
#

ctx doesnt have that attr

neat pagoda
#

I removed it already and still didn't work

slate swan
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
neat pagoda
#

so

#

topic=TICKETS?

slate swan
#

it needs a guild obj which you can use the guild where the context was invoked

neat pagoda
#

no

slate swan
neat pagoda
#

category=TICKETS

slate swan
#

yes

neat pagoda
#

got it

#

loldidn't see the Category

slate swan
#

and you can asd the position as well

neat pagoda
#

ok ths

#

no need for pos tho

slate swan
#

then no need for the kwarg

neat pagoda
#

also,

#

it says create_text_channel is undefined

#

huh?

slate swan
#

its a coroutine

#

of the Guild class

neat pagoda
slate swan
#

bro

#

it needs a guild obj where are you making the channel and with what obj?

#

its basic oop

neat pagoda
#

ok lol

#

I need it you see

slate swan
# neat pagoda ok lol

if you want it in the guild where the context was invoked just use ctx.guild which returns a guild object

#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
#

a method of the Guild class lol

#

you probably have 5 instances running or its in a loop

#

yes

#

i dont help in dms.

#

sir Okimii and his private dms

#

my dms are personal and i dont like helping by myself since i love having so many opinions and options here which is great.

#

.reply is in a loop lol

#

the coro should be outside of the loop

#

!e

for number in range(1, 101):
    print(number)
unkempt canyonBOT
ancient raven
#

@unkempt canyonhelp

slate swan
#

why are you pinging the bot

#

on top of your if statements?

#

just delete a tab or 4 spaces in ctx.reply

ancient raven
slate swan
unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

sick birch
#

!code

ancient raven
#

ok ty

slate swan
#

tehe nice robin

sick birch
#

🗿

slate swan
#

lol

sick birch
#

👋

slate swan
#

hey robin can you take this over i wanna play some clash royalepithink

sick birch
#

Uh can’t I gotta get going soon

slate swan
sick birch
#

I’m at school

slate swan
#

imagine

scarlet rune
#

yuh, i've been staring at the docs and tutorials but i can't get my cog work
loaded it with:

for file in os.listdir("./cogs"):
    if file.endswith(".py"):
        bot.load_extension("cogs." + file[:-3])

in the cog py file:

    bot.add_cog(SendDM(bot))
    print("SendDM loaded;")

it never works duh

#

discord.ext.commands.errors.CommandNotFound: Command "send" is not found why is this?

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

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

@slate swan :x: Your eval job has completed with return code 1.

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

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
hoary cargo
#

a web crawler attempt huh Hmm

neat pagoda
#

no 💀 still give the same error

scarlet rune
#

this is pain, all my commands work on the main file

neat pagoda
#

!d discord buttons

unkempt canyonBOT
#

To work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

neat pagoda
#

lol

outer parcel
#

hey everyone this is my bot but i have a problem

hoary cargo
outer parcel
#

if you can see the numbers i want commas in it how would i do that

neat pagoda
slate swan
split plover
#

hey i installed slash commands and interactions module but pycharm can't find it. any suggestions?

outer parcel
#

the numbers are not really clear

scarlet rune
#

here is the full command: what's wrong with it that it's not loaded or even run

from core import *
from addon.embed_responses import *


class SendDM(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.has_role(943902658056552469)
    async def send(self, ctx, user: discord.Member, *, message=None):
        dmmessage = discord.Embed(color=ecolor, description=message)
        dmmessage.set_footer(text=f'from {ctx.author.name}#{ctx.author.discriminator}',
                             icon_url=ctx.author.avatar_url)
        dmmessage.timestamp = dt
        await user.send(embed=dmmessage)
        messagesent = discord.Embed(description=f'<@{ctx.author.id}>, message has been sent to <@{user.id}>',
                                    color=ecolor)
        await ctx.reply(embed=messagesent)


def setup(bot):
    bot.add_cog(SendDM(bot))
    print("SendDM loaded;")
outer parcel
#

and having commaas would help

#

how would i do that

neat pagoda
#

try {:,}

hoary cargo
unkempt canyonBOT
#

class disnake.Button```
Represents a button from the Discord Bot UI Kit.

This inherits from [`Component`](https://docs.disnake.dev/en/latest/api.html#disnake.Component "disnake.Component").

Note

The user constructible and usable type to create a button is [`disnake.ui.Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") not this one.

New in version 2.0.
slate swan
split plover
neat pagoda
#

sorry, no await cyx.send("{:,}".format(1000))

#

@outer parcel ^

sage otter
#

or you can just use an f string and make everyone’s life easier.

outer parcel
neat pagoda
#

just

#

instead of ur numbers

#

put

neat pagoda
#

send me ur code for the rank thing

#

I'll do it

outer parcel
#

its just printing the user wallet

neat pagoda
#

ik

slim ibex
outer parcel
#

that is it

slim ibex
#

and don’t spoon feed

neat pagoda
#

lol

outer parcel
#

ye i use f string

quaint epoch
#

how to open dm with id

slate swan
#

help is an inbuilt function in python

#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
slate swan
#

doesnt matter.

#

you cannot name your help command's name help if you make command groups.

#

use the name kwarg in @command

#

bro dont you see your error?

#

just use the name parameter

#
@bot.group(name="help")
async help_group(ctx):
  ...

@help_group.command()
async def subcommand(ctx):
 ...
hoary cargo
velvet tinsel
#

...

tacit storm
#

???

slate swan
#

subclass the helpcommand.

#

That's why you read the docs and learn python before Making a bot

hoary cargo
#

he's built different

hoary cargo
slate swan
#

making a new command name help is bad which i do but doing that is just something else

hoary saffron
#

data = BytesIO(await asset.read())
AttributeError: 'str' object has no attribute 'read'

error welp me 😩

slate swan
#

error says it all

hoary saffron
#

cool

hoary saffron
#

I noob
👉 👈

tacit storm
#

welp, then sucks to be you!

slate swan
#

^

slate swan
#

bro

hoary saffron
#

😳

#

dont ban me

slate swan
#

delete then

hoary saffron
#

never

slate swan
#

<@&831776746206265384>

hoary saffron
#

SHIT!!!

slate swan
#

not so very discord bots related

dry kelp
#

how can i get a object from the json in a event?

split plover
#

can i give a slash command role permissions?

dry kelp
#
async def update_data(category_logs, guild):
    if not f'{guild}' in category_logs:
        category_logs[f'{guild}'] = {}
        category_logs[f'{guild}']['id'] = 'None'
        category_logs[f'{guild}']['category'] = 'None'
        category_logs[f'{guild}']['channel'] = 'None'

@spooky.command()
async def setup(ctx):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)

    #perms = discord.Permissions(administrator=True)
    channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")

    await update_data(category_logs, ctx.guild.id)
    category_logs[f'{ctx.guild.id}'] = {}
    category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'

    with open(test_path, 'w') as f:
        json.dump(category_logs, f)

@spooky.event
async def on_guild_channel_delete(channel):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)
        category_logs.pop(str(channel.guild.id))
        
    with open(test_path, 'w') as f:    
        json.dump(category_logs, f)
jaunty sparrow
#

!mute 504311046954156035

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @hoary saffron until <t:1645132240:f> (59 minutes and 59 seconds).

dry kelp
#

how can i get the channel object in the on_guild_channel_delete

slate swan
#

thx zig

dry kelp
#

i gotta check if the channel is being deleted

slate swan
#

save the id

dry kelp
#

i am

fresh orchid
#

I have this code

await interaction.response.send_message('Which component chart would you like to view? Respond with "CPU", "GPU", "RAM" or "all" (20s)', view=view)

        async def button_cpu_callback(interaction:discord.Interaction):
            await interaction.edit_original_message(content="

This isnt working and i get the error unkown webhook

my question is qhen I use interaction.respond.send_message is there any way to edit or delete this message

dry kelp
#

already... read the code

slate swan
#

im not

severe raft
dry kelp
#

huh?

short dust
#

what am i doing wrong 😫

slate swan
#

im not gonna read the code that uses json as a db

dry kelp
#

🤷‍♂️

#

what's wrong with that

slate swan
#

<@&831776746206265384> trolls lol

dry kelp
#

i can use what the fuck i want can't i?

split plover
#

can i give a slash command role permissions? like @commands.has_role("ROLE")

slate swan
severe raft
dry kelp
#

what are u so mad about the fact that im using a json as db

slate swan
severe raft
#

I was muted for no reson

dry kelp
#

maybe im not using it as a db

severe raft
jaunty sparrow
#

!ban 420962767307145216 Low effort troll

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @severe raft permanently.

dry kelp
#

im using it as a file

hoary cargo
#

good

dry kelp
#

🤷‍♂️

short dust
#

can someone help me

dry kelp
#

anyways

hoary cargo
slate swan
#

json isnt a db if you want to fight about it go ahead ill destroy you with reasons

dry kelp
#
async def update_data(category_logs, guild):
    if not f'{guild}' in category_logs:
        category_logs[f'{guild}'] = {}
        category_logs[f'{guild}']['channel'] = 'None'

@spooky.command()
async def setup(ctx):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)

    channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")

    await update_data(category_logs, ctx.guild.id)
    category_logs[f'{ctx.guild.id}'] = {}
    category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'

    with open(test_path, 'w') as f:
        json.dump(category_logs, f)

@spooky.event
async def on_guild_channel_delete(channel):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)
        category_logs.pop(str(channel.guild.id))
        
    with open(test_path, 'w') as f:
        json.dump(category_logs, f)
dry kelp
#

a n y w a y s

hoary cargo
#

and we can refuse to help you if we want

dry kelp
#

how can i get the channel object in the event?

slate swan
#

best "antinuke bot" doesnt even have a proper db?

dry kelp
#

THIS IS LITERALLY

short dust
#

you can't use json as a db -🤓

slate swan
#

seems like a low level bot

dry kelp
#

A TESTING BOT

#

I USE SQLITE3

slate swan
tacit storm
#

you can use json as a db

dry kelp
#

HOLY FUCK ... MAN I CAN'T TEST SOMETHING?

tacit storm
#

except, you cant use it well as a db

dry kelp
#

BRO THIS DUDE IS SO MAD THAT IM DOING SOME TESTS ON A TESTING BOT TESTING THE CHANNEL LOG

#

BRO STOP BEING SUCH A CRYBABY

tacit storm
#

sqlite isn’t good either if you’re bot is planning on becoming big

short dust
#

idk i just wanted help this is messed up

dry kelp
#

ur so mad ab it

slate swan
#

i make bots that use dbs easily

dry kelp
#

"low level bot"

#

i am just trying to see how json would work

slate swan
#

it is a low level bot

#

use mongo then?????

dry kelp
#

u don't even know what my bot does

hoary cargo
#

ah here we go, the daily dose of drama

dry kelp
#

mongo is limited at 500mb

#

i prefer using digital ocean databases

#

where im actually using my bot

slate swan
#

.

dry kelp
#

do u see that im using the command in a cog?

slate swan
#

what

sick birch
#

Alright guys what’s the problem now

dry kelp
#

hint: no

#

he's mad that im using json

slate swan
#

bro

dry kelp
#

for a test

#

in my 2nd bot main file

sick birch
#

It’s not recommended but no need to get mad over it, let’s keep it civil in here

dry kelp
#
async def update_data(category_logs, guild):
    if not f'{guild}' in category_logs:
        category_logs[f'{guild}'] = {}
        category_logs[f'{guild}']['channel'] = 'None'

@spooky.command()
async def setup(ctx):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)

    channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")

    await update_data(category_logs, ctx.guild.id)
    category_logs[f'{ctx.guild.id}'] = {}
    category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'

    with open(test_path, 'w') as f:
        json.dump(category_logs, f)

@spooky.event
async def on_guild_channel_delete(channel):

    with open(test_path, 'r') as f:
        category_logs = json.load(f)
        category_logs.pop(str(channel.guild.id))
        
    with open(test_path, 'w') as f:
        json.dump(category_logs, f)
slate swan
#

robin i told him json isnt a db and hes throwing a tantrum

hoary cargo
#

no one is mad tho

dry kelp
#

robin ... im trying to get the channel object in the event

sick birch
#

In what event

dry kelp
#

what im trying to do is to check if the channel is being deleted

#

if it is to pop the guild id

sick birch
#

right

#

So what’s the problem

dry kelp
#

i don't know how to get the object there
how to check if the channel in the json is being deleted

sick birch
#

The channel in the json being deleted?

dry kelp
#

if it is

sick birch
#

You mean on discord?

final iron
dry kelp
#

yes lol

dry kelp
#

i want to see how it works

#

😭

slate swan
dry kelp
#

if this makes sense to u

dry kelp
#

mind ur own business and i don't need ur help ty

cold sonnet
sick birch
sick birch
hoary cargo
#

what's ur problem pepeannoyed

sick birch
#

Keep it civil please

slate swan
#

now everybody attacking me yall a bunch of children

cold sonnet
final iron
dry kelp
#

sorry cuz ur "more mature" than us

sick birch
slate swan
#

honestly yall ask for help and everything you do is wrong

final iron
#

I guess for a testing bot it's fine but I don't see the point as using sqlite3 would be just as easy as json

slate swan
cold sonnet
dry kelp
thorny herald
slate swan
sick birch
#

Guys please calm down

dry kelp
#

basically ur just complaining about my code

slate swan
#

youre irrelevant

dry kelp
#

so STOP doing that

blissful lagoon
#

@thorny herald please re-read our code of conduct

dry kelp
#

and u still saying that ur not mad 😂

#

bro literally stop it here

#

block me .

#

end of conversation

slate swan
#

i cant with these toddlers

bitter depot
#

!shhhhhh

unkempt canyonBOT
#

✅ silenced current channel for 12 minute(s).

bitter depot
#

!mute 637458038915203127 4d Your behaviour in this channel is completely unacceptable. Take a break, and reread our #code-of-conduct. If you have issues with an other user, you contact @novel apex or ping the Moderators role - you don't berate and belittle them.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1645475030:f> (3 days and 23 hours).

bitter depot
#

!ban 404264989147529217 7d You've been told again and again that this isn't the way to interact with our users. I recommend you take this time to seriously consider whether you wish to be a part of this community again, and if you do, then a serious attitude shift is needed.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @dry kelp until <t:1645734375:f> (6 days and 23 hours).

bitter depot
#

!warn 901911911170470008 When there's an issue in a channel, you should alert the moderators by contacting @novel apex and/or pinging the Moderators role. Please don't defer yourself to insulting the users in question.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @thorny herald.

bitter depot
#

Now, let's please get back on topic and stay respectful of one another.

#

!unshhh

unkempt canyonBOT
#

✅ unsilenced current channel.

outer parcel
#

ty

cold sonnet
short dust
#

some1 help?

outer parcel
#
@client.command()
async def test(ctx):
  await ctx.reply('Welcome to the shop choose the category you want below',
                 components=[
                   Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
                 ])
  e1 = discord.Embed(title="Tools",description="Full of tools")
  e1 = discord.Embed(title="Collectible",description="Full of Collectibles")
  e1 = discord.Embed(title="Power up",description="Full of Power ups")
  while True:
    try:
      event = await client.wait_for("test_option",check=None)
      label = event.component[0].label
      if label == "Tool":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e1
        )
      elif label == "Collectible":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e2
        )
      elif label == "Power up":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e3
        )
    except:
      print("error")
sick birch
#

Well that’s over

outer parcel
#

its supposed to take it as an interaction

tacit storm
sick birch
outer parcel
short dust
#

it's weird cus i made this command before but without a embed

#

and it worked, but i can't do it in a embed

cold sonnet
tacit storm
#

sqlite

outer parcel
#

no

sick birch
#

Well json is not a database, so obviously sqlite

final iron
#

Sqlite

#

Json is not a database

cold sonnet
#
  e1 = discord.Embed(title="Tools",description="Full of tools")
  e1 = discord.Embed(title="Collectible",description="Full of Collectibles")
  e1 = discord.Embed(title="Power up",description="Full of Power ups")
```well this part is completely unnecessary
outer parcel
#

i use json as a datastore cuz thisbot is small

outer parcel
#

e silly me

final iron
#

It's more meant for formatting

sick birch
#

Just gonna put this out there but for discord bots use asqlite or aiosqlite rather than sqlite3

cold sonnet
#

postgres 😎

sick birch
#

Even better

cold sonnet
#

wait

#

what would you use on a raspberry

sick birch
#

The database?

tacit storm
cold sonnet
#

which one's rather RAM sparing

cold sonnet
sick birch
#

sqlite is, well, lighter

tacit storm
#

but

sick birch
#

sqlite is more lightweight at the cost of features and security

tacit storm
#

that wouldn’t be good to use with bigger bots

sick birch
#

Nope

outer parcel
#

ee still does not work

pliant gulch
#

edgedb 😳

cold sonnet
sick birch
#

I say this a lot but the way I like to do it is to run a javascript REST API that interfaces with the database using one of their ORMs (typeorm, prisma, etc), and the discord bot can just use aiohttp to send requests, so you don't have to mess with the connectors and sqlalchemy

outer parcel
#

it keeps on saying interaction failed

sick birch
#

but honestly it's just a round about way of doing the same thing

rare saddle
#

!d disnake.ext.commands.has_guild_permissions

outer parcel
#

basically how would i check if player interacted with the button on dropdown menu

tacit storm
cold sonnet
sick birch
pliant gulch
sick birch
#

i'm not a fan of the python database connectors like aiosqlite

cold sonnet
cold sonnet
#

what even is event

pliant gulch
outer parcel
#
  e1 = discord.Embed(title="Tools",description="Full of tools")
  e2 = discord.Embed(title="Collectible",description="Full of Collectibles")
  e3 = discord.Embed(title="Power up",description="Full of Power ups")
  while True:
    try:
      event = await client.wait_for("test_option",check=None)
      label = event.component[0].label
      if label == "Tool":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e1
        )
      elif label == "Collectible":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e2
        )
      elif label == "Power up":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e3
        )
    except:
      print("error")

this is where everything goes wrong

sick birch
pliant gulch
#

Python has ORM librarys too

#

There is a prisma ORM, etc

sick birch
#

i'm sure it does but i haven't used any of them yet 👀

pliant gulch
#

so as long as you don't use sqlalchemy

cedar stream
#

I haven’t used it yet

sick birch
#

i was under the impression sqlalchemy was the most popular one

outer parcel
cold sonnet
#

what's the type of it

outer parcel
#

wdym

cold sonnet
#

I have to know so I can search it on the docs thinkingzoliba

#

after your wait_for, put
print(type(event))

pliant gulch
#

There are much better options

cedar stream
cold sonnet
#

makes sense

pliant gulch
#

I prefer writing raw sql anyways

outer parcel
#

ok

cedar stream
cold sonnet
sick birch
outer parcel
#

ah ok

cold sonnet
#

okay but what's the type

outer parcel
#

me ?

cold sonnet
#

yeah

outer parcel
#

it does not output anythin

pliant gulch
cold sonnet
sick birch
cold sonnet
#

does it even reach the wait_for?

cedar stream
#

People seem to like sqlalchemy

pliant gulch
cold sonnet
outer parcel
#

ive been testing on debugging

pliant gulch
#

Yea, sure

outer parcel
#
  while True:
    try:
      print("Hi")
      event = await client.wait_for("test_option",check=None)
      label = event.component[0].label
      if label == "Tool":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e1
        )
      elif label == "Collectible":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e2
        )
      elif label == "Power up":
        await event.respond(
          type=InteractionType.ChannelMessageWithSource,
          ephemeral=True,
          embed=e3
        )
    except:
      print("error")

it does not reach this part

cold sonnet
#

what do you have before the embeds

cedar stream
outer parcel
#
@client.command()
async def test(ctx):
  msg = await ctx.reply('Welcome to the shop choose the category you want below',
                 components=[
                   Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
                 ])
  print(msg)

#

it prints the msg

#

and works

sick birch
#

I think i recognize the while True: approach

outer parcel
#

yes

#

it uses discordcomponents

sick birch
#

Ah

cold sonnet
#

I don't even know where it could have went wrong

sick birch
#

Though I would recommend the discord.py way to do it over this approach

cedar stream
cold sonnet
#
@client.command()
async def test(ctx):
  msg = await ctx.reply('Welcome to the shop choose the category you want below',
                 components=[
                   Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
                 ])
  print(msg)
  #succesful
  e1 = discord.Embed(title="Tools",description="Full of tools")
  e2 = discord.Embed(title="Collectible",description="Full of Collectibles")
  e3 = discord.Embed(title="Power up",description="Full of Power ups")
  #no idea honestly
  while True:
  #no
sturdy cloud
#

Can anyone help me in dms

cold sonnet
#

ask here

sturdy cloud
#

Oke

cedar stream
sturdy cloud
cold sonnet
#
  1. indent it (press tab)
  2. that blocks
#

use await asyncio.sleep()

sturdy cloud
#

Wym

#

Ok

cedar stream
cold sonnet
#

thanks

sick birch
sturdy cloud
#

Oke

cold sonnet
#

meaning while you use time.sleep(), the other part of your code will sleep aswell

cedar stream
#

Basically when you do time.sleep, It’ s basically punching ur bot in the face

cold sonnet
sick birch
#

Interesting analogy

pliant gulch
#

You sleep long enough, your bot won't send heartbeat in time and it will get disconnected by discord

outer parcel
#

imvery confused on what to do now

cedar stream
#

If you do asyncio.sleep you just wait in that part of code

cedar stream
pliant gulch
#

Yea, you can block the heartbeating

cold sonnet
#

sh

cedar stream
cold sonnet
#

bro forgets to breathe

cold sonnet
pliant gulch
cedar stream
cold sonnet
#

@outer parcel send your current full code

#

with the debugs and all

cedar stream
sturdy cloud
#

How fix

cold sonnet
#

press tab

#

in the start of that line

pliant gulch
#

mobile coding 👁️ 👁️

cold sonnet
#

with the asyncio sleep

cedar stream
#

At least he changed it to asyncio.sleep

cold sonnet
#

and you have to use await

pliant gulch
cedar stream
cold sonnet
#

I got a flashbang on my mind

cedar stream
#

Lmao

cold sonnet
#

coroutines mean co-routines

#

because they work together

sturdy cloud
cedar stream
cold sonnet
#

this is my moment of evening-morning realisations

sturdy cloud
#

How i fix this tho

cedar stream
#

Wdym they work together

pliant gulch
cedar stream
cold sonnet
sturdy cloud
#

Huh?

#

Am new coder idk shit

pliant gulch
#

multispam 👁️ 👁️

cedar stream
sturdy cloud
#

??

#

Ignore my ass names

cedar stream
#

Async is still one thread

cedar stream
sturdy cloud
#

Uh

#

I just wanna add a wait cmd rn

#

But it says time.sleep(float(delay)) is wrong

outer parcel
#

can anyone help me with how to check for dropdown menu response

outer parcel
cedar stream
sturdy cloud
verbal cairn
#

Or callback

#

Idk what u mean exactly

outer parcel
#

asyncio

cedar stream
#

outer parcel
sturdy cloud
verbal cairn
#

There’s seperate formats look up discord time formatting, uses Unix time

cedar stream
outer parcel
#
    await asyncio.sleep(20)
kindred epoch
#

how do i make a reminder command?

sturdy cloud
#

Ohh

#

Nice ok ty

final iron
unkempt canyonBOT
#

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

outer parcel
#
@client.command()
async def test(ctx):
  msg = await ctx.reply('Welcome to the shop choose the category you want below',
                 components=[
                   Select(
                     placeholder='Select category...',
                     options=[
                       SelectOption(label='Tool',value='tool'),
                       SelectOption(label='Collectible',value='collectable'),
                       SelectOption(label='Power up',value='powerup'
                     )])
                 ])
  print(msg)


@client.event
async def on_select_option(interaction):
  e1 = Embed(title="Tools",description="Full of tools")
  e2 = Embed(title="Collectible",description="Full of Collectibles")
  e3 = Embed(title="Power up",description="Full of Power ups")
  
  await interaction.respond(type=6)
  
  if interaction.values[0] == "tool":
      await interaction.author.send("tool")
  elif interaction.values[0] == "collectable":
      await interaction.author.send("collectable")
  elif interaction.values[0] == "powerup":
      await interaction.author.send("power up")
#

error is within interaction

cedar stream
slate swan
#

It works like <r:1873t>

#

I forgot tbh😭

#

<r:198392t>

sturdy cloud
final iron
sturdy cloud
#

No

final iron
#

Pretty obvious you're spamming

sturdy cloud
#

I only test on myself

final iron
#

Yeah sure

kindred epoch
cedar stream
slate swan
#

<t:198392:t>

slate swan
kindred epoch
cedar stream
naive spoke
#

how to i make the bot add reactions and how to reconize them

cedar stream
#

I apologise @final iron

kindred epoch
final iron
cedar stream
final iron
#

Because if multispam == "y"

final iron
#

There's also a file called webhook spammer

cedar stream
#

Do that every couple of minutes in a task

cedar stream
# naive spoke help?

There is a message.add_reactions method or something and slso on_reaction_add event

hoary cargo
magic ore
#

that doesn't work if the bot restarts for example

final iron
#

!rule 5

#

Hmm

#

<@&831776746206265384> 897946066731814933

sturdy cloud
#

No proof

bitter depot
#

!shhhh

#

@sturdy cloud we're not going to help with code that violates ToS, such as a webhook spammer.

unkempt canyonBOT
#

✅ silenced current channel for 8 minute(s).

bitter depot
#

!unshh

unkempt canyonBOT
#

✅ unsilenced current channel.

tacit storm
#

i saw that ad well

sick birch
bitter depot
#

It's being handled internally

naive spoke
cedar stream
unkempt canyonBOT
#
Naw.

No documentation found for the requested symbol.

cedar stream
#

I honestly forgot It’ s name

#

Just look in the docs, ull find it

tacit storm
naive spoke
#

k

unkempt canyonBOT
#

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

Add a reaction to the message.

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

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

^

cedar stream
tacit storm
naive spoke
#

ok but under the await add_reaction(emoji) can i put await.ctx.send

sick birch
#

of course

tacit storm
#

yeah

cedar stream
#

You gotta send message first, then add reaction to it

#

After that you can do whatever u want

naive spoke
# tacit storm yeah

or is there another way to send the message and react the message the bot put in

naive spoke
naive spoke
#

like if i say !test and the bot outputs somthing and reacts to its own

cedar stream
sick birch
#

<t:TIMESTAMP:F>
where F is the format yo uwant

cedar stream
#

<t:198392:t>

naive spoke
cedar stream
#

May be wrong

#

Look in docs

outer parcel
#

there are a lot of tutorials on yt on discord.py reactions just watch those

slate swan
#

Just use the time library

#

Wym

sick birch
#

<t:TIMESTAMP:F>

#

Actually you may be looking for <t:TIMESTAMP:f>

#

that only provides the month and not the day

short dust
sick birch
#

put in the unix seconds

sick birch
#

seconds since jan 1 1970 iirc

#

1645133075 would be the unix time now

#

<t:1645133075:f>

naive spoke
#

the command is there but its saying its not

@client.command(name= 'test')
async def vir(ctx: commands.Context):
    await ctx.send('click here for role')
    await message.add_reaction(':check:')

discord.ext.commands.errors.CommandNotFound: Command "test" is not found

short dust
#

so the error isn't in the API ;p

sick birch
#

Yeah

sick birch
#

Maybe it's expecting double quotes instead of single quotes?

#

yeah

#

well it's going to be the timestamp when they joined, not the timestamp now

sick birch
#

<t:TIMESTAMP:R> will provide a relative timestamp

short dust
naive spoke
#

ik it looks stupid

sick birch
#

User joined the server <t:1645133075:R>

sick birch
hoary cargo
# cedar stream Thats the lazy option

The only options are that or using a db/json to store the time, not worth for just a reminder command that probably no one will use, the sleep method works fine if you know your host don't have problems with the uptime

sick birch
#

member.created_at

#

No, that's a datetime.datetime object

#

member.created_at.timestamp() will give you the unix time when the user created their account

#
f'<t:{member.created_at.timestamp()}:f>'
hoary cargo
sick birch
final iron
sick birch
#

Discord timestamps take into account the region the person is in and it updates live

#

For example, using 24-hour time for europe, 12-hour time in U.S, that sort of thing

short dust
#

@sick birch , i changed description to = id and defined id as id = data.get ("id") and it worked, ty for the support

neat pagoda
#

why is there an unexpected indent?

@bot.command()
async def pages(ctx):
  guild = ctx.guild
  message = await ctx.send("React To This To Get A Ticket")
  
  await message.add_reaction("📩")
  
  def check(reaction):
    return str(reaction.emoji) in [":envelope_with_arrow:"]
    while True:
      try:
        reaction = await bot.wait_for("reaction_add", timeout=None,check=check)
        if str(reaction.emoji) == "📩":
          await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")

keep_alive()
...
#

I'm confused

sick birch
#

You probably meant to have the while True: outside of check

#

member.roles[1:]

#

Yep

naive spoke
#

the command is there but its saying its not

@client.command(name= 'test')
async def vir(ctx: commands.Context):
    await ctx.send('click here for role')
    await message.add_reaction(':check:')

discord.ext.commands.errors.CommandNotFound: Command "test" is not found

#

?

brave vessel
#

Is there a way to get the time zone of a user?

neat pagoda
#

nope

#
@bot.command()
async def ticket(ctx):
  guild = ctx.guild
  message = await ctx.send("React To This To Get A Ticket")
  
  await message.add_reaction("📩")
  
  def check(reaction):
    return str(reaction.emoji) in [":envelope_with_arrow:"]
  while True:
    try:
      reaction = await bot.wait_for("reaction_add", timeout=None,check=check)
      if str(reaction.emoji) == "📩":
        await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")
#

still bugged

sick birch
brave vessel
sick birch
#

for example <t:1645133075:f> will look different for us depending on where we live

brave vessel
#

Closest thing I might be able to get to it is locale then I suppose

naive spoke
#

thats it?

sick birch
brave vessel
#

manual input sucks to convert to but I guess that's my only option

naive spoke
#

im still having the same error

sick birch
#

Unfortunately

brave vessel
#

I hope Discord adds the timezone of the user someday, could be quite useful

brave vessel
neat pagoda
#

how do u get this to work?

@bot.command()
async def ticket(ctx):
  guild = ctx.guild
  message = await ctx.send("React To This To Get A Ticket")
  
  await message.add_reaction("📩")
  
  def check(reaction):
    return str(reaction.emoji) in [":envelope_with_arrow:"]
  while True:
    try:
      reaction,user = await bot.wait_for("reaction_add", timeout=None,check=check)
      if str(reaction.emoji) == "📩":
        await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")
naive spoke
# brave vessel what's the code of the entire file (don't include the token)?
client = commands.Bot(command_prefix='?')
@client.command(name='hi')
async def version(ctx):
    myEmbed = discord.Embed(title= f"Hello {ctx.author.name}" , color=0x0ff00)
    myEmbed.set_footer(text="ur kool")
    

    await ctx.send(embed=myEmbed)


    @client.command(name='VVD')
    async def virgil(ctx: commands.Context):
      await ctx.send("is the best defenda")

@client.command(name='mood')
async def moodd(ctx):
    kk = [":grinning:", ":smile:", ":smiley:"]
    randemj = random.choice(kk)
    await ctx.send(f'your emoji is {randemj}')




@client.event
async def on_message(message):
    if message.content == 'why is moazzam dum':
        

     message=("why not")

        
    
    await client.process_commands(message)

@client.command()
async def test(ctx):
    await ctx.send('click here for role')
    await message.add_reaction(':white_check_mark:')
neat pagoda
cold sonnet
#

which line

neat pagoda
#

it's a ticket command making use of pages command I have

cold sonnet
#

guess it's an IDE issue

#

restart go

neat pagoda
#

ok

brave vessel
#

send the full traceback please

#

!tb

cold sonnet
#

+deindent second command

cedar stream
full lily
#

<t:1645066068.105:f>

#

seems your timestamp is invalid

neat pagoda
#

sgtill does not work, wtf

@bot.command()
async def pages(ctx):
  guild = ctx.guild
  message = await ctx.send("React To This To Get A Ticket")
  
  await message.add_reaction("📩 ")
  
  def check(reaction):
    return str(reaction.emoji) in ":envelope_with_arrow: "
  while True:
    try:
      reaction,user = await bot.wait_for("reaction_add", timeout=None,check=check)
      if str(reaction.emoji) == "📩 ":
        await guild.create_text_channel(f"{ctx.author}s Ticket",category="TICKETS")
full lily
#

@slate swan

#

<t:1645066068:f>

flat solstice
full lily
#

<t:1645066068:f> is <t:1645066068:f>

#

without the .105

full lily
#

convert it to an integer

slate swan
#

I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3)

full lily
#

how can it be an integer if it has a decimal point

#

unless it's a string

rotund creek
#

Why is none of my commands working

full lily
#

use int()

rotund creek
#

No errors though

#

It was working yesterday

full lily
#

something broke

rotund creek
#

How do I know what did

flat solstice
full lily
#

troubleshooting ✨

#

your second one isn't an epoch. It looks like a whole date string

rotund creek
#

The bot online

slate swan
#

I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3) - Folder Name: Data\

full lily
#

it needs to be an epoch

modest plover
#

Hi, still trying a timeout. Is there a way to make the duration be in something other than seconds?

manic wing
modest plover
#

Literally anything other than seconds

manic wing
#

joined_at returns datetime.datetime

full lily
#

there should be a .epoch() method for datetime

manic wing
modest plover
#

Lmao

slate swan
#

I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3) - Folder Name: Data\

full lily
#

an epoch is time in seconds since 1 January 1970

#

aka "UNIX time"

#

I already did

manic wing
#

well created_at also returns datetime.datetime…

full lily
#

you need to add .epoch() method to the datetime object you're getting

manic wing
full lily
#
``<t:{int(member.created_at.timestamp().epoch())}:f>``
#

try this. I'm not actually sure this works

#

but we'll find out now :)

manic wing
naive spoke
slate swan
#

but on my pc works but if i host it on vps it dont work

manic wing
slate swan
cedar stream
slate swan