#discord-bots

1 messages Β· Page 1022 of 1

supple thorn
#

Can you show your role hierachy

#

At this point i'm just troubleshooting everything

slate swan
#

no

split merlin
#

hmm, it's something like this

Bot role
------
Owner
-----
Admin (me)
-----
Vote role (the role that should be added)```
slate swan
#

when and how is that function triggered?

#

on some command?

split merlin
#

once a member votes on the top.gg page

slate swan
#

cause im interested in the member_id

split merlin
#

a webhook will be triggered

#

and send their ID to a certain channel

#

the bot will take that ID and pass it to the function

supple thorn
split merlin
slate swan
#

thats really confusing, because with all those conditions you mentioned bot should not face any issue in adding the roles

split merlin
#

true, yet here i am facing it

#

what i am curious about is

#

it says Missing access instead of missing permissions

bleak karma
#

i updated my discord.py version to 2.0.0 and i dont think my on_member_update event is working anymore, why is that?-

bleak karma
#

wait a sec

bleak karma
bleak karma
bleak karma
#

nope

supple thorn
#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change...
split merlin
lone turret
#

!d

unkempt canyonBOT
split merlin
supple thorn
lone turret
#

what

#

just try

supple thorn
split merlin
#

what?

bleak karma
stiff gorge
#

whts wrong here ?

Traceback (most recent call last):
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 979, in on_message
    await self.process_commands(message)
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 976, in process_commands
    await self.invoke(ctx)
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 422, in dispatch_error
    await injected(cog, ctx, error)
  File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 77, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: fact_error() takes 2 positional arguments but 3 were given```

```py
    @fact.error
    async def fact_error(ctx, error):
      if isinstance(error, commands.CommandOnCooldown):
        em = discord.Embed(title=f"Slow it down!!",description=f"Try again in {error.retry_after:.2f}s.",color=0x2F3136)
        em.add_thumbnail(url='https://cdn.discordapp.com/attachments/969178492002500678/971001114046627900/stopwatch_1.png')
        await ctx.send(embed=em)
split merlin
bleak karma
#

the event i mean

supple thorn
bleak karma
#

idk it wont give any errors and it wont send the message

supple thorn
#

If so you need to put self in the parameter

split merlin
#

they said no

split merlin
split merlin
#

ofc hide the token and etc

stiff gorge
supple thorn
stiff gorge
#

ok

split merlin
stiff gorge
supple thorn
stiff gorge
#
    @xkcd.error
    async def xkcd_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
          embed = discord.Embed(color=0x2f3136,title="Invalid Argument",description=f"β€’ Please put in a valid option! Example: `{prefix}xkcd <number> `")
          em.add_thumbnail(url='https://cdn.discordapp.com/attachments/969178492002500678/971001114046627900/stopwatch_1.png')
          await ctx.send(embed=embed)  
split merlin
#

why did u put self in isinstance ?

#

remove it

stiff gorge
#

by mistake

split merlin
#

oh okay

stiff gorge
#

still dosent wrk

supple thorn
stiff gorge
#

fixed it ty

bleak karma
bleak karma
supple thorn
#

Oh you linked it

#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change...
bleak karma
#

oh

#

i see its on_presence_update now

supple thorn
#

Shouldn't it be 3

#

Since there's self now

#

Unless that's an outdated error

slate swan
#

how do i write the number of text channels?```
placid skiff
unkempt canyonBOT
#

property text_channels```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
supple thorn
unkempt canyonBOT
#

property text_channels```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
slate swan
#

thx

supple thorn
#

FUCK

#

I was writing it then picked a wrong character

placid skiff
#

And i've started typing after D_D

supple thorn
#

I was going to the docs to check if text_channels was right

placid skiff
#

lol

stiff gorge
#

will this work ?

    @xkcd.error
    async def xkcd_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
          embed = discord.Embed(color=0x2f3136,title="Invalid Argument",description=f"β€’ Please put in a valid option! Example: `{prefix}xkcd <number> `")
          await ctx.send(embed=embed)      

    @xkcd.error
    async def xkcd_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
          embed = discord.Embed(color=0x2f3136,title="Slow it down buddy",description=f" Try again in {error.retry_after:.2f}s")
          embed.set_thumbnail(url='https://cdn.discordapp.com/attachments/969178492002500678/971001114046627900/stopwatch_1.png')
          await ctx.reply(embed=embed)
#

error for missing argument and error for cooldown

bleak karma
#

is ActivityType not a thing now on 2.0 ? since

if act := [activity.name for activity in after.activities if activity.type == ActivityType.custom and req_act in activity.name]:
NameError: name 'ActivityType' is not defined
``` it gives this error
slate swan
bleak karma
slate swan
bleak karma
#

oh

#

oh tysm 😭

slate swan
supple thorn
stiff gorge
supple thorn
#

Just make a elif statement

#

Why do you have 2 error handlers

stiff gorge
quick gust
supple thorn
quick gust
#

yes

supple thorn
#

Hello

slate swan
#

When I'm using slash commands it usually works fine, but whenever I try something like this the command either won't load in at all, or the arguments won't show up. Anyone knows why? ```py
@slash_command(guild_ids = ids)
async def add_autorole(self, ctx, role: discord.Option(discord.Role, "Test")):

It used to work in my other bot, I don't know what changed. πŸ€·β€β™‚οΈ
slate swan
gaunt herald
#

hey guys anyone know how can i send stickers in discord.py

supple thorn
slate swan
supple thorn
#

It really looks confusing when it's named discord

slate swan
supple thorn
#

!d discord.ext.commands.Context.send

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

Sends a message to the destination with the content given.

This works similarly to [`send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for non-interaction contexts.

For interaction based contexts this does one of the following...
supple thorn
#

@gaunt herald

gaunt herald
supple thorn
#

There's a sticker keyword

supple thorn
#

Gets pretty confusing

slate swan
slate swan
gaunt herald
slate swan
slate swan
supple thorn
#

!d discord.Sticker

unkempt canyonBOT
#

class discord.Sticker```
Represents a sticker.

New in version 1.6...
slate swan
#

!d discord.Client.get_sticker

unkempt canyonBOT
paper sluice
supple thorn
gaunt herald
supple thorn
#

I stabbed in the dark

#

And guessed

slate swan
supple thorn
slate swan
#

Bot inherits Client, so its pretty much there

supple thorn
#

Did you just use that to shorten it

supple thorn
slate swan
supple thorn
#

Back to procastinating on making docs

#

Bye bye

slate swan
#

if I make a site not in python, will I be able to manage bot commands from it?

#

for example in html

vocal plover
#

Yes, you just need some way of communicating between the site and the bot, for example an API running on the bot

#
  • you have to make your site in HTML, websites can't be written in Python
slate swan
#
@commands.command()
  async def ping(self, ctx):
  
    embed = discord.Embed(
      title="Ping",
      description="(url='https://cdn.discordapp.com/avatars/961156905689038878/377996723423ea055fcc9f96e5c80880.webp?size=1024')"
    )
    embed.add_field(
      name=f"**Latency is**", 
      value=f"``{round(self.bot.latency * 1000)}``**ms**"
    )
    msg = await ctx.send(embed=embed)
#

Is this correct?

slate swan
#

Means the description one

#

but thanks anyway

vocal plover
#

It still produces HTML as output

stray carbon
#
bot = commands.Bot(command_prefix=getprefix, intents=nextcord.Intents.all())

@bot.event
async def on_ready(bot):
    await bot.change_presence(activity=nextcord.Activity(type=nextcord.ActivityType.listening, name=",help"))
    print(f'Logged in as {bot.user} (ID: {bot.user.id})')
    setattr(bot, "prefixdb", await aiosqlite.connect("prefixes.db"))
    async with bot.prefixdb.cursor() as cursor:
        await cursor.execute('CREATE TABLE IF NOT EXISTS prefixes (prefix TEXT, guild ID)')
    setattr(bot, "afkdb", await aiosqlite.connect("main.db"))
    async with bot.afkdb.cursor() as cursor:
        await cursor.execute('CREATE TABLE IF NOT EXISTS afk (user INTEGER, guild INTEGER, reason TEXT)')
        await cursor.execute('CREATE TABLE IF NOT EXISTS afkrole (role INTEGER, guild INTEGER)')
    if not hasattr(bot, 'uptime'):
        bot.uptime = nextcord.utils.utcnow()

Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\client.py", line 417, in _run_event
await coro(*args, **kwargs)
TypeError: on_ready() missing 1 required positional argument: 'bot'

slate swan
stray carbon
#

field

vocal plover
#

you can set inline=False when adding the field

stray carbon
#

yes with inline=False

flint isle
#

anyone know the docs for attaching a file via ctx

vocal plover
#

oh sorry I misread, if they're already inline there's nothing you can do to make more on one line

#

its constrained by the maximum width of the embed

stray carbon
#

πŸ’€

vocal plover
#

on ready doesnt take a bot as a parameter

stray carbon
vocal plover
#

Since it doesn't take bot as a param you need to remove that param from the function definition

stray carbon
#

r u sure?

vocal plover
#

yes

slate swan
#

use the <a:emoji_name:emoji_id> format

NOTE: Emojis can only be used in the embed description and values of the fields of the embeds

#

what dont you understand?

#

I just told you...

#
Embed(description="<a:emoji_name:emoji_id>")
#
add_field(name="uwu", value="<a:emoji_name:emoji_id>")
boreal ravine
#
embed.add_field(name=..., value=":emoji:")
slate swan
boreal ravine
#

sure.

slate swan
#

just use the name of the emoji between colons as sift suggested

boreal ravine
#

you can use the discord.utils.get method ```py
emoji = discord.utils.get(bot.emojis, name="emoji-name")

flint isle
#

I use this in one of my cogs since I don't have nitro
+


    @commands.command(name='gemoji', description='This Command Returns a list of Emojis for the Guild(Server) it is Run within.')
    async def gemoji(self, ctx, optional_arg: int = None):
     guild = int
     print(f"Guild output before check  ++ {guild}",tag='Debug', tag_color='blue', color='cyan')
     if guild == None:
     	guild = ctx.get_guild()
     	print(f"Detected None", tag='Debug', tag_color='blue', color='cyan')
     	ctx.send('Debug: Guild is equal to None', delete_after=5)
     await ctx.send(ctx.guild.emojis)
     print (ctx.guild.emojis)

You will have to use it in a cog or remove the self and change commands. To bot.

#

Can ctx.send(file="") attach files via Urls or do I need to have the bot download and attach it via that?

slate swan
#

how to make it?

#

why not just send the url

slate swan
unkempt canyonBOT
#

set_author(*, name, url=None, icon_url=None)```
Sets the author for the embed content.

This function returns the class instance to allow for fluent-style
chaining.
slate swan
#

thx

#
@commands.command()
  async def ping(self, ctx):
  
    embed = discord.Embed(
      title="Ping",
       embed.set_thumbnail=(url='https://cdn.discordapp.com/avatars/961156905689038878/377996723423ea055fcc9f96e5c80880.webp?size=1024')
    )
    embed.add_field(
      name=f"**Latency is**", 
      value=f"``{round(self.bot.latency * 1000)}``**ms**"
    )
    msg = await ctx.send(embed=embed)
``` is this correct sir? @slate swan
sage otter
#

definitely not

slate swan
#

@sage otter so help me sir

sage otter
#

Do you want the image to render in the embeds thumbnail or image field?

wispy solstice
#

Hello, how can I import a function ( command ) from a sub-file to the main one? or it doesn't matter?

slate swan
#

Image

#

Wait

#

use embed.set_thumbnail ig?

sage otter
#

I was gonna say something but idk what he wants

slate swan
#

@sage otter like this @slate swan

#

or set_image depending upon you

sage otter
#

That’s the thumbnail

slate swan
#

😯

wispy solstice
sage otter
#

Look into cogs

scarlet sorrel
#

how to change a server logo from the bot?

sage otter
sage otter
unkempt canyonBOT
#
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the guild.

You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission
to edit the guild...
scarlet sorrel
#

oh dang

#

wait why is there an "owner" tag

sage otter
#

Because bots can own guilds as well

#

That’s how it transfers ownership to another member

scarlet sorrel
#

ohh

#

why is there a wild card at the beginning

sage otter
#

It signifies that all of the arguments are keywords

scarlet sorrel
#

does anyone know the rate limit for changing server logo?

slate swan
#

@sage otter @slate swan

sick birch
#

Because then people try to get around them

scarlet sorrel
#

its 30 min

scarlet sorrel
#

thanks for helping me on AWS btw

sick birch
#

yeah you can still figure it out just by observation

scarlet sorrel
#

working great

sick birch
pliant gulch
copper gulch
#

is there a way to like give a role to someone from another server to another one like example:
server1: the user will type in a command "give role etc (guild id)"
server2: the member will be given the role from what has been stated from the other server

slate swan
copper gulch
#

yes its in servers and the member aswell

slate swan
# copper gulch yes its in servers and the member aswell

well, you can actually use fetch_guild/get_guild method of the Bot class and get the other guild, then using that Guild object returned, you can use the get_member/fetch_member method on the Guild_object and get a Member object of the member from the other server, then you can use the add_roles/remove_roles method on the Member object to add/remove roles from the Member

maiden fable
#

The event is also triggered when someone is timed out

slate swan
#

thats the stable branch docs, check the master version

#
@command
async def foo(ctx: commands.Context):
  other_server = bot.get_guild(id) or await bot.fetch_guild(id)
  member_in_other_server = other_server.get_member(ctx.author.id) or await other_server.fetch_member(ctx.author.id)
  await member_in_other_server.add_roles(Role_obj)

@copper gulch an example

copper gulch
#

hmmm alright thank you

slate swan
#

is it a default emoji?

#

well, :default_emoji: shows the unicode version of that emoji

heady sluice
#

<a:emoji_name:emoji_id:>

slate swan
#
emoji = iscord.utils.get(guild.emojis, name="emoji name")
emoji.id
copper gulch
slate swan
#

I explained

copper gulch
#

oh wait

#

i didnt saw a part sorry

slate swan
#

its alright

heady sluice
#

D;

wispy solstice
slate swan
#

Hi

heady sluice
#

!d discord.ext.commands.Bot.add_command ?

unkempt canyonBOT
#

add_command(command, /)```
Adds a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") into the internal list of commands.

This is usually not called, instead the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.command "discord.ext.commands.GroupMixin.command") or
[`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.group "discord.ext.commands.GroupMixin.group") shortcut decorators are used instead.

Changed in version 1.4: Raise [`CommandRegistrationError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandRegistrationError "discord.ext.commands.CommandRegistrationError") instead of generic [`ClientException`](https://discordpy.readthedocs.io/en/master/api.html#discord.ClientException "discord.ClientException")...
slate swan
wispy solstice
heady sluice
#

import

#

actually, just use cogs

slate swan
#

import discord as iscord

wispy solstice
wispy solstice
slate swan
#

Use bot.load_extension("file name")

heady sluice
#

somefile.py

from discord import commands

@commands.command()
async def haha(ctx):
    await ctx.send("haha")

main.py

from somefile import haha

bot.add_command(haha)
#

?

wispy solstice
#

I'll try, thank you all

slate swan
#

@slate swan forgive me if its a dumb question.....but how do i get a message πŸ˜” cant find anything in the docs

heady sluice
#

right

#

I wanted to help Ashley then realised she's hikariing

slate swan
#

or get channel then fetch message

slate swan
paper sluice
#

bot.cache? seeing this for the first time

slate swan
sage otter
slate swan
#

uh

slate swan
paper sluice
slate swan
#

um

slate swan
heady sluice
#

ew

sage otter
#

@slate swan which commands framework are you using?

#

Tanjun or lightbulb?

slate swan
#

they using lb iirc

sage otter
#

no one uses tanjun ;-;

slate swan
#

tanjun is a bit overkill

#

atleast for me

copper gulch
#
@client.command()
async def giverole(ctx):
    otherserver = await client.fetch_guild(744550186998562937)
    userid = await otherserver.fetch_member(466528033638055936)
    roleid = 744784021783052429
    print(userid)
    await userid.add_roles(roleid)

error:
Command raised an exception: AttributeError: 'int' object has no attribute 'id'

sage otter
#

To me it’s more um

#

Idk how to say. More esoteric? In a way?

slate swan
#

yeah, if you want to make you already stressful hikari code more stressful, use tanjun

copper gulch
#

oh

sage otter
#

That’s the whole point of using hikari

slate swan
#

lmao

slate swan
#

i remember when lightbulb used to be same as discord.py

#

πŸ˜‚

#

I'm low-key liking hikari with lightbulb than dpy and its forks πŸ˜”

#

uh what's lightbulb? πŸ’‘

copper gulch
slate swan
unkempt canyonBOT
heady sluice
sage otter
#

I remember that too. I asked thommo or whatever his name is if he took inspiration

slate swan
#

command handler for hikari, kinda similar to .ext.commands

heady sluice
#

but save it to a var

slate swan
heady sluice
#

yes?

slate swan
#

Nvmd

heady sluice
#

!d discord.Guild.get_role

unkempt canyonBOT
#

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

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

Ye

#

I just realized

paper sluice
#

!d datetime.datetime.strptime

slate swan
#

Lol

unkempt canyonBOT
#

classmethod datetime.strptime(date_string, format)```
Return a [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") corresponding to *date\_string*, parsed according to *format*.

This is equivalent to:

```py
datetime(*(time.strptime(date_string, format)[0:6]))
```  [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "ValueError") is raised if the date\_string and format can’t be parsed by [`time.strptime()`](https://docs.python.org/3/library/time.html#time.strptime "time.strptime") or if it returns a value which isn’t a time tuple. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior).
sage otter
#

That’s probably why you set in so fast since you were already used to dpy sarthak

slate swan
#

Delay

sage otter
#

When I learned tanjun it was just so different. How converters worked. How arguments are supposed to be added. Plug-ins/modules

paper sluice
#

bot's having a rough day

#

um, i gave u the tool needed...

slate swan
#

Not mine Β―\_(ツ)_/Β―

#

..

paper sluice
#

why would u sue a function pithink

slate swan
heady sluice
#

geez

#

no don't sue it

slate swan
heady sluice
#

😐

slate swan
heady sluice
#

😐

slate swan
#

cause u never saw his face

#

right

#

..

#

my github is empty πŸ˜•

#

mine's shitposted

#

sameeee

#

What the names

slate swan
#

Yes

#

cs project

#

and Bobert

#

Pokemare rip

#

thats a fork idk if that counts

#

Nightmare + pokemon = PokeMare

#

In my github I started a website in which I recreated windows 7 on brow

#

But I stop it

#

After I started my dc bot

#

If u don't mind can u show me SelectVeiw class

cloud dawn
#

Just edit the message and pass None for the view kwarg

atomic wolf
#

discord.Client, any idea what this is?

cloud dawn
#

Idk on what condition you want it to remove the select menu.

cloud dawn
#

!d discord.Client

unkempt canyonBOT
#

class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord.
This class is used to interact with the Discord WebSocket and API.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
cloud dawn
#

Ye then you have to edit the message and only send the button.

atomic wolf
#

okay, that clarifies some things

cloud dawn
#

..? You made this yourself right?

#

Then on what condition do you don't want the menu anymore?

#

..?

#

You mean a derived command?

slate swan
#

and thats all they can suggest

slate swan
#

um I want to use add_item so I need example..

#

also, another issue

slate swan
cloud dawn
#

So you copied it.

south brook
#

Ik its and ez question but "how to make it so an on_message doesn't detect caps" i just forgot

slate swan
#

!d str.isupper

unkempt canyonBOT
#

str.isupper()```
Return `True` if all cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) in the string are uppercase and there is at least one cased character, `False` otherwise.

```py
>>> 'BANANA'.isupper()
True
>>> 'banana'.isupper()
False
>>> 'baNana'.isupper()
False
>>> ' '.isupper()
False
cloud dawn
#

You send the View, now send that view but without the select menu.

south brook
#

no thats not what i mean

slate swan
# slate swan ohh wots that

its showing me unknown interaction every time I run the same command, does it have to do anything with deferring the response? cz the command does a lot stuff

cloud dawn
slate swan
cloud dawn
#

Remove that part in the view or make a new view class.

cloud dawn
south brook
#

that wasnt the answer

cloud dawn
#

The part that sends the select menu or make a new view for the matter.

cloud dawn
south brook
#

I dont wanna detect if a message is upper or lower

slate swan
south brook
#

i want my on_message to not detect cases

slate swan
copper gulch
#
@client.command(pass_context=True)
async def rolecreate(ctx):
    otherserver = await client.fetch_guild(691544501277163591)
    author = await otherserver.fetch_member(466528033638055936)
    role_name = "savior"
    # check if that role already exists
    check_for_duplicate = get(otherserver.server.roles, name=role_name)
    if check_for_duplicate is not None: # if the role doesn't exist
        # create the role
        role = await otherserver.create_role(author.server, name=role_name, colour=discord.Colour(0x0000FF))
        await otherserver.add_roles(author, role)
    else:
        ctx.send_message(ctx.message.channel, "That role already exists")

error: Command raised an exception: AttributeError: 'Guild' object has no attribute 'server'

ok im confused

cloud dawn
south brook
#

yeah ig?

cloud dawn
slate swan
#

author.guild

#

not server

copper gulch
#

oh xd

south brook
#

do u have a answer?

slate swan
#

Also

cloud dawn
slate swan
#

ctx.send_message?

cloud dawn
unkempt canyonBOT
#

str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to lowercase.

The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
slate swan
#

And

heady sluice
slate swan
#

?

heady sluice
#

yeah cuz author.guild is otherserver

#

he fetched author from otherserver

slate swan
#

see on role var

copper gulch
#

ok im confused, how to make a discord bot create a role for members

heady sluice
#

not like that

slate swan
#

others ever.create_role(author.server)

cloud dawn
#

!d discord.Guild.create_role

unkempt canyonBOT
#

await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

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

All fields are optional...
slate swan
#

Bro

heady sluice
slate swan
#

Does member.server exists!, no

slate swan
cloud dawn
#

Idk what even the last line is.

slate swan
#

Ye lol

#

he is send to ctx thought ctx?

#

With *

#

Also pass_context define that it's copied and old

#

Most stack has pass_context in it

cloud dawn
#

Like I said you are using still the selectview.

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
cloud dawn
#

An unused view.

#

You use this class instead of the selectview.

#

Capital v

#

Why are you naming the var class?

#

No I told you to use the class View not rename the view var to class.

#

Rename class to view since you want to add the button to that object.

slate swan
#

!e
no = "view()"
print(f"{no[0].upper()}{no[1:]}")

unkempt canyonBOT
#

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

View()
cloud dawn
#

You only need to rename that 'class' to view

sick birch
#

class is a reserved keyword

#

sure

cloud dawn
#

You were using a pre-defined class before. Hence I asked if you made it yourself.

#

Idm you didn't made it yourself but it does change my approach.

#

Import view

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
cloud dawn
#

This is the destination.

#

Use the destination

brave forge
#

how to make it so that when pressing any of the 3 reactions, a message is displayed. Even if pressed out of order

slate swan
#

No

cloud dawn
#

No you need to import View from discord.ui

sage otter
#

What?

cloud dawn
#

Pycord is the same.

sage otter
#

@slate swan ???

slate swan
#

pycord uses the discord namespace

slate swan
cloud dawn
slate swan
cloud dawn
#

Np :3
I also hope you learned a bit about importing and classes :)

slate swan
#

OOP

cloud dawn
#

So if 2 is pressed it actually sends 1 first?

#

Yeah you can just keep asking questions.

brave forge
cloud dawn
#

You can try this <a:youremojiname:emojiid>

brave forge
#

@cloud dawn please read the question first, and then say your stupidity

sage otter
#

Damn what’s this guys problem πŸ˜‚

cloud dawn
#

I dunno, I do know he can solve it himself.

slate swan
#

Animated emoji

cloud dawn
#

I do know you can input animated urls in the icon kwargs.

heady sluice
brave forge
cloud dawn
#

Yeah but you do need nitro or go on the web version and inspect element the emoji.

slate swan
#

:shipit:

sick birch
slate swan
#

Wht

heady sluice
#

str(reaction.emoji) == "1", "2"
don't work like that

sick birch
cloud dawn
cloud dawn
# sick birch right

But if some where to paste an animated emoji here i could copy the name and id.

brave forge
heady sluice
#

I don't mean it like that

brave forge
#

if str(reaction.emoji) == "1", "2":
should I do it this way ?

heady sluice
#

I mean it should be
if str(reaction.emoji) == "1" or str(reaction.emoji) == "2"

slate swan
#

My wifi issue or what

slate swan
heady sluice
#

or
if str(reaction.emoji) in ("1", "2")

slate swan
heady sluice
#

faster on a flipping phone bro

brave forge
#

if str(reaction.emoji) in ("1", "2", "3")
and what to do in all 3 variants ?

slate swan
#

😏 i added 3 more characters

brave forge
#

@slate swan

cloud dawn
#

Yeah try it ig.

slate swan
#

..

heady sluice
slate swan
heady sluice
#

oh well

#

I'm on a phone

slate swan
#

um do anyone have any animated emoji server from where I can choose animated emoji for bot

heady sluice
#

but I added a \n

slate swan
#

Yay

brave forge
#

@slate swan@heady sluice
no. In this case, the messages that should be sent break down on my reactions

slate swan
#

Bro u just

#

U just don't code u just tell here

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
slate swan
#

Check the docs

brave forge
#

What do I need to replace and how to make the reactions work in any order in this code ? And if you clicked on the reaction, then the message with the reactions is deleted and another one appears ??

heady sluice
carmine pasture
#

Can anyone explain to me how @bot.command(). would work if i dont set a command to do? like what will i type if i want to run the code set under @bot.command().

heady sluice
#

you don't run it yourself

#

the library does

brave forge
slate swan
brave forge
#

@heady sluice please, if you don't know how to read the question or don't understand it, then don't write your nonsense. Otherwise you will have to call the moderators because you will be offended by me

carmine pasture
slate swan
carmine pasture
#

@bot.command()
async def balance(ctx):
a = await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
wallet_amt = users[str(user.id)]['wallet']
bank_amt = users[str(user.id)]['bank']

em = discord.Embed(title = f"{ctx.author.name}'s balance", color = discord.color.red())
em.add_field(name = 'Wallet', value=wallet_amt)
em.add_field(name = 'Bank', value=bank_amt)
await ctx.send(embed = em)
heady sluice
#

it's youtube

brave forge
slate swan
#

meh is russian...?

heady sluice
#

no

#

and I surely will never again try to help him

carmine pasture
#

i dont know what to type to activiate that i mean

brave forge
#

@paper sluice I would recommend not to interfere

slate swan
#

Don't be rude

brave forge
#

@heady sluice copying 90% of the lines and writing nonsense is not a help

slate swan
#

where

heady sluice
#

sorry Toxic Penguin for the inconvenience

slate swan
#

thats mean,

  1. you are very unclear with your questions
  2. you are virtually shouting on the people who are trying to help you with
  3. he is not just copy pasting lines, read what he said and if you dont understand that you need to learn some more stuff
heady sluice
#

but I'm sure that most of the people, if you ask them if I help people here that ask and understand, they will say yes

brave forge
#

@paper sluiceWell, then I can tell you, teach me Russian so that I can ask normally. In a language where the variety of words is much greater than in English

slate swan
#

Listen

paper sluice
#

i got no time for ur nonsense buddy, learn it urself and stop being a dick

heady sluice
#

that's simply not true, I'm Hungarian and I can still express myself

#

in English

#

even though there are like 6 synonyms for every word in my language

slate swan
velvet compass
#

Please keep it civil

#

Thanks

brave forge
heady sluice
#

every science is in English

brave forge
slate swan
#

lets not start that

sick birch
#

I suggest you all calm down before someone gets muted or worse

slate swan
#

only custom emojis have IDs

#

the unicode ones are simple strings

brave forge
#

@sick birchcall the moderator

velvet compass
#

I'm already here

slate swan
#

Penguin try ur best ,saying in english we'll all try to understand

velvet compass
#

And please move on

brave forge
#

@sick birch I want Ryuga#1114 to be given mute

sick birch
#

I don't

sick birch
#

I'm also not a moderator so I can't do that

#

And please, let's move on

velvet compass
#

We don't hand out mutes on command. If you would like to make a report, DM @novel apex

brave forge
#

for what he called me called me

sick birch
#

We don't have time to waste on things such as these, there are people who'd like help

brave forge
# slate swan Reason?

i got no time for ur nonsense buddy, learn it urself and stop being a dick
for this message

slate swan
#

Well

velvet compass
slate swan
velvet compass
#

Keep moderation discussions out of public channels please.

#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

heady sluice
#

we should really suggest topics

velvet compass
# lament depot

I made one for a small bot to query if a bike trail is open or closed, pretty nifty

slate swan
#

Cool

stray carbon
#

hi do you see any error here

    async def edonate(self, interaction, event: str = nextcord.SlashOption(description="What event are you going to donate for?"), prize: str = nextcord.SlashOption(description="What would be the prize for the event?", message: Optional[str] = nextcord.SlashOption(description="Any message you want to spread?"), requirements: Optional[nextcord.Role] = nextcord.SlashOption(description="Requirements for the event?")) -> None:
                                                                                                                                                                                                                                  ^
SyntaxError: invalid syntax
brave forge
#

@slate swanif I translate this sentence, then it pops up that he calls me an asshole

slate swan
#

😐

slate swan
velvet compass
brave forge
slate swan
slate swan
stray carbon
#

oop tyvm

slate swan
#

πŸ‘

#

But why to use that type of function ;-;-

#

It's not readable

heady sluice
#

I suggest pep8 to avoid these issues

slate swan
#

changing the lines kind-of helps

velvet compass
#

black formatter ftw

slate swan
#

^

stray carbon
flint isle
#
  1. how can i attach files to a message
  2. can i attach them from a link that links directly to them?
slate swan
unkempt canyonBOT
#

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

Note

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

@velvet compass what is the method there ?

velvet compass
slate swan
#

for external links, why not just send the link?

heady sluice
flint isle
brave forge
slate swan
#

Just dm bot

#

Ur issue

velvet compass
slate swan
flint isle
#

umm idk how to do that lmao

slate swan
#

ill give you an example :D

slate swan
#

this will save the image as image.png

#

πŸ‘€

#

though, you would like changing it to aiohttp instead of requests

flint isle
#

my understanding just flew out the window

heady sluice
#

you aren't alone

slate swan
#

what part did you not understand?

flint isle
#

the entire thing sorry

slate swan
#

how familiar are you with the requests library?

flint isle
#

not at all

slate swan
#

makes sense then

#

!d requests.get

unkempt canyonBOT
#

requests.get(url, params=None, **kwargs)```
Sends a GET request.
formal basin
#

What does this error mean?

slate swan
#

await

#

this is a method used to make "GET" requests to a url

#

await ctx.send

formal basin
#

Ohhhh

slate swan
#

ill assume you are aware of what that means??

#

It's a coro

formal basin
#

Bruh

formal basin
slate swan
#

Ye u can read the error tho

flint isle
minor totem
# formal basin What does this error mean?

There is no error, those requests recieved a 200 response code. That said, in the middle of the two "errors" there's a warning: you need to add await which is currently missing.

flint isle
slate swan
#

because thats the only way of GETting an image from a url

flint isle
slate swan
#

hey, i would like to multiply the amount of coins the bot prints by two. is there anyone who can help me understand it? ive tried multiple ways.

#
    return await ctx.respond(
        f"*Current Coins Stock:* `{len(open('coins.txt', encoding='utf-8').read().splitlines())}`")```
heady sluice
#

setting an embed thumbnail with an url and then getting the thumbnail

#

πŸ˜‹

slate swan
#

its really giving me problems

#

😭

slate swan
heady sluice
#
    return await ctx.respond(
        f"*Current Coins Stock:* `{len(open('coins.txt', encoding='utf-8').read().splitlines()) * 2}`")β€Š
slate swan
#

ohhh

#

tank u

heady sluice
#

you're welcome

slate swan
#

Tank fire

heady sluice
slate swan
#

:D

minor totem
paper sluice
#

random.level = Max

slate swan
slate swan
slate swan
#

in that same line

paper sluice
slate swan
#

😐

paper sluice
#

:=

paper sluice
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

Tank fire
slate swan
slate swan
#

Yes

#

U can ask here

#

.

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
#

..

#

Ok

#

Im trying to make a new slash command, it wont register tho. Anyone know a fix?

#

After i make it, it just wont appear on the bots application commands

paper sluice
#

can u paste ur code here?

paper sluice
slate swan
#

pycord im pretty sure

#

forgot the version

velvet compass
#

@slate swan remove the invite link

slate swan
#

but pycord

slate swan
wanton veldt
#
    async def embed(self, ctx):
        def check(message):
            return message.author == ctx.author and message.channel == ctx.channel

        await ctx.send('Waiting for a title')
        title = await self.bot.wait_for('message', check=check)
    
        await ctx.send('Waiting for a description')
        desc = await self.bot.wait_for('message', check=check)

        await ctx.send('Waiting for a image')
        img = await self.bot.wait_for('message', check=check)

        embed = discord.Embed(title=title.content, description=desc.content, color=0x72d345)
        embed.set_thumbnail(url=img)
        await ctx.send(embed=embed)
```Code
#

command on discord

#

help :d

paper sluice
sacred oyster
wanton veldt
#

thats a zero or an o?

jolly geyser
#

how to change nickname to all members with bot discord.py?

slate swan
#

Hide the link

wanton veldt
jolly geyser
#

i want to prank my friend's server

#

i am mod in his server

#

and i have his permission

slate swan
#

Against tos can't help

jolly geyser
#

how

wanton veldt
#

you are not alowed to do that on discord i think

jolly geyser
#

ohhhhhhhh

#

thanks

wanton veldt
#

yea ofc everyone reads the tos

stark geyser
#

how do i fix this error ?

wanton veldt
#

install ffmpeg on your script

slate swan
#

Yes

#

No sry

#

Do u have any error?

stark geyser
wanton veldt
#

can you ping the error?

wanton veldt
sacred oyster
#

Why i am getting a html error?

slate swan
#

cuz u use replit

slate swan
sacred oyster
#

From replit?

slate swan
#

discord api

paper sluice
#

ya

sacred oyster
#

va?

paper sluice
#

.tpoic

#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

paper sluice
slate swan
#

which i dont really use postman or the command

obtuse abyss
#

hey guys, is possible to make a help command with discord py that shows the aliases of each command?

paper sluice
#

u can subclass the default help command

slate swan
unkempt canyonBOT
slate swan
#

yes

slate swan
slate swan
#

..

paper sluice
#

imagine a bot which hacks users and get their address and sends them a physical letter

slate swan
#

Lol

slate swan
#

!ot

unkempt canyonBOT
paper sluice
#

we are talking about bots...

slate swan
#

doesnt matter its not helping or getting you anywhere

#

its just joking around

#

about a bot getting your irl info?

slate swan
#

not something you should be joking around about

#

Chat is ded

slate swan
#

who knows

stone beacon
#

stares in google and all big tech spies

obtuse abyss
slate swan
#

πŸ‘οΈ πŸ‘οΈ

slate swan
slate swan
slate swan
slate swan
#

😳

slate swan
#

anyways its getting ot

#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

slate swan
# lament depot

buttons, modals, dropdowns and change to slash command only

paper sluice
#

why sc only?

slate swan
slate swan
slate swan
#

If people are original, they do

forest grotto
#

my bot got issues

slate swan
#

every bot with a unique feature will be copied by someone else

paper sluice
#

creativity has left my mind

slate swan
#

Unfortunately everyone wants to make a multipurpose bot these days

#

Which we don't really care about anymore

#
@client.command(aliases=["suggest"])
async def suggestion(ctx,*,suggestion):
    await ctx.message.delete()
    embed = discord.Embed(description="\n" + suggestion + "\n")
    embed.set_thumbnail(url=ctx.author.avatar.url)
    embed.add_field(":thumbsup: **__Up Votes__**\n\`\`\`0 Votes\`\`\`**`")
    embed.add_field(":thumbsdown: **__Down Votes__**\n**\`\`\`0 Votes\`\`\`**")
    embed.set_author(ctx.message.author.name + "' Suggestion", ctx.message.author.avatar.url)
    await ctx.send(embed=embed)

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: add_field() takes 1 positional argument but 2 were given

slate swan
#

I don't see where I gave 2 arguments?

forest grotto
#

for example the timestamp isn't right

slate swan
# paper sluice why sc only?

i like slash commands better over prefixes colliding and its just better handling in slash commands like showing arguments in a ui

forest grotto
#

and authors pfp doesn't load

slate swan
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style
chaining. Can only be up to 25 fields.
paper sluice
slate swan
#

;-;

#

As you can see there is name and value which are required kwargs

#

So

embed.add_field(name="...", value="...")
slate swan
#

!d discord.Embed.set_author

unkempt canyonBOT
#

set_author(*, name, url=None, icon_url=None)```
Sets the author for the embed content.

This function returns the class instance to allow for fluent-style
chaining.
slate swan
#

Where there is =... it means there is a default value and it's not needed to set it

slate swan
#

I need a discord bot that solves my homework KEKW

slate swan
#

!d discord.Embed.set_footer

#

You can use the documentation directly for that

#

Or go in #bot-commands :D

#

Yeah sorry guys should've thought of that

slate swan
#

Numerical physics same

#

You just need enough context and values

#

Or make it smart to do a system of equations

#

i did

#

how to get guild icon?

#

still, only shows one command and yes i am using gyuld id

paper sluice
#

@slate swan how to sync slash commands in pycord?

slate swan
slate swan
paper sluice
#

:sigh:

slate swan
#

2.0

#

I swear

#

discord.Guild.icon.url

#

Yeah

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'url'

#

icon is None

#

OH

#

true

warped mirage
#

Guys can someone help me make a levelling system

#

With rank card (canvas)

slate swan
#

If you should how far you are right now and what your plans are, sure we can help your solve your issues and/or guide you

slate swan
#

But to find them based on some input, yikes

slate swan
warped mirage
#

But I do need help to add the canvas thing

slate swan
#

NO that's because it's 2.0

#

How to get emoji in a button? for me it just shows this

slate swan
unkempt canyonBOT
slate swan
#

you should place it here

#

OH

#

Needs to be an emoji object, just as side note

#

Oh

#

!d discord.ext.commands.Bot.get_emoji

unkempt canyonBOT
slate swan
# slate swan Needs to be an emoji object, just as side note
class Suggestion(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
    x = client.get_emoji(971107345205706772)
    check = client.get_emoji(971107345176330341)
    @discord.ui.button(label='0',emoji=check, style=discord.ButtonStyle.green, custom_id = 'upvote')
    async def button_callback(self, interaction, button):
        print("e")
    @discord.ui.button(label='0',emoji=x , style=discord.ButtonStyle.red, custom_id = 'downvote')
    async def button_callback(self, interaction, button):
        print("a")```
#

So basically it's not working. Anyone know what I am doing wrong?

#

Well first you have twice the same callback

#

the fn names should be different

#

Oh

#

else only the last one will get registered

#

Yep I noticed 😰

#

that's better
now only emoji

#

Remove the label?

pure bear
#

Excuse me, Can we create a channel forum with a discord.py bot or not yet?

slate swan
#

Probably not as they have not rolled out

#

So the API most likely blocks you from creating them

pure bear
#

Oh okay, thank you

slate swan
#

In components.0.components.0.label: This field is required
In components.0.components.1.label: This field is required

wispy solstice
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'request'
I'm getting this while using fetch guild?

slate swan
#

Interesting because it's actually not required

slate swan
#

Try to put the normal emoji in emoji=, so like emoji="<...>"

heady sluice
#

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

Used to use that before

heady sluice
#

mm it's not

slate swan
#

SO why it say that?

warped mirage
#

Ima send my error

wispy solstice
#

Can anyone try fetch_guild for me?

slate swan
#

It works fine

#

βœ…
❌
I'll just use that lol

wispy solstice
# slate swan It works fine

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'request'

slate swan
#

You're trying .request on something

#

Without code or full traceback we can't help 🀷

wispy solstice
#

guild = await client.fetch_guild(id)

slate swan
#

Issue might not be here

#

yeah its not

#

Share the code of the command and the full tracback

heady sluice
#

you didn't replace id?

wispy solstice
#

I'm getting from here

wispy solstice
slate swan
wispy solstice
#

Ignoring exception in command send:
Traceback (most recent call last):
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\cmdsdir\moderation.py", line 12, in send
guild = await client.fetch_guild(968137373395324938)
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\client.py", line 1188, in fetch_guild
data = await self.http.get_guild(guild_id)
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\http.py", line 192, in request
async with self.__session.request(method, url, **kwargs) as r:
AttributeError: 'NoneType' object has no attribute 'request'

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

Traceback (most recent call last):
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\kerdo_000\PycharmProjects\SystemDiscordBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'request'

heady sluice
slate swan
#

Lovely

#

thats weird shouldnt it handle it?

wispy solstice
heady sluice
#

I was thinking about an overwrite in the function names somewhere

wispy solstice
#

the other commands that doesn't use guild are working fine

olive osprey
#

Hey,
I'm currently migrating my bot to disnake, and I was wondering how I can turn a slash optional option, into a required option.

    async def blacklist(self, inter, user: disnake.Member = None):

Currently it's not really required, which isn't what I want.

heady sluice
#

not setting it to None

slate swan
# wispy solstice idk

The client is not logged in, so you probably creating a new Bot or Client instance somewhere

wispy solstice
slate swan
#

No

wispy solstice
#

So what?

olive osprey
slate swan
#

Might want to use Bot instead of Client

slate swan
wispy solstice
slate swan
#

Naming conventions NotLikeThis

#

Looks good though

heady sluice
wispy solstice
#

I always use client πŸ˜‚

wispy solstice
heady sluice
#

I've never seen it being called

wispy solstice
#

I'm using this everywhere in my bot

heady sluice
#

wdym everywhere

slate swan
#

Anyways, try to kill the bot and get it back online

wispy solstice
#

Every single file

heady sluice
#

for one bot

wispy solstice
heady sluice
#

you make many bot instances for one bot

slate swan
wispy solstice
slate swan
#

Second time?

wispy solstice
#

No I'm using just one instance it's pycharm

slate swan
#

Not an instance

#

Do you have only client = ... once in your code?

wispy solstice
#

I mean one connection from pycharm

heady sluice
#

this is confusing

wispy solstice
#

No multiple for every file of my files

slate swan
#

Then this is the issue

#

You need it only once, in your main file

#

And for other files, you're using cogs right?

wispy solstice
wispy solstice
slate swan
#

Then use them

heady sluice
#

this is weird

slate swan
#

You only need to define client = ... once

heady sluice
#

oh you import the commands like I said when you said you didn't want cogs?

slate swan
wispy solstice
#

cogs is somehow hard for me πŸ˜‚, i didn't use cogs before

slate swan
#

You have to

slate swan
#

Or put everything in one file

#

discord 2.0?

wispy solstice
#

But i want an explanation, why all of my commands are working just this, i don't think that's the issue

heady sluice
#

well that doesn't seem to work

heady sluice
#

if you need bot

#

which you do

slate swan
#

You're just always creating a new instance of client

#

Which will never be connected, thus client.session is None

wispy solstice
#

But I'm not running it on every single file

heady sluice
#

ah I get it

slate swan
#

Again

wispy solstice
#

I'm just using client.run on main

slate swan
#

That won't work. Use cogs.

heady sluice
#

making a bot instance does remove the undefined error, but it's also using the same not yet started client

slate swan
#

And as I said, you never connect that instance - which you also shouldn't

wispy solstice
#

I'll make it in a single file and importing it and see?

slate swan
#

Stop importing it

#

Use cogs

wispy solstice
#

I didn't

#

I don't wanna use cogs for now

heady sluice
#

it's a simple subclass

slate swan
#

You have to if you want different files, as simple as that.

#

If you don't want to use them, put everything in one file

wispy solstice
#

The Class thing is hard for me now, I tried using it many times but everytime I fail

slate swan
#

The event is most likely on_application_command_error, on_command_error would be for normal commands

heady sluice
#

okay well, understanding classes is the main point of dpy

#

but it can be done without this knowledge

#

hard

slate swan
#

This is a something you need to know before jumping into discord.py

wispy solstice
#

πŸ˜‚ but i didn't and every time it works, i've made multiple bots for now, but i didn't use python 6-12 months so i forgot somethings, that's it

#

I've made all types of bots for now and they've worked fine

heady sluice
#

yeah I was like this one year ago, now I'm looking at my old bots and asking what was wrong with me

wispy solstice
#

πŸ˜‚ my holidays are after a month and i'll see the class & cogs

#

for now how can i solve this problem

heady sluice
#

one file <- everything

wispy solstice
heady sluice
#

check it

wispy solstice
#

i made a million file and every file has its client

wispy solstice
#

they've gone with repl it

heady sluice
#

repl

paper sluice
#

it works, its a bit diff

#

in pycord its async def foo(self, button, interaction) in dpy its async def foo(self, interaction, button) (assuming ur subclassing view and using buttons)

#

u need send ur code, i can't tell from one line :/

wispy solstice
heady sluice
#

guild.get_member, guild.members

wispy solstice
#

But I'm getting None?

#

I'm sure that the id is right

heady sluice
#

guild.fetch_member?

wispy solstice
#

guild = client.get_guild(968137373395324938)
print(guild)

slate swan
#

How to update a button when it's clicked?