#discord-bots

1 messages · Page 1027 of 1

supple thorn
#

Yes

paper sluice
#

relative(ity) Einstien, fuck i need to do that chapter

supple thorn
paper sluice
#

hi

supple thorn
#

Oh yeah i need to do you too

paper sluice
#

😳 what

slate swan
supple thorn
slate swan
#

Is it possible for a bot to get a deleted image or embed?

supple thorn
#

Don't know about embed

slate swan
#

Because I have a command for message snipe

#

But isn’t working on image deletion

#

👀

maiden fable
unkempt canyonBOT
#
Fat chance.

No documentation found for the requested symbol.

maiden fable
#

Bro what the

#

!d discord.Message.embeds

unkempt canyonBOT
maiden fable
#

I mean

supple thorn
unkempt canyonBOT
supple thorn
#

Cause that's how mine works

slate swan
#

..

maiden fable
dull terrace
#

A bot can only respond to its own buttons right?

#

someone couldn't for example, copy your custom_id then get your bot to respond to it through on_component or on_button or whatever

dull terrace
supple thorn
dull terrace
#

you'd think that'd be the case but you never know froggy_chill

slate swan
#

.

slate swan
#

The gist is basically a copy paste of that - so the API documentation is your go-to website for such information.

zenith mural
#
@bot.command(name = "avatar", dscription = "sends A users profile picture")
async def avatar(ctx, member: discord.Member):
    show_avatar = discord.Embed(
        color = (discord.Color.random())

    )
    show_avatar.set_image(url = '{}'.format(member.avatar_url))
    await ctx.send(embed = show_avatar)
#

hey i was trying to make an avatar command for my discord bot and it its giving me this error

#

can someone please help me

sick birch
#

maybe you have a corrupted install?

slate swan
#
@client.listen("on_guild_leave")
async def foo(guild):
    channel = guild.text_channels[0]
    rope = await channel.create_invite(unique=True)
    me = client.get_channel(967677661545652264)
    await me.send("``I have been removed frm:``")
    await me.send(rope)
``` why this is not working?
#

This is wrong?

heady sluice
#

error?

slate swan
#

No error

heady sluice
#

error eating error handler?

slate swan
heady sluice
#

it is what it is says

slate swan
heady sluice
#

huhn't

slate swan
#

huh?

heady sluice
#

what's huh about what I said

#

or asked

slate swan
#

error eating error handler

heady sluice
#

yes

#

which eats up errors

slate swan
#

u said error eating error handler not error handler eating error

heady sluice
#

are you Englishing me

slate swan
#

...

heady sluice
#

cuz I can English very well

slate swan
#

bruh

heady sluice
#

and it's right what I said

#

error-eating is me adjective

slate swan
#

Englishing

#

smh

slate swan
heady sluice
#

an exercise

slate swan
heady sluice
#

do you mean an activity

slate swan
#

Stop englishing me

heady sluice
#

anyways back to topic cuz I know what I said

slate swan
#

ok

#

🧢

#

?

heady sluice
#

do you mean not working cuz of the pylance error

slate swan
#

🧢

slate swan
stray carbon
#
    async def send_cog_help(self, cog: commands.Cog):
        """implements cog help page"""
        prefix = self.context.clean_prefix
        invoked_with = self.invoked_with
        embed = nextcord.Embed(
            title=f"{cog.qualified_name} Commands", colour=self.COLOUR
        )

        embed_fields = []
        if cog.description:
            embed.description = cog.description

        filtered = await self.filter_commands(cog.get_commands(), sort=True)
        for command in filtered:
            name=self.get_command_signature(command)
            value=command.short_doc or "..."
            embed.fields.append((name, value))
            
        pages = HelpButtonMenuPages(
            ctx=self.context,
            source=HelpPageSource(self, embed_fields),
            disable_buttons_after=True
        )
        await pages.start(self.context)

not showing up cmds

heady sluice
stray carbon
#
class HelpPageSource(menus.ListPageSource):
    def __init__(self, help_command, data):
        self._help_command = help_command
        # you can set here how many items to display per page
        super().__init__(data, per_page=2)

    async def format_page(self, menu, entries):
        """
        Returns an embed containing the entries for the current page
        """
        prefix = self._help_command.context.clean_prefix
        invoked_with = self._help_command.invoked_with
        embed = nextcord.Embed(title="Bot Commands",
                               colour=self._help_command.COLOUR)
        for entry in entries:
            embed.add_field(name=entry[0], value=entry[1], inline=False)
        # set the footer to display the page number
        embed.add_field(
            name="_ _",
            value=f'*Page {menu.current_page + 1}/{self.get_max_pages()}*',
            inline=False)
        return embed
slate swan
heady sluice
#

cuz your old foo isn't gonna be anything

#

and that sucks for you

slate swan
#

@heady sluice

heady sluice
#

just name it something else

#

like fooo

#

you can't have two foos

#

ok

slate swan
#

K

heady sluice
#

then it's cap

slate swan
#

@heady sluice what is foo?

heady sluice
#

a name

slate swan
#

Ohh

#

Thank brother done @heady sluice

heady sluice
#

but there might be something else

slate swan
#

👀

heady sluice
#

how do you get a channel from a guild you aren't in

#

and create an invite to it

#

does that work

slate swan
#

Yes

heady sluice
#

can you create an invite to this server after you left

slate swan
#

Join logs are working

slate swan
#

😎

heady sluice
#

you assuming I'm a human
what I gotta do to get it through to you I'm superhuman

blissful osprey
#

Hey, does anyone have any GitHub or code they’re willing to share to make a simple YouTube player bot? Tried to make one but I’m stuck a bit

unkempt canyonBOT
#

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

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

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

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

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

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

So i was working on a fix for my work when suddenly i see something like this:
if var=="0" where var could be 0.0
I wanna meet the guy who did this and shake his hand

#

||that was the issue in the end||

zenith mural
flint isle
slate swan
#

quite clear as well here if you have any more confusion

flint isle
#

Well discord cleared my message when it reloaded. Umm. Do I need to create an action row to add a button?

slate swan
flint isle
frozen patio
#

Wow it's been a while since I worked with Python

slate swan
slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

<__main__.A object at 0x7f8a27a390f0>
flint isle
#

So like in the doc?

class disnake.ui.ActionRow(*components):```
slate swan
#

no thats its source code?

#

and thats the class signature?

flint isle
#

Wait what class do I call for the actions then?

slate swan
#

is there something in which i can get len messages of member
instead of using channel history and all

paper sluice
#

ya? oh... idrk

paper sluice
#

i dont really know

slate swan
slate swan
#

pretty sure you can't do that without making too many requests

#

!d discord.TextChannel.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
slate swan
#

but there's a "limit"

#

oh

placid skiff
#

it is just the max number of message to retrieve

#

if it is set to None, all message will be retrieved

slate swan
#
               async for message in channel.history(limit=None):
                    if message.author == user:
                         count += 1
#

im using this rn

placid skiff
#

the max of message here is set to 100, it is the default so

slate swan
#

hey guys, does anyone have an idea on how could i make a command using raw api only?

slate swan
#

unix time

#

<t:timestamp integer:R>

slate swan
slate swan
#

🤦‍♂️ no

#

docs

uncut portal
#

The discord API docs are so dry and unhelpful (however this one doesn't happen to be that bad, it's not like http api documentation)

slate swan
#

how can i check if every user in the server has a specific role? this isnt working

sick birch
#

I would recommend everyone to at least attempt to connect to the websocket manually and get events dispatched to you at least once because it's an excellent learning oppurtunity

slate swan
sick birch
#

Sure, post relavant code, tracebacks if available, and any other relavant pieces of information

slate swan
#

ty

uncut portal
sick birch
#

It is a hassle, but hassles are gold mines when it comes to knowledge

uncut portal
#

Is that how you spell hassle

slate swan
#

so this is my code, and when i run it it sends "[]", and prints "{bot} no role"

vocal plover
#

I'm only on my uh... 13th Discord wrapper now aguilt

slate swan
uncut portal
vocal plover
#

it is kekw

slate swan
slate swan
#

im really new to this

slate swan
slate swan
slate swan
#

code

#
@bot.command()
async def rolecheck(ctx, role:discord.Role):
    users = []

    for member in ctx.guild.members:
        if role in member.roles:
            users.append(member)
        else:
            print(f'{member} no role')
    await ctx.send(users)
#

you are missing member intents

#

ye ig

#

what are they

#

!intents

#

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

slate swan
#

lol

paper sluice
slate swan
#

still not workiung

#

did you add the intents thing?

#

show code

#

show updated code

#
@bot.command()
async def rolecheck(ctx, role:discord.Role):
    users = []

    for member in ctx.guild.members:
        if role in member.roles:
            users.append(member)
        else:
            print(f'{member} no role')
    await ctx.send(users)

this is at the top fo the code:

import discord
from discord import Intents
from discord.ext import commands
import datetime

from urllib import parse, request
import re

bot = commands.Bot(command_prefix='!', description="This is a Helper Bot")
intents = Intents.default()
intents.members = True
paper sluice
#

intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', description="This is a Helper Bot", intents=intents)
slate swan
#

did you read the full embed?

#

i was just changign it to what ryuga sent me

#

you need to turn them on from dev portal too

paper sluice
#

go to ur bot dash board and enable the privilages

slate swan
#

it has admin

#

thats not related.

paper sluice
#

u need to enable the intents thing in ur bot dashboard

#

admin doesn't solve it

slate swan
#

wait

slate swan
#

i got this:
[<Member id=504014438383222804 name='!SomeoneIsADev' discriminator='7716' bot=False nick=None guild=<Guild id=971792479609307207 name='Bot Dev' shard_id=None chunked=True member_count=4>>, <Member id=879861362476605440 name='!chrxst' discriminator='5367' bot=False nick=None guild=<Guild id=971792479609307207 name='Bot Dev' shard_id=None chunked=True member_count=4>>, <Member id=921111324862341150 name='bigsmoke' discriminator='0187' bot=False nick=None guild=<Guild id=971792479609307207 name='Bot Dev' shard_id=None chunked=True member_count=4>>]

#

how can i filter it down to just the names and discriminator

#

!d discord.Member

unkempt canyonBOT
#

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

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

@bot.event

#

No brackets

slate swan
slate swan
slate swan
#

it shows there that discord.Member has an attribute called "name" and "discriminator"

slate swan
# regal pulsar Send the code
@bot.command()
async def rolecheck(ctx, role:discord.Role):
    users = []

    for member in ctx.guild.members:
        if role in member.roles:
            users.append(member)
        else:
            print(f'{member} no role')
    await ctx.send(users)
regal pulsar
slate swan
#

discord.Member.name will return the username, discord.Member.discriminator will return the discriminator

slate swan
regal pulsar
#

!d discord.Intents

unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way.
You can set and retrieve individual bits using the properties as if they
were regular bools.

To construct an object you can pass keyword arguments denoting the flags
to enable or disable...
slate swan
slate swan
regal pulsar
#

;(

slate swan
#

i don't really know

#

¯_(ツ)_/¯

#

it's better anyway, teaches more about reading docs

regal pulsar
unkempt canyonBOT
#

property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.name "discord.User.name")
slate swan
#

well i linked it and the guy didn't even notice so

#

i assume he hasn't looked @ it before

#

well hes a beginner so its quite confusing for him

#

gotta learn at some point

#

giving him docs wont really make him learn about methods of a class and all oop

#

he even stated hes new to this atleast give him a little more help no?

#

i was willing to

#

thats good

#

until you butted in that is

#

not really i was giving a suggestion which can be useful for him

#

yeah i know

#

i'm just letting you know

#

is there any reason to be using discord.Object?

#

well the reason your code isn't triggering is

#

probably because you haven't set up intents

#

seems like old code as well

#

bot.respond👁️👁️

#

no

#

you don't have ctx in this context

#

lol, no context in this context

#

and the class doesnt even have that method

paper sluice
#

dont just copy the code from a tutorial, first understand what it does. If u get stuck refer to the docs, when u blindly copy code, its very hard to fix it

slate swan
#

what you should do instead is first make sure the function is even triggering, so we gotta teach you about gateway intents

#

and then you can go for the better practice of fetching the channel instead

#

!intents | or just read this which explains quite well

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.

slate swan
#

yeah i was gonna link to that 😅

potent spear
#

I’ll send you a link, one sec

#

So it’s
<t:TIMESTAMP:STYLE>

#

See link for what the different styles are ofc

maiden fable
#

!d discord.utils.format_dt exists

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
potent spear
#

Lovely

#

TIL

#

Uhm, that’s relative. Not that hard

#

Just pick a timestamp in the future…

#

Try it first… the syntax is right there ^

#

You never defined a timestamp

#

Nor did you use the syntax

zenith mural
potent spear
#

Right

zenith mural
#

or you can define it in the embed

#

Statement

#

What

maiden fable
#

!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.
zenith mural
#

bot = commands.Bot(command_prefix = "")

slate swan
#

im trying to remove a role, the command looks like this : !removerole @stray scarab @role

code:

@commands.has_permissions(administrator=True)
@bot.command()
async def removerole(ctx, role:discord.Role):
    role = discord.utils.get(server.roles, name=role)
    await client.add_roles(message.author.id, role)

can someone fix this for me

potent spear
#

You need to use commands.Bot for this ( basically discord.Client with command system & tasks )

slate swan
zenith mural
#

First stop using on message I'll get easier for you to add a prefix

potent spear
zenith mural
potent spear
#

Also, you don’t need to get the role, once you typehint it, it’s automatically a role object

slate swan
potent spear
slate swan
# potent spear ctx, member: discord.Member, role: discord.Role)
@commands.has_permissions(administrator=True)
@bot.command()
async def removerole(ctx, user: discord.Member, role:discord.Role):
    role = discord.utils.get(server.roles, name=role)
    await client.add_roles(message.author.id, role)

how can i make this remove the roll of the specified person and role

zenith mural
#
from discord.ext import commands
#

add this too

potent spear
zenith mural
potent spear
zenith mural
potent spear
zenith mural
#

did you define bot?

potent spear
#

copied

slate swan
# potent spear await user.remove_roles(role) Also, you can remove that role=… line

got this error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

my code:

@commands.has_permissions(administrator=True)
@bot.command()
async def removerole(ctx, user: discord.Member, role:discord.Role):
    
    await user.remove_roles(role)
    cxt.send('Done')
potent spear
potent spear
#

Also, make sure the one who invokes the command has admin rights ofc

slate swan
#
@bot.command()
@commands.has_permissions(administrator=True)
async def removerole(ctx, user: discord.Member, role:discord.Role):
    
    await user.remove_roles(role)
    await cxt.send('Done') 
dire folio
#

ctx not cxt

slate swan
#

the get_user is returning None, and you're getting the user instead of the member...?

slate swan
#

well it isnt

#

but anyways

river ginkgo
#

alexa google how to make a sigma balz

#

wrong chenel

heady sluice
#

good one

river ginkgo
#

dam bro

#

im not funny

light violet
#

how to frtch a particular audit log action like ban with aiohttp

#

fetch*

exotic maple
#

Anyone can help me?

for emoji in ('👍', '👎'):
    await msg.add_reaction(emoji)

** I want it to edit an embed when user reacts with an emoji**

How do i make the bot detect when a user reacts to the embed?

#

Anyone?

slate swan
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...
exotic maple
slate swan
unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission
to get this information.

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list...
glacial echo
#
  warnings.warn(```
whats wrong with this?
#

idk why its erroring as the same code worked for my other bot

torn sail
#

When Inviting the bot

exotic maple
#

` await ctx.reply(embed=reply_embed, hidden=True)
await msg.add_reaction('👍')
await msg.add_reaction('👎')

new_em = discord.Embed(color=0xf3e914, description=f"\n{suggestion}\n\n**Thoughts**\n{len(msg.reactions.count)}")
new_em.set_author(name=f"Suggested by {ctx.author}", icon_url=f"{ctx.author.avatar_url}")
new_em.set_thumbnail(url=f"{ctx.author.avatar_url}")
new_em.set_footer(icon_url=f"{ctx.guild.icon_url}", text=f"Running /suggest • {round(bot.latency * 1000)} Ms")
new_em.timestamp = datetime.datetime.utcnow()`

I sorta want the msg = embed to be replaced by new_em when a user reacts with the emoji

slate swan
torn sail
#

wait_for is better

slate swan
exotic maple
slate swan
velvet haven
#
@client.group(invoke_without_command=True)
async def help(ctx):
  embed = discord.Embed(title="**Help**",discription="**Type g!help <command> for more help!**",color=random.choice(client.colors),inline=True)
  embed.add_field(name="ask",value="Answers yes or no to a question")
  embed.add_field(name="clear", value="Deletes messages")
  await ctx.send(embed=embed)```
this command does not show discription can anyine help
slate swan
velvet haven
#

shit

#

im dumb

slate swan
#

hey, how to make the parameter a channel object?

honest shoal
#

!d discord.TextChannel

unkempt canyonBOT
slate swan
#

Alr

#

I tried discord.Channel and I was like huh lol

honest shoal
#

it includes every kind of channel

slate swan
#

hey, i'm looking to make a verification bot so when a user reacts to a message the bot dm's the user

#

i currently have this code but the reaction_message.id it's not working

#
from discord.ext import commands

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

client = commands.Bot(command_prefix = '', intents=intents)

@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.do_not_disturb)
    print('Tou a funcionar crl')

@client.event
async def on_raw_reaction_add(payload):
    if payload.emoji == "\u2705" and reaction_mesage.id == 971835858065952799:
        await payload.member.send("Hey")```
#

i currently have this code but the reaction message id it's giving a error

#

i'm not seeing how to use the on_raw_reaction_add correctly

honest shoal
#

because its not proper

#

!d discord.Reaction.message

unkempt canyonBOT
slate swan
#

any1 can help with this? thanks!

honest shoal
#

so it will be Reaction.message.id == {your_id}, Reaction being the reaction object

dull terrace
#

is there a way to do this if statement in one line without having to be redundant?

#

could i just do any(player.y == 22, player.y % 100 == 0)

vocal plover
#

For just two items thats probably worse, you could simply do elif object_id == 3 and (stmt or stmt):

slate swan
#

How to get timestamps in your messages guys?

#

like this

dull terrace
#

okay thanks

honest shoal
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
slate swan
#

Lemme look at it

slate swan
#

Is that like,
time = discord.utils.format_dt(datetime.now)
await ctx.send(time)

exotic maple
#

Ive read the documentation but idk

honest shoal
#

it will show the default timestamp ie f

drifting arrow
#

How do discord bots on lots of servers avoid getting rate limited?

slate swan
#

How can I display the number of servers that have a bot?

exotic maple
#

{len(bot.guilds)}

slate swan
#

thx

glacial echo
#

that fixed it and now the bot works

slate swan
# honest shoal yes

Alright, I managed to get the time.
But how could I make the bot count down on how long it will still take?
Because now it just shows me a date.

slate swan
glacial echo
#

is it feasible to install disnake and whatever other plugins in using and pushing them to my git repo so i can clone them and not have to deal with pip

velvet compass
#

You would still need to install the dependencies though

slate swan
#

you could just have a requirements.txt file so your setup file actually knows what dependencies the package needs

glacial echo
#

my issue is pip is whining about some ssh error

slate swan
#

ssl?

exotic maple
#

` await ctx.reply(embed=reply_embed, hidden=True)
await msg.add_reaction('👍')
await msg.add_reaction('👎')

new_em = discord.Embed(color=0xf3e914, description=f"\n{suggestion}\n\n**Thoughts**\n{len(msg.reactions.count)}")
new_em.set_author(name=f"Suggested by {ctx.author}", icon_url=f"{ctx.author.avatar_url}")
new_em.set_thumbnail(url=f"{ctx.author.avatar_url}")
new_em.set_footer(icon_url=f"{ctx.guild.icon_url}", text=f"Running /suggest • {round(bot.latency * 1000)} Ms")
new_em.timestamp = datetime.datetime.utcnow()`

I sorta want the msg = embed to be replaced by new_em when a user reacts with the emoji

Anyone who can help?

glacial echo
#

idk soem weird error

slate swan
#

can you show it?

honest shoal
slate swan
#

Yes

glacial echo
#

no i don’t have any terminals connected to me pi right ne

slate swan
#

ah

slate swan
honest shoal
honest shoal
slate swan
#

Oh my bad sorry about that

slate swan
honest shoal
#

posting from their side to make it readable```py
await ctx.reply(embed=reply_embed, hidden=True)
await msg.add_reaction('👍')
await msg.add_reaction('👎')

new_em = discord.Embed(color=0xf3e914, description=f"\n{suggestion}\n\n**Thoughts**\n{len(msg.reactions.count)}")
new_em.set_author(name=f"Suggested by {ctx.author}", icon_url=f"{ctx.author.avatar_url}")
new_em.set_thumbnail(url=f"{ctx.author.avatar_url}")
new_em.set_footer(icon_url=f"{ctx.guild.icon_url}", text=f"Running /suggest • {round(bot.latency * 1000)} Ms")
new_em.timestamp = datetime.datetime.utcnow()```
slate swan
#

Since I am making a giveaway command :)

torn sail
#

There is also discord.utils.sleep_until for date time objects

slate swan
honest shoal
honest shoal
exotic maple
honest shoal
exotic maple
#

I need "I sorta want the msg = embed to be replaced by new_em when a user reacts with the emoji" that

#

Thats what im looking for

slate swan
#

sorry wasn't reading all

honest shoal
exotic maple
#

thanks tho

exotic maple
honest shoal
exotic maple
#

Yes, i have the documentation for that but i tried applying it to my code and it didnt work

slate swan
#

why is it not working? There is no error

honest shoal
exotic maple
#

My bot just showed an error

honest shoal
#

!d discord.on_raw_reaction_add you can also try this

unkempt canyonBOT
#

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

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
honest shoal
exotic maple
#

Well it wont let me do it as an event as my new_embed variable cant be found in the event

#

as its not in the command

honest shoal
#

you can place it somewhere else

#

just before that

exotic maple
#

@honest shoal

honest shoal
exotic maple
#

I cant put it inside of the event as theres multiple embeds in the command

honest shoal
exotic maple
#

That still shows an error.

#

Let me make sure theres nothing wrong with my other code a second

unkempt canyonBOT
#

Hey @tacit token! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

tacit token
#

what i dont send my token

stiff gorge
#

do i need to import anything to use hybrid commands ?

crimson compass
#

how do i put space

#

?

slate swan
#

need help @crimson compass dm me

crimson compass
#

why should i dm you

#

can't you answer here?

slate swan
slate swan
crimson compass
#

how do i leave space

slate swan
#

pardon?

crimson compass
slate swan
#

OH

slate swan
#

_

#

copy it

crimson compass
#

yes

slate swan
#

are you responding to me?

slate swan
sick birch
#

this conversation is giving my 2 brain cells a serious workout

slate swan
#

Lmfao

#

this conversation is giving me a full on stroke

sick birch
#

feel better soon

slate swan
#

i wont

minor totem
crimson compass
sick birch
#

anyway I’m still not understanding the issue

slate swan
#

how do i make button on message?

#

you mean send a button?

#

like to open ticket

sick birch
slate swan
#

like "open ticket" button

sick birch
#

Ah

honest shoal
#

like ticket tool bot?

sick birch
#

Create yourself a view

#

Check some of the examples on the GitHub page

slate swan
honest shoal
#

!d discord.ui.button

unkempt canyonBOT
#

discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
slate swan
#

thx

#

im just gonna leave this conversation its just so unclear its just doing brain_cells.create_task(understand())😭

slate swan
#

@honest shoal how do i make gui like message to be in gui

honest shoal
#

I'm speechless

#

you can look for some examples, maybe they can help you

exotic maple
#

Did discord.py remove bot.get_message or was there never one?

honest shoal
#

I shifted to disnake

#

so don't know about that, sorry

stone beacon
minor totem
minor totem
stone beacon
#

Frls? Guess it's just guild got that

exotic maple
minor totem
#

get_*() is only to lookup in cache

slate swan
#

😅

exotic maple
honest shoal
# minor totem Hm? How does that make you speechless?

because of the following:

  • I type very slow.
  • I am lazy as well.
  • That will require me to explain a bit.
  • I am not good in explaining at all.
  • I find short-cuts everywhere so I asked them to look at repo's example folder.
    So hope you can understand my skills😄
slate swan
stone beacon
#

🤣 🤣 🤣

honest shoal
#

and 4th one

slate swan
#

😭

minor totem
slate swan
#

and thats the reason why some methods would return None!

orchid seal
#

what module should I use to make discord bots?

slate swan
exotic maple
#

Would that work?

minor totem
orchid seal
#

I’ll check it out later

honest shoal
minor totem
honest shoal
#

🤔

minor totem
torn sail
exotic maple
honest shoal
#

this is not a message id

minor totem
exotic maple
#

thats what i get in discord

honest shoal
#

retry

exotic maple
#

what

honest shoal
#

971858745325932605 <- this is a message id

slate swan
exotic maple
#

I think its just a problem on my end

minor totem
torn sail
#

oh ok

slate swan
#

i called itlemon_smug

exotic maple
#

Thanks for your help @minor totem and @honest shoal It worked

minor totem
#

I think I will un-star it, since it is archived

slate swan
#

now its gonna be Bigcord

#

😳

tacit token
#
  File "C:/pythonstuff/main.py", line 47, in ban
    embed.set_thumbnail(url=felhasznalo.avatar_url)
AttributeError: 'int' object has no attribute 'avatar_url'

what

slate swan
#

felhasznalo is an int

tacit token
#

so i go and try change to str?

slate swan
#

no it has to be a Member object

tacit token
#

and how can i fix this

minor totem
tacit token
#

i use >ban by id

slate swan
#

thats weird, why is it not converting

#

because 3rd party library

exotic maple
#

Also, does anyone know how to do a timer, e.g <user> Sent this message <time> (Hours/minutes/etc) ago?

slate swan
#

the sequence of characters, which i demonstrate with x's <t:xxxxxxxxxx:F>

#

is a unix epoch timestamp

#

messages in discord.py include a created_at attribute

#

so you can fetch that and use that syntax to format it

exotic maple
#

Alr

#

thanks

tacit token
#

icon_url = str(felhasznalo.avatar_url)
AttributeError: 'int' object has no attribute 'avatar_url'

slate swan
#
async def on_raw_reaction_add(payload):
    if payload.emoji == "\u2705" and reaction.message_id == 123:
        await payload.member.send("Hey")```
#

this type of code is not working for me

rare saddle
#

Does anyone have any good examples of using gettext in discord.py? Throw off please - I can’t figure out how to make another language in the bot

slate swan
#

to when a user reacts to a certain message the bot would dm him

fading marlin
rare saddle
slate swan
#

reaction not defined wtf

fading marlin
minor totem
tacit token
#

same problem

#

the problem maybe the slash

slate swan
tacit token
#

but if i try to import normal command the output is

discord.ext.commands.errors.MemberNotFound: Member "859874942127439882" not found.
slate swan
tacit token
#

nope

#

thats why i use ID

slate swan
#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID.
You do not have to share any guilds with the user to get this information,
however many operations do require that you do...
slate swan
#

Or

#

!d discord.ext.commands.Bot.get_user

unkempt canyonBOT
slate swan
#

and i believe if u use discord.User it will work fine (the bot should have mutual servers with the user)

tacit token
#

works ty

#

and ty

junior verge
#

Read the error

fading marlin
#

don't copy 3 year old code on a library that isn't the same. Check the type of your ctx argument and reference the fork's documentation on it from there

#

ctx.guild.bans returns an async iter (in dpy), so you have to await it

#

not really sure what lib they're using, so can't really help 🤷

slate swan
#

would anything bad happen if i didn't add a timeout for the bot to wait for someones reaction to an emoji?, e.g allowing them to click it 2 hours from when it was posted

full lily
#

is there any valid reason to run two bot instances?

slate swan
#

is there something like on_channel_create

tacit token
#

i have on_membeR_join and on_member_update. if member join the update works with the join, but its member update no join.

fading marlin
full lily
fading marlin
slate swan
tacit token
#

You are missing Ban Members permission(s) to run this command.

#

Do u have permission to ban members?

slate swan
#

give bot admin

fading marlin
#

what type of error handler are you using?

exotic maple
#

How do i do, if ctx author has a certain role id?

slate swan
#

and if u wanna send if they dont jus do

#

else:

slate swan
fading marlin
#

try using on_error, I'm not too sure if interactions have their own error handlers yet

#

hmm, try error.original then?

#
  ...
  elif isinstance(error.original, ...):
  ...
slate swan
#

if 2 channels have same name they wont create

brisk dune
#

first: inline, second: inline, third: not inline, fourth: inline
This would be my guess...

#

Is the fourth one set to inline?

slate swan
#

prolly not

#

what do I have to install for: from discord import app_commands ?

brisk dune
#
embed=discord.Embed(title="Embed test")
embed.add_field(name="Field 1", value="1", inline=True)
embed.add_field(name="Field 2", value="2", inline=True)
embed.add_field(name=" ", value=" ", inline=True)
embed.add_field(name="Field 3", value="3", inline=True)
embed.add_field(name=" Field 4", value="4", inline=True)
embed.add_field(name=" ", value=" ", inline=True)
embed.set_footer(text="I've added empty fields too...")
#

It's a pretty hacky way to do it tho...

#
embed=discord.Embed(title="Embed test")
embed.add_field(name="Field 1", value="1234567890123456789012345", inline=True)
embed.add_field(name="Field 2", value="12345678901234567890123456", inline=True)
embed.add_field(name="Field 3", value="3", inline=True)
embed.add_field(name=" Field 4", value="4", inline=True)
embed.set_footer(text="I've extended some stuff, so now it takes up more space with only two fields")
edgy mantle
#

Not exactly practical either

brisk dune
#

True

#

But you could probably ljust or rjust your string

#

programmatically

slate swan
#

so I need discord.py v2.0 beta . but I somehow cant clone the files from github

#

how do you limit the width of an embed like these guys have

glacial echo
#

or soemthing similar

#

also why does it surprise me that “datecord” is a thing

edgy mantle
#

im using msg = await bot.wait_for('message', check=check(ctx.author), timeout=20) this to wait for a message. How do I delete this users message after its been sent?

slate swan
#
await msg.delete()
edgy mantle
#

Nah

slate swan
#

im use thats the way

#

the event would return a message object which thats the one you want to delete i supppose?

edgy mantle
#

Ill fiddle around a lil more

#

i think the mistake is elsewhere

slate swan
#

and what are you doing in the check?

#

you dont call the check

edgy mantle
#

author is the message author

slate swan
#

you just pass the function object

edgy mantle
#

Its my bad

slate swan
#

its fine its just library abstractions

edgy mantle
#

I reassigned msg as something else later I missed it out

slate swan
#

ah

#

btw dont call the function!

alpine pewter
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

After pasting your code, save it by clicking the 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.

alpine pewter
#

https://paste.pythondiscord.com/osisocahek
Does anyone know how it would be possible to stop users from spamming the menu once it's put down?
I was looking for a way to add a cool-down, I still can't seem to find one that works here.

Not the command, the menu after it's placed.

slate swan
#

say i want to put the file purchases.json in a folder named JSONS in the same directory as the bot.py, what do i need to change to allow the bot to find it?

        with open('purchases.json', 'r') as purchases:
            purchases = json.load(purchases)```
#

How can I get the user that pressed the button? My old bot was using interaction.user.id but that doesn't seem to work now

fading marlin
# slate swan say i want to put the file purchases.json in a folder named JSONS in the same di...

the directory of your with open() should be keeping in mind that your cwd is your bot's file directory. e.g

├─ some_folder/
│   ├─ command_file.py
│   └─ some_file.json
└─ bot.py

if I tried to access some_file.json from a command in command_file.py, I'd have to do something like with open(some_folder/some_file.json) instead of doing with open(some_file.json), because some_file.json isn't in the same directory as the bot.py, which is your cwd, therefore you'd just get thrown an Exception saying that the file couldn't be found

unkempt canyonBOT
slate swan
#

!d disnake.Interaction.user

unkempt canyonBOT
#

property user```
The user or member that sent the interaction. There is an alias for this named [`author`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.author "disnake.Interaction.author").
slate swan
#

!d disnake.Interaction.author

unkempt canyonBOT
slate swan
#

those are the properties i really know so i see no issue how it wouldnt work tbh

slate swan
slate swan
slate swan
#

what does , * , do in this?

async def test55(self, ctx, *, firstchoice=None):```
slate swan
fading marlin
fading marlin
slate swan
#

if discord.interaction.user.id == self.user.id:

#

Thats my code, the self.user is the user mentioned in the command

fading marlin
#

interaction.user.id, not discord.Interaction.user.id cause that's a class attribute

slate swan
fading marlin
#

your interaction param is of type discord.Interaction, but that doesn't mean that discord.Interaction is your interaction param

fading marlin
slate swan
#

wdym?

fading marlin
#

do print(type(interaction))

slate swan
fading marlin
#

or just read the error

slate swan
#

Ignoring exception in view <View1 timeout=30 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Accept Coinflip' emoji=None row=None>: Traceback (most recent call last): File "/home/runner/Client/venv/lib/python3.8/site-packages/discord/ui/view.py", line 414, in _scheduled_task await item.callback(interaction) File "/home/runner/Client/cogs/flip.py", line 114, in _accept_ if interaction.user.id == self.user.id: AttributeError: 'Button' object has no attribute 'user'

#
       profilembed = embed=discord.Embed(title=f"{member} | {final_pronouns}", description=f"snip", color=0xFF69B4)
        embed.set_thumbnail(url=(pfp))
        embed.set_author(name="Profile", icon_url=guildicon)
        embed.add_field(name="**Age**", value=f"{agefinal}", inline=True)
        embed.set_footer(text="Click the 📋 to see what other users say about me!")
        embed.set_image(url="https://i.gyazo.com/88a987bc1c7febf4c54195dd00fbb512.png")
        message = await ctx.send(embed=profilembed)
        
        feedbackembed = embed=discord.Embed(title=f"{member} | (He/Him)", description=f"This section showcases feedback that users have left for {membermention}", color=0xFF69B4)
        embed.set_author(name="Profile (Feedback)", icon_url=guildicon)
        embed.add_field(name="**Positive**", value="2", inline=True)
  embed.set_image(url="https://i.gyazo.com/88a987bc1c7febf4c54195dd00fbb512.png")
        
        await message.add_reaction('\U0001F4CB')
        def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '\U0001F4CB'
        try:
            reaction, user = await self.bot.wait_for('reaction_add', timeout=60.0, check=check)
            await message.edit(embed=feedbackembed)
        except asyncio.TimeoutError:
            await message.remove_reaction('\U0001F4CB')
            await ctx.send('no reaction in 60s (DEBUG).')
            return

TypeError: remove_reaction() missing 1 required positional argument: 'member'

slate swan
#

you probably named your arguments wrong

slate swan
#

and so you got confused

#

ill send full code but simplified

#

what do i put for member if its the bot sending it?

#

cause idk

#

confused as to why it can add a reaction without needing member but can't remove it

fading marlin
slate swan
#

thats all I gotta do?

#

self, interaction, button?

fading marlin
fading marlin
slate swan
#

okay ill try

slate swan
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: clear_reaction() missing 1 required positional argument: 'emoji'

fading marlin
#

if you want to clear all reactions, you can do clear_reactions too

slate swan
#

weird, py await discord.Message.clear_reaction('\U0001F4CB') should work then no?

slate swan
#

im happy nowlemon_blush

fading marlin
slate swan
#
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\allan\OneDrive\Documents\mootbot\cogs\Commands.py", line 921, in _profile
    await message.clear_reactions
TypeError: object method can't be used in 'await' expression```
fading marlin
#

clear_reactions(), it's a method so you gotta call it

#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord...
slate swan
#

amazing, thank you

#

how do I disable a button?

fading marlin
#

!d discord.Button.disabled

unkempt canyonBOT
slate swan
fading marlin
#

yes

slate swan
#

'Button' object attribute 'disabled' is read-only

sick birch
slate swan
#

self.button.disabled?

slate swan
slate swan
#

Hi okimii :D

#

hey hey :))

#

What's the time there??

#

9:45 PM

#

😅

#

Bru sleep

#

I just wake up its 7 16 am here

#

ah good morning :))

#

Good evening :D

#

Or night

#

more like night because in 3 more hours its already midnight here😭

#

We say good night when the person is going to bed

#

Ig

#

yeah but its said to be polite as you say to someone good morning to greet them so when you say goodnight its like saying bye to them as you say hello to the sun and bye to the sun at night

#

its just how people mainly think about it, but its just what the word suggests

#

Ohk

#

anyways hyd?

#

💀 online classes in 10 min

#

dang i had no school today so i finished my bare bones gateway implementation

#

bare bones gateway implementation wt is that

#

just the basics of my gateway client implementation

#

gateway client means ;-;

#

the client that handles the apis gateway which in this situation is discords gateway!

#

Ohh

#

so it would handle events like MESSAGE_CREATE

#

wow

#

Message create?

#

yeah its the event that gets dispatched when a message is created

#

e.g on_message is the function that gets triggered in this event

#

um

#

so u can customize

#

customize by?

#

Like custom events?

#

wdym by custom events?

#

uh

#

👁️👁️

#

(idk about gateway an api )

#

I'm trying to say

#

uh can't explain

#

😭

#

nah

#

..

#

im trying to make a wrapper from scratch

#

how do i get a guilds booster role name

#

um which api wrapper

slate swan
#

Yes

#

wdym by which api wrapper

#

means

#

Ig I'm thinking wrong

#

Nvmd

slate swan
unkempt canyonBOT
slate swan
#

it can return Role | None fyi

#

I'll just go and learn about apis

#

So I can understand

slate swan
#

yo, whats the syntax for auto-complete in disnake?

#

ah wait its in the docs nvm

#

Ok so @slate swan discord.py is the easy part of that ?

#

It's a third party?

torn sail
#

Yes

slate swan
#

an api wrapper wraps the api of your choice e.g theres a restaurant where you need to specify whats your name your order by ingredients how you want it and the waiter talks only Portuguese but you talk english so an api wrapper makes a menu for you with options in english so its easier for you and then the menu talks to the waiter in Portuguese

slate swan
slate swan
#

Now I understand

#

the menu is like a middle man

#

Like communicator

#

Between me and chef

#

nah

#

that would be more the api

#

apis communicate from something to something else

#

Ye I mean waiter

#

so like a translator

#

its a quite confusing topic

#

I'm hacked

#

Ig

#

what

#

how would i access the self parameter in an auto complete function? like i got this function:

    async def autocomplete_tags(self, inter: disnake.ApplicationCommandInteraction, user_input: str):
        return [i for i in self.tag_list if i.lower() in user_input]

and have it in my commands like this:

    async def tag(self, inter: disnake.ApplicationCommandInteraction, tag: str=commands.Param(autocomplete=autocomplete_tags)):

bu tthis jus raises an error

TypeError: Tag.autocomplete_tags() missing 1 required positional argument: 'user_input'
#

Ye

#

My volume just go up down without my touch

#

are you sure its not a bug?

#

Also it pops open with chrome something

#

or something else? or have you been in places where you shouldnt be at🤨

#

I think zoom is hacking my device

slate swan
#

I'm on android

slate swan
#

oh

#

Also

#

or just yeet your phone

#

I think my pc is hacked tooo

#

now youre just playing with me🗿

#

Yesterday when I try to close the Google it shoe continue download or exit where I'm not downloading anything

#

Bro I swear

#

are you sure it was updating itself😭 💀

#

Yes

#

I just saw that

#

:(

#

I think it's bug

#

Of update

#

😭

#

you can just check your downlosd history just press ctrl+j

#

Already

#

Nothing there

#

I have checked every single task google history and all I can check

#

it probably was just updating itself

#

No!

#

Also in my android yesterday it was downloading something but I'm not sure cuz it would be play store update

#

Come ot ot2

#

Else someone will do ot

slate swan
#

and you should check your devices mr

last mica
#

!e

x = "I am a boy"

print(x)```
slate swan
#

Lol

slate swan
#

;))

last mica
#

Actually showing someone something

slate swan
#

he wants to show that his code doesn't work

#

lmaoo

last mica
slate swan
#

yep

last mica
#

Trying to get my friend to get a copy of this bot privately

slate swan
#

!src

unkempt canyonBOT
slate swan
#

just get the source code from here

#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

slate swan
#

Spyware

#

🤨

last mica
slate swan
jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 122, in on_raw_reaction_add
    await payload.member.add_roles(role)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 777, in add_roles
    await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'NoneType' object has no attribute 'id'```
slate swan
#

probably a get method is returning None

#

..

paper sluice
#

i like when exceptions are raised...

vast gale
#

a c# discord api lib that was (possibly unintentionally) sending tokens to the devs website

slate swan
#

how do i write the number of servers that have my bot?

warped mirage
#

Gus

#

Can someone help me fix my error

spring flax
unkempt canyonBOT
spring flax
warped mirage
#

Lemme show

#

File "C:\Users\Dom\Desktop\python bot\main.py", line 29, in on_ready
bot.load_extension('cogs.leveling')
NameError: name 'bot' is not defined

#

@spring flax

spring flax
#

Give full code

#

You haven't defined bot yet

warped mirage
#

i use client so idk

#

how to fix

brazen torrent
spring flax
#

So then do client.load_extension

warped mirage
#

also

#

is this normal?

tawdry perch
#

wdym?

spring flax
#

Yes

warped mirage
#

import discord

tawdry perch
#

ye, it's normal

paper sluice
#

if u mean that the import discord is not highlighted properly, its because u haven't used discord in ur code

warped mirage
#

File "C:\Users\Dom\Desktop\python bot\main.py", line 29, in on_ready
client.load_extension('cogs.leveling')
File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 672, in load_extension
raise errors.ExtensionAlreadyLoaded(name)
discord.ext.commands.errors.ExtensionAlreadyLoaded: Extension 'cogs.leveling' is already loaded.

#

i changed to client and have this

paper sluice
#

thats because u loaded cogs.leveling in ur code b4 that

warped mirage
#

hmm ok

#

ima delete that

slate swan
#

i woudnt load cogs inside on_ready

#

Check the status of the users in the server (discord.Member.status)

#

If the status is discord.Status.online, they're marked as online

spring flax
slate swan
#

People will answer there when they can

#

No need to come in other channels to ask for people to go in the most active help channels

#

Being patient is part of being a developer SpadeyPopCorn

#

how do i make button?

slate swan
#

like

#

What library are you using

#

replit

#

Not a library

#

oh

#

py

#

yes

#

um i just asking for button

#

thx

alpine pewter
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

After pasting your code, save it by clicking the 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.

alpine pewter
#

Hey, is anyone able to help me with this error code?
I've tried to fix it, can't seem to get the proper fix.

Line 29-30

06.05 06:09:55 [Bot] AttributeError: 'Suggestion' object has no attribute 'bot'```
https://paste.pythondiscord.com/mejubugafu
slate swan
#

like what u making?

alpine pewter
#

It’s a suggestion command with a modale

slate swan
#

-_-

#

i asked u what u wanna to make

#

like to bot creates channel or?

alpine pewter
#

Oh, sorry. Lol
I’m just wanting them to type /suggestion and it inserts the suggestion into a channel that’s already made.

slate swan
#

mhm

#

like slash command right?

alpine pewter
slate swan
#

@bot.slash_command()

#

and down ur interaction

alpine pewter
#

Are you sure? I’m using Nextcord and cogs. I can try but last time I used that it gave an error

slate swan
#

dm?

alpine pewter
#

That’s fine

spring flax
#
    @commands.slash_command()
    async def build(
        self,
        inter: disnake.CommandInteraction,
        gun: str
    ):
        await send_build(inter, gun)
        logger.warning(f'A build was used for {gun}')

For the logger.warning, it seems to be writing the same line in the log file several times each time the slash command is used, why?

slate swan
#

@spring flax how do i make button when u press it to make private channel where that person who pressed button can type their report?

#

how do i write user tag?

#

in code?

#

yes

#

{member.tag}?

#

wait

#

explain me what u wanna to make

#

user info

#

and I just need to add a tag

#

without nickname

spring flax
slate swan
#

user.tag i think

spring flax
supple thorn
supple thorn
unkempt canyonBOT
spring flax
unkempt canyonBOT
#

property discriminator```
Equivalent to [`User.discriminator`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.discriminator "discord.User.discriminator")
supple thorn
#

It's discriminator

slate swan
#

thx

#

!d discord.ui.button

#

how do i make message to have text and gif down

#

like i wanna to put this gif

#

under message

reef trail
#

how can i get the cog a command is coming from

slate swan
#

uh

edgy mantle
#

is there any way to wait for a reaction on a message that is sent by a user from before the bot was even online?

slate swan
#

how do i make my bot to be 24/7 online?

edgy mantle
slate swan
#

lol where?

edgy mantle
#

VPS or other hosting service

slate swan
#

k

#

how to define a bot? if this user is not a bot, then writes false

#

hm?

#

wait

#

are u working on replit?

#

бот - bot

edgy mantle
slate swan
#

yes im using it

edgy mantle
#

you just gotta trick it into hosting it for free

#

turn it into a website and ping the website every 5 mins or so

#

itll stay up forever that way

spring flax