#discord-bots

1 messages · Page 1103 of 1

sonic flax
#

i want it to show it like that tho

#

oh wait

cerulean folio
#

Guys please I'm so close to solve my problem totally !

async def select_anonymous(message, client, data):
  view = AnonymousView()
  msg = await message.channel.send('Do you want this report to be **Anonymous**?', view = view)
  tasks = [asyncio.create_task(view.wait()),
                 asyncio.create_task(client.wait_for('message', check=button_check))]
  done_tasks, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
  if tasks[1] in done_tasks:
    return 'Cancel'
  else:
    return 'Done'

the function view.wait() returns 1 or 2, and I need that to be retured in the very last line of my code instead of 'Done' ! Please help me ZhongHeart

lyric apex
#

!e py import time y = time.time() print(f"{int(y)}")

unkempt canyonBOT
#

@lyric apex :white_check_mark: Your eval job has completed with return code 0.

1655352376
slate swan
sonic flax
#

thanks

lyric apex
#

Use this int that will get you want*

sonic flax
#

when i tried it in mine it didnt work

lyric apex
#

<t:1624855717>

lyric apex
sonic flax
lyric apex
slate swan
sonic flax
sonic flax
lyric apex
#

That i showed you

#

<t:1655352791>

slate swan
# sonic flax

Oh I thought you wanted the seconds included in your message

sonic flax
#

I want it to show month day year time

cerulean folio
#

I fixed it !

#

Thank youuuuu ! ♥️

lyric apex
sonic flax
#

i mightve got it

sonic flax
lyric apex
#

You can remove it simply

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.

Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
sonic flax
#

in fields

#

So theres no . at the top

lyric apex
#

But there will be a space

dusky pine
#

_ _

maiden fable
#

Please don't send empty messages

slate swan
slate swan
#

since an entity exists at that place 😔

lyric apex
dusky pine
#

is it entity 303 😳

lyric apex
#

Can you tell him *

maiden fable
dusky pine
#

_ _

slate swan
lyric apex
#

Using newline

sonic flax
#

its at the bottom tho

lyric apex
sonic flax
#

And not a footer

lyric apex
#

Ashley is here

slate swan
# lyric apex Is that?

there always will be a space, you cant change it by any means unless it's a zero width character (which doesn't change anything too)

lyric apex
#

^Gud Nyt^

dusky pine
#

Here is jeffery to help u sleep

dusky pine
lyric apex
slate swan
slate swan
slate swan
dusky pine
lyric apex
#

Bruhh

dusky pine
#

The embebd value is just bullet character

slate swan
#

it's a field with multiple lines

dusky pine
#

^^

#

sonic flax
#

wdym

lyric apex
#

O god now i get to know that what a half ss can do

sonic flax
#

OH'

slate swan
#

Embed.add_field(name="involved", value="user1\nuser3")

dusky pine
sonic flax
#

thanks

lyric apex
#

new line existszz_Sad_Cat

dusky pine
#

("•_•)

lyric apex
#

):

dusky pine
#

the eyes are bullet character

lyric apex
dusky pine
#

____ ____ ____
("•o•) \🔫 (•_• ) \🔫 (•_• )
|_ | |_ | |_ |

in Discord markdown

\_\_\_\_              \_\_\_\_                  \_\_\_\_
("•o•)   \🔫 (•\_• )        \🔫 (•\_• )
  |\_   |              |\_   |                  |\_   |
lyric apex
#
-_- | _ | ~_~ | _ | °_°
-_- | _ | ~_~ | _ | °_°
#OwO
#UwU```
dusky pine
#
Helpers: 
Let me out of this codeblock!!!        .catch(console.error) ========--------------------💨                                  Someone:
   ____        ____                             if __name__ == "__main__":   ========----💨💨                                can u fix??
  (•o•")      (•o•")                                     const [list, setList] = useState(0); ========-----💨💨               (•_•')
🔨 |  |    🔨 |  |                                 def main() -> None =====------💨                                            |  |                                           
lyric apex
#

||Alr Gn||

dusky pine
#

gngn

stray adder
#

I made a kick cmmd that only admin have the permission and if any member use this command i want to show the reply from bot "that you dont have permission to use this cmmd" how can i do that

dusky pine
#

It takes ctx and error

#

You can check if error is of type MissingPermissions via isinstance

slate swan
#

and you cant send messages to a memver after theyre

#

kicked

#

unless they have any other mutual server with you

stray adder
#

Thanks

#

And there is one more problem😅 the meme is coming after 10sec when executing the meme cmmd

dusky pine
#

your internet is probably slow to fetch memes

slate swan
#

that wouldnt matter

stray adder
#

Im not using computer iam useing replit in my phone😅

dusky pine
#

router*

#

or internet

#

dunno the term

slate swan
#

only real thing that can slow down from making a request is your wifi, and if its delayed maybe something is blocking your code

maiden fable
dusky pine
dusky pine
stray adder
maiden fable
#

The reason I mentioned it and not Dyno is cz it's coded in Python

slate swan
spring flax
#

mee6 is in py?

slate swan
dusky pine
# stray adder

why r u using reddit package lol, that's synchronous and blocking

spring flax
#

did the devs say?

maiden fable
slate swan
#

mee6 is written in python with a private api wrapper

maiden fable
dusky pine
#

You can just use aiohttp to fetch it

spring flax
dusky pine
#

https://reddit.com/r/memes/random/.json

stray adder
slate swan
#

old youtube tutorials are no good

dusky pine
#

you know you can replace nextcord with discord right 😔

#

unless they use any library-specific features

paper sluice
slate swan
#

they have too good developers to use such a lib

stray adder
#

Im done im going to delete this bot🙁

dusky pine
slate swan
#

if i would make a bot as big as mee6 i would make my own api wrapper tbh

dusky pine
#

what if the private api wrapper was just a discord.py fork

paper sluice
dusky pine
#

🍴

slate swan
dusky pine
paper sluice
stray adder
# dusky pine why

Cant do anymore actually i dont know python i made this bot by searching on google and copied many codes🙁

slate swan
slate swan
#

not really

stray adder
#

🙁

dusky pine
#

i used to copy a lot of stuff from stackoverflow

slate swan
#

a dev only searches for answers not full on snippets you dont learn by getting spoonfeed, you actually have to take time to understand and learn the language

paper sluice
dusky pine
slate swan
#

a long but grateful process

shrewd apex
#

i mean some snippets if already written u need not write it again

dusky pine
#

i looked at a code and see what it does bc there's usually some explanation on top of the code you copy

stray adder
shrewd apex
#

not thats basically a mash up of God knows what

#

i meant like small pseudo code or formulas some opencv processes that kind of stuff

dusky pine
#

if you copy code and don't change variables, etc, and expect it to work, now that's what you call a skid

paper sluice
dusky pine
stray adder
#

I wanted pc but cant afford that so i used replit to code😂

dusky pine
#

i type the code on vscode, not copy & paste literally

#

that's... i guess you could say "that's not how you learn, you didn't make the tutorial"

paper sluice
#

That was not aimed at tutorials

sonic flax
#

how do i change a members permissions in a channel

cerulean folio
#
async def my_function(message, client, data):
  await message.channel.send('Give me 3 images of cats !')
  def check(m):
    return m.author == message.author
  msg = await client.wait_for('message', check=check)
  return str((',').join(msg.content.split(' ')))

This function asks for 3 images of cats and returns a string of the links seperated by commas.
Although, if you write anything it will just store it. I'd like it to rerun with a message when someone sends anything that isn't a link. How would you do such a loop?

shrewd apex
#

why not create roles with those perms and assign

shrewd apex
dusky pine
cerulean folio
shrewd apex
#

use a while True:

slate swan
#

no need for a loop

cerulean folio
#

while 'https://' not in message.content

maiden fable
#

not a while please

slate swan
#

sender sends a link
then Bot.wait_for would wait for an event to be dispatched

cerulean folio
#

oh or i just edit the check function u mean?

shrewd apex
#

yeah u can do that too

slate swan
cerulean folio
#

oh !!!

#

okay !

shrewd apex
#

it's basically an event and when u use it in a command it works until the check is satisfied and it moves on to the next part of the code

cerulean folio
#

I got it !

slate swan
shrewd apex
#

message.attachments[0].url then

cerulean folio
#

if they're attachment I'll find a way to capture them, upload them somewhere, and then store the link

shrewd apex
cerulean folio
#

that's tough tho I hope I'll find an API of a image host to do it

shrewd apex
#

if message.attachments returns list of attachment objects.

slate swan
shrewd apex
#

should I write it out for him?

slate swan
#

no

shrewd apex
#

then what do u want me to do?pithink

slate swan
#

dunno

shrewd apex
#

-_-

slate swan
#

give command ideas

shrewd apex
#

for u?

sonic flax
#

how do i change a members permissions in a channel after creating it

slate swan
#

mhm

shrewd apex
#

have you tried pls help in dank memer?

slate swan
#

wait

shrewd apex
#

if u havent there is endless amounts of inspiration there for u 300+ commands ig

slate swan
#
  • dank memer is meh
#

^

#

every bot is shhhh rn

granite parcel
#

[<discord.ext.commands.core.Group object at 0x7f456442bbb0>]

shrewd apex
#

no not economy commands i am talking about their slice of life commands there is some crazy stuff there especially in few sections 💀

granite parcel
#

how to fix this i am using commands.parent

slate swan
shrewd apex
#

pfft

slate swan
#

Command.parent.parent wut
nested group Commands be like ^

#

nobody saw nothing

shrewd apex
#

isn't that commands.grandparent?

slate swan
granite parcel
slate swan
sonic flax
#

await channel.set_permissions(member, overwrite=None)
instead of member do i put their id?

shrewd apex
#

let's traceback to ancestors

slate swan
#

welcome

shrewd apex
#

ik it's a jk

sonic flax
slate swan
unkempt canyonBOT
cerulean folio
slate swan
granite parcel
shrewd apex
slate swan
# cerulean folio ohhhh thank youuuuu !

and as a side not, as you wanted to store three images per member, you can do something like {author_id}1.jpg, then {author_id}2.jpg etc. in order to save 3 images

shrewd apex
#

u could just do user:[*imgs]

slate swan
#

the file ext can be anything
preferably pngs and jpgs

slate swan
shrewd apex
#

oh ic

slate swan
#

it's a good one since you can get 10gb storage for free and upload files for 10gb heh

shrewd apex
#

well if it's just links prolly a dict would be easier since he is not downloading and storing images

granite parcel
slate swan
granite parcel
#
{<discord.ext.commands.core.Command object at 0x7efc97788220>, <discord.ext.commands.core.Command object at 0x7efc97788070>, <discord.ext.commands.core.Command object at 0x7efc977882b0>, <discord.ext.commands.core.Command object at 0x7efc97788340>, <discord.ext.commands.core.Command object at 0x7efc97788190>, <discord.ext.commands.core.Command object at 0x7efc977883d0>}```
sonic flax
#

overwrite = discord.PermissionOverwrite()
overwrite.send_messages = False
overwrite.read_messages = True
await channel.set_permissions(member, overwrite=overwrite)

#

what do i put for overwrite

shrewd apex
slate swan
#

but storing images that way could be better

#

since if you wanna use a link, it can lead to problems

cerulean folio
#
def check(m):
    return (m.author == message.author) and (('https://' in message.content) or (message.attachments and [x.content_type.startswith("video") for x in message.attachements]))

I want my function to check if the author of the message is the author of the request, and if there are image links in the message, and if there's attachements sent otherwhise (and check if they're images)

#

Is that fine?

shrewd apex
#

yeah like i upload an attachment store the link and delete the attachment the image is no longer available

slate swan
cerulean folio
#

yup

granite parcel
#

@slate swanhow to convert object in strings?

cerulean folio
#

i've had problems that's why I'm trying to find a website that uploads images with an API system

slate swan
#

aka the built in string converter

granite parcel
slate swan
#

if you want to see the results just check the str dunder in the source code of the class youre looking for

shrewd apex
granite parcel
#
para = [str(command) for command in y.commands]```
granite parcel
slate swan
slate swan
granite parcel
shrewd apex
slate swan
#

then just use the attr

slate swan
#

and cast it

slate swan
shrewd apex
#

no not that bad yet pithink

cerulean folio
#
def check(m):
    return (m.author == message.author) and (('https://' in message.content) or (message.attachments and [x.content_type.startswith("image") for x in message.attachements]))

Is this fine to you guys?

stray adder
slate swan
granite parcel
#

or i have to define it again

slate swan
slate swan
slate swan
maiden fable
cerulean folio
karmic marsh
#

how can I check to see if a channel exists by name?

#

would be great if I could also check what category it's in

slate swan
#

its better and not esoteric

cerulean folio
#

Then I'll just do this:

def check(m):
    return (m.author == message.author) and (('https://' in message.content) or (message.attachments))

And then when there's https:// or attachements, i'll code functions to check if they're images or not

stray adder
slate swan
cerulean folio
#

because that's already a nice filter

slate swan
#

over returning the results which will probably be truthy

cerulean folio
#

OHHHHH !

#

You're a genius omg XD

spring flax
#

@maiden fable random question have you used asyncpraw before?

slate swan
#

i have

sonic flax
#
     overwrite = discord.PermissionOverwrite()
      overwrite.view_channel = True
      await channel.set_permissions(int(person1), overwrite=overwrite)
      await channel.set_permissions(int(person2), overwrite=overwrite)
slate swan
#

i would prefer to use aiohttp tho

sonic flax
#

InvalidArgument: target parameter must be either Member or Role

maiden fable
spring flax
# slate swan i have

do you know somewhat a lot about it? and can i ask some thing in a help channel?

slate swan
#

asyncpraw should only really be used for objects and lib abstractions

slate swan
slate swan
slate swan
karmic marsh
slate swan
maiden fable
karmic marsh
#

not id, has to be by name

sonic flax
#

can someone help

#
     overwrite = discord.PermissionOverwrite()
      overwrite.view_channel = True
      await channel.set_permissions(int(person1), overwrite=overwrite)
      await channel.set_permissions(int(person2), overwrite=overwrite)

Why do i get InvalidArgument: target parameter must be either Member or Role?

slate swan
#

but works most of the times

karmic marsh
#

disnake doesn't have guild_channels_iterable

shrewd apex
karmic marsh
#

unless it's got some sort of additional context

shrewd apex
#

yeah whatever

maiden fable
#

:p

sonic flax
slate swan
#

the questions crack me up sometimes

karmic marsh
#

this is on_message_edit which just has self, before, after

slate swan
slate swan
karmic marsh
#

there is no ctx in this context lol

slate swan
#

no ctx in this context

#

nice

maiden fable
#

or after.guild.channels

slate swan
#

these channels will include categories too, right?

maiden fable
#

Yea

#

Since CategoryChannel is also a channel

slate swan
#

that sucks

maiden fable
#

Thanks Danny

slate swan
#

thanks discord*

#

well Guild.text_channels exist too

stray adder
#

How did you guys learn python😅

maiden fable
#

yea, guild.text_channels and guild.voice_channels

maiden fable
slate swan
#

so you can just ```py
channels = Guild.text_channeld; channels.extend(Guild.voice_channels)

stray adder
sonic flax
#

overwrite = discord.PermissionOverwrite()
overwrite.view_channel = True
await channel.set_permissions(int(person1), overwrite=overwrite)
await channel.set_permissions(int(person2), overwrite=overwrite)

Why do i get InvalidArgument: target parameter must be either Member or Role?

#

helppp

maiden fable
maiden fable
slate swan
#

yeah f

slate swan
maiden fable
#

Ig, never tried

slate swan
#

all they use is the Id anyways

maiden fable
#

Yea

sonic flax
maiden fable
#

!d discord.Member ctx.author and message.author can return one

unkempt canyonBOT
#

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

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

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

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

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
slate swan
gaunt ice
#

hm

sonic flax
slate swan
#

im not sure if that was sarcasm or if you were serious

sonic flax
#

x == y Checks if two members are equal. Note that this works with User instances too.

x != y Checks if two members are not equal. Note that this works with User instances too.

#

what does it mean by equal btw

slate swan
#

it checks if the 2 instances are the same

#

more like oop

sonic flax
#

OH

#

im so dumb

sonic flax
maiden fable
slate swan
#

no need for his case

sonic flax
maiden fable
#

Yes

slate swan
#

im pretty sure it would be the same thing

slate swan
left idol
#
if discordID in [301480016657776642, 464721355116380160]:
    a = 0
    b = 10
elif discordID in [92786442891169792, 746850928417701990]:
    a = 85
    b = 99
else:
    a = 49
    b = 99

Spiking = np.random.randint(a, b)```
i currently have this part of a command which works by itself when taken out and works for the first if and else, but for elif it doesn't do anything? no errors either
slate swan
unkempt canyonBOT
#

discord/abc.py lines 914 to 919

if isinstance(target, User):
    perm_type = _Overwrites.MEMBER
elif isinstance(target, Role):
    perm_type = _Overwrites.ROLE
else:
    raise ValueError('target parameter must be either Member or Role')```
sonic flax
#

!d discord.Object

unkempt canyonBOT
#

class discord.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create ‘miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

x == y Checks if two objects are equal.

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

hash(x) Returns the object’s hash.
slate swan
#

ah thats for his use case, sorry i was a bit confused

#

thats just for the ENUM, for what target type to use :V

sonic flax
# maiden fable Yes

16.06 02:12:14 [Bot] await channel.set_permissions(discord.Object(person1)), overwrite=overwrite)
16.06 02:12:14 [Bot] ^
16.06 02:12:14 [Bot] SyntaxError: cannot assign to await expression

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

slate swan
unkempt canyonBOT
#

disnake/utils.py lines 362 to 375

def snowflake_time(id: int) -> datetime.datetime:
    """
    Parameters
    ----------
    id: :class:`​int`​
        The snowflake ID.

    Returns
    -------
    :class:`​datetime.datetime`​
        An aware datetime in UTC representing the creation time of the snowflake.
    """
    timestamp = ((id >> 22) + DISCORD_EPOCH) / 1000
    return datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc)```
slate swan
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

slate swan
#

Oh that won't work I think

maiden fable
slate swan
#

I was just correcting the parenthesis lol I didn't read the code

#

the param's different for roles and members, discord.Object won't let you know what type it is, mhm

#

Unfortunate design

#

I'm tempted to just ditch sleep to make a more REST friendly version of discord.py

slate swan
#

No, the fact that you need either a Role or abc.User object

sonic flax
#

Why*

slate swan
#

And that you can't just specify the type manually

#

use hikari and you can do that kannapogg

slate swan
slate swan
slate swan
sonic flax
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: target parameter must be either Member or Role

#

it still says this when i run it

slate swan
#

...

#

It gives you the error

#

Read it

slate swan
sonic flax
slate swan
#

Check the line, you can debug it yourself.

sonic flax
slate swan
#

Who?

#

Well that won't work

slate swan
sonic flax
slate swan
#

!pip hikari-crescent slash only command handler with neat design

unkempt canyonBOT
slate swan
#

Wtf am I doing

#

Guild.get_member / Client.get_user

karmic marsh
#

how can I mention a user? this doesn't work:
f"@{before.author}"

sonic flax
slate swan
sonic flax
#

or what im so tired now

slate swan
slate swan
#

could you stop?

#

ot, and please keep these things to urself.

sonic flax
slate swan
#

Really this again?

#

<@&831776746206265384>

sonic flax
#

<@&831776746206265384>

slate swan
#

Yeah no we don't need to spam mention

#

just why

sonic flax
#

Punish him

karmic marsh
slate swan
#

What possess these people to say such things.... 🤦‍♂️

slate swan
sonic flax
slate swan
pastel lake
slate swan
#

Guys, this is not a conversational channel, please keep that stuff elsewhere.

sonic flax
#

for example if the command was .perms id#1 id#2 i'd want to to give both of the members permissions to the channel

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

I'm curious if other channels experience the same issues or is this channel just a hot spot

sonic flax
#
overwrite = discord.PermissionOverwrite()
      overwrite.view_channel = True
      member=guild.get_member(person1)
      await channel.set_permissions(member, overwrite=overwrite)
      member=guild.get_member(person2)
      await channel.set_permissions(member, overwrite=overwrite)
slate swan
sonic flax
#

what am idoing wrong 🧐

stray adder
#

Hi

sonic flax
slate swan
#

personx must be an int

#

and what's the person1 variable?

slate swan
#

already went over this with you earlier

sonic flax
#

Well that was 3 hours ago, i forgot sorry

slate swan
#

can we not?

slate swan
stray adder
stray adder
slate swan
#

...?

deep sorrel
#

!ban 950887397749575702 Unacceptable behavior. Goodbye.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @limpid knoll permanently.

slate swan
#

thank you🙏

deep sorrel
stray adder
slate swan
#

Good night guys👋

slate swan
shrewd apex
#

gn

#

eh a ban did something happen?

slate swan
slate swan
#

lets just move on from that lol

shrewd apex
#

👍

rocky hornet
#

is Context.subcommand_passed not None only for groups?

#

how can i get currently executing group from that same group?

#

ok

lyric apex
#

!d discord.ext.commands.Command.short_doc

unkempt canyonBOT
#

property short_doc```
Gets the “short” documentation of a command.

By default, this is the [`brief`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.brief "discord.ext.commands.Command.brief") attribute. If that lookup leads to an empty string then the first line of the [`help`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command.help "discord.ext.commands.Command.help") attribute is used instead.
lyric apex
#

How to use this?

rocky hornet
#

wdym use?

lyric apex
#

And how do i set command description

rocky hornet
#

you can look at the source

rocky hornet
lyric apex
rocky hornet
#

in command definition

lyric apex
#

After async def?

rocky hornet
#

its either description or help

rocky hornet
lyric apex
#

K

rocky hornet
#

short_doc returns .brief or first line of .help @lyric apex

lyric apex
#

How do i access this desc in a page?

rocky hornet
#

page?

lyric apex
#

Means if i want to show that anywhere

rocky hornet
lyric apex
rocky hornet
#

when u put a docstring, it is stored in command.help

#

so use that i guess

#

or @command(description="...")

#

this is wrong on so many levels

lyric apex
#

Can't we use command.short_doc?

rocky hornet
#

we can

#

but can you?

lyric apex
#

Lemmie tryzz_Sad_Cat

slate swan
#

okay Im not nvm

rocky hornet
#

Command is not a deco,
if you meant command, then you need to call it - command(),
the docstring is not description but help string,
if used in a cog, then first param is self

slate swan
#

.....?

#

that wasn't even required

#

nvm your fault

rocky hornet
#

huh

slate swan
#

I mean, I do know how commands are created ¯_(ツ)_/¯

rocky hornet
#

so do i, and i see no reason to use Command when even the docs explicitly say you're supposed to use a special deco commands.command

lyric apex
#

I think ashley was showing example

lyric apex
#

Where is ||Common sense||

rocky hornet
slate swan
#

It's not like anyone is copying it ¯_(ツ)_/¯

#

cope

rocky hornet
#

its not like thousands of people are on this server solely for help with discord bots

slate swan
#

....?

rocky hornet
#

not like they copy stuff directly from here

#

(they do)

slate swan
#

there're better command examples, imagine still arguing

rocky hornet
#

ok bro you do you

#

im just trying to give quality help

slate swan
#

ok then

rocky hornet
#

is there a way to get command group from that same group?

#

i have ```py
@commands.group()
async def something(self, ctx): ...

where I'd expect `ctx.command` to return that Group
#

but the docs say it only returns Command

lyric apex
#

That command.short_doc workedzzTh_QtCat

dusky pine
#

y code not work

public static void def discordbot[] {
  command = moderation music

 logimn discrdbot
end
rocky hornet
#

get out with typescript

dusky pine
#

wwhat

rocky hornet
#

this is python server

dusky pine
#

🟦🏃‍♂️ python

lyric apex
#

🙃

rocky hornet
#

r/woooosh me

lyric apex
#

┬─┬ ノ( ゜-゜ノ)

rocky hornet
#

sussy

maiden fable
rocky hornet
#

i finally got to use a metaclass in production

#

happy

maiden fable
#

I never used it

rocky hornet
#

i needed it to add commands to cog dynamically

lyric apex
placid skiff
#

Hunt u know, intelliJ is so cool that i'm thinking to develop in java again D_D

rocky hornet
#

so that cog class is created with commands instead of adding them manually which dpy doesnt let u do easily

slate swan
#

Hello, how to delete all channels and categorys of a server
Like if user says !cleanserver
it deletes all channels and categorys
please tell me how to implement that in a cmd

#

please help i need this

dusky pine
#

☕ \🔫 (•v• ) \👍

#

me rn

placid skiff
slate swan
#

nahh

rocky hornet
slate swan
dusky pine
slate swan
#

i don't have servers to nuke imao

#

and why would i nuke mine

dusky pine
#

you can swear here

slate swan
lyric apex
#
for channel in ctx.guild.channels:
    await channel.delete()```
dusky pine
#

anyway yeah just iterate and delete

slate swan
slate swan
#

nuke?

rocky hornet
#

prolly wanna with suppress(Forbidden):

slate swan
maiden fable
maiden fable
lyric apex
slate swan
slate swan
slate swan
rocky hornet
#

it wont if u put it in the right place

lyric apex
slate swan
#

ctx.guild.category?

rocky hornet
#

ctx.guild.categories

slate swan
#

thanks

lyric apex
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

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

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
slate swan
#

bro why 💀

rocky hornet
#

nuke

slate swan
#

u helping him for nuke

slate swan
#

!rule 5

unkempt canyonBOT
#

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

slate swan
#

:pepeevil:

rocky hornet
slate swan
#

....?

#

LMAO

lyric apex
rocky hornet
#

if when

slate swan
slate swan
#

bot dont own guilds

rocky hornet
#

arent guild owners responsible for which bots to trust?

slate swan
placid skiff
slate swan
rocky hornet
slate swan
#

wtf

#

!d discord.Client.create_guild

unkempt canyonBOT
#

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

Creates a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").

Bot accounts in more than 10 guilds are not allowed to create guilds.

Changed in version 2.0: `name` and `icon` parameters are now keyword-only. The `region` parameter has been removed.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
slate swan
#

:)

#

😑

#

Bot subclasses Client

rocky hornet
#

bots can create guilds if they are in no more than 10 guilds

placid skiff
#

Bot is a subclass of client lmao

slate swan
lyric apex
placid skiff
slate swan
#

never

rocky hornet
#

im not sure that nuking a server is against tos

slate swan
#

my typing speed's slow af

rocky hornet
#

you pick whom u trust

slate swan
#

😔

placid skiff
#

Everyone improves

lyric apex
slate swan
rocky hornet
slate swan
slate swan
rocky hornet
#

bots can do whatever as long as they are given perms by the owner

slate swan
#

imagine doing that without getting ratelimited., or atleast freq requests

placid skiff
slate swan
rocky hornet
placid skiff
#

why use 10 finger when you can use 10 toes btw

rocky hornet
#

toes are fingers

placid skiff
#

exactly

slate swan
#

phew

slate swan
#

why even type

#

a guy keeps bullying me

#

!ot

unkempt canyonBOT
slate swan
#

guys he is racist

slate swan
#

called me n word

placid skiff
slate swan
slate swan
#

he called me n word

#

he is racist

slate swan
slate swan
slate swan
slate swan
slate swan
lyric apex
#

Is there text font in bot of different style?

slate swan
#

..

slate swan
#

anyways back to topic or brad will come 😔

#

I told you I'm slow

placid skiff
#

Btw you can type using whatever you want
But if you don't use github theme to code then we can't be friend

lyric apex
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

lyric apex
#

This?

slate swan
#

^

#

🫂 i used to use it until i got used to light theme

lyric apex
#

Oh god

slate swan
#

we cant be friends if you dont run the rule 7 command ever too 🫂

slate swan
placid skiff
slate swan
#

argh that feels good

slate swan
#

real dark :V

slate swan
placid skiff
#

just... why

slate swan
#

and no, its not a modded client.

slate swan
slate swan
placid skiff
placid skiff
#

Oh yeah i love you

slate swan
#

yo

slate swan
#

O.O

#

tysm

#

feels gud

#

!ot enough

unkempt canyonBOT
placid skiff
#

guys code format looks so cool now lmao

slate swan
#

ye

#

NO OT NOW

#
print("amogus")
#

ooh nioce

slate swan
slate swan
#

..

placid skiff
slate swan
#

xD

slate swan
placid skiff
#

how to get rate limited in 5 lines of code

slate swan
#

first the owner told me "noob bot ni**er"

then i ran !r

||you know what happens next||

||boom||

slate swan
#

fahking fel gud

slate swan
placid skiff
#

I was doing it xD

slate swan
#

bruh

slate swan
placid skiff
#

No i was converting your 5 lines into 1 line

slate swan
slate swan
#
lambda a:for s in ctx.guild.members await s.ban(779990652149825537)
#

:)))

#

im not talking about the syntax, but discord ,
you cant ban the owner.

placid skiff
#
await channel.delete() for channel in ctx.guild.channels()

this one does

dusky pine
#

[await i.delete() for i in ctx.guild.channels + ctx.guild.categories]

#

they both implement .delete

slate swan
#

ok stop now enough

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

Suggest more topics here!

dusky pine
dusky pine
dusky pine
#

🖕

slate swan
#

?

dusky pine
#

bro

#

you keep changing topic

#

nobody talking now

maiden fable
dusky pine
#

me after calming down

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

Hello

#

Please help me to fix mistake

#
import discord
import json
import os
from discord.ext import commands

class User(commands.Cog):
    
    def __init__(self, client):
        self.client = client

    @commands.Cog.listener()
    async def on_ready(self):
        print("[INFO] [COGS] Module avatar loaded")

    @commands.command(name = "avatar")
    async def avatar(self, ctx, *, avamember : discord.Member=None):
        userAvatarUrl = avamember.avatar_url
        await ctx.send(userAvatarUrl)

def setup(client):
    client.add_cog(User(client))
#

`Ignoring exception in command avatar:
Traceback (most recent call last):
File "C:\Users\yura0\AppData\Local\Programs\Python\Python310-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "E:\Discord\SparkleBot\cogs\avatar.py", line 17, in avatar
userAvatarUrl = avamember.avatar_url
AttributeError: 'NoneType' object has no attribute 'avatar_url'

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

Traceback (most recent call last):
File "C:\Users\yura0\AppData\Local\Programs\Python\Python310-32\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\yura0\AppData\Local\Programs\Python\Python310-32\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\yura0\AppData\Local\Programs\Python\Python310-32\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 'avatar_url'`

placid skiff
#

How do you cast the command? what parameter do you pass when you call it? (in discord)

slate swan
#

I don't really understand it, everything is in the code

placid skiff
#

When you use your command what do you write?

#

Yeah ash i already know that avatar_url is not a paramater let's work on the NoneType first 😛

slate swan
#

,avatar

placid skiff
#

the full command with the parameters too, like you would do something like "[prefix]command parameters"

slate swan
#

it's cog

placid skiff
slate swan
#

The rest of the commands work

slate swan
#

ok

placid skiff
#

||neither member object has avatar_url tbh||

maiden fable
#

In 1.7 it does

slate swan
unkempt canyonBOT
#
Nah.

No documentation found for the requested symbol.

placid skiff
#

pretty old

slate swan
#

okay it's following the latest docs

maiden fable
#

The docs are from 2.0

slate swan
#

hunter's smort

#

and that;s wh he's working on mort

#

im too smart for this shit

maiden fable
#

That was a REALLY lame joke

slate swan
#

I know :)

#

I agree, now I feel bad reading what I wrote

placid skiff
#

Remorse comes fast

slate swan
#

indeed

modern fiber
#

Can I make it so a bot tracks membercount of multiple servers?

#

Basically you make a code like put the ID of the servers, and the bot prints their membercount

maiden fable
#

Sure

modern fiber
#

How to?

slate swan
#

!d discord.Client.get_guild

unkempt canyonBOT
#

get_guild(id, /)```
Returns a guild with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
maiden fable
#

!d discord.Guild.member_count

unkempt canyonBOT
#

property member_count```
Returns the member count if available.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") to be specified.

Changed in version 2.0: Now returns an `Optional[int]`.
slate swan
#

^

maiden fable
modern fiber
#

So,
get_guild(id1, id2)
print member_count?

maiden fable
#

No

modern fiber
#

or like

async def leader(ctx):
get_guild()

modern fiber
maiden fable
#
guild = bot.get_guild(id) 
print(guild.member_count) 
modern fiber
maiden fable
#

Yes

#

!d discord.ext.commands.GuildConverter

unkempt canyonBOT
#

class discord.ext.commands.GuildConverter(*args, **kwargs)```
Converts to a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").

The lookup strategy is as follows (in order):

1. Lookup by ID.

2. Lookup by name. (There is no disambiguation for Guilds with multiple matching names).

New in version 1.7.
dim sentinel
#

how do i make a discord bot leave a serverr by command?

rocky trench
#

Why do you want that?

dim sentinel
#

i dont have admin powers in that server

dim sentinel
rocky trench
dim sentinel
#

can you just tell me how do i achieve that?

rocky trench
#

Well anyways, use ctx.guild and await ctx.guild.leave()

dim sentinel
#

aight

slate swan
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

slate swan
#

!d discord.Guild.leave my bad

unkempt canyonBOT
#

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

Leaves the guild.

Note

You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.delete "discord.Guild.delete").
maiden fable
#

Only if Danny implemented a discord.Client.leave(discord.Object(guild_id))

slate swan
#

or making bots

#

for discord

maiden fable
#

I don't. This rewrite gonna be my last rewrite

slate swan
#

contrary

slate swan
maiden fable
#

What?

#

ctx.guild.leave(discord.Object(ctx.guild.id))?

slate swan
#

ew

vocal snow
#

you could just ctx.guild.leave() if you have ctx

slate swan
#

yeah

maiden fable
vocal snow
#

What sarth is saying is if you have a particular guild Id

slate swan
maiden fable
#

Oh wait, nvm

#

U mean if it's a classmethod?

vocal snow
#

I believe that's what he meant yes, I'm not sure how it's implemented in dpy

maiden fable
#

I don't think it's a classmethod

slate swan
#

that would work only if discord.py didnt check for _state

slate swan
maiden fable
#

Ah

slate swan
#

like you can discord.Guild.leave(a guild object here)

#

Who have tutorial video, How to hosting PY bot With VPS ?

maiden fable
#

What VPS do u have?

#

Also #discord-bot-hosting

slate swan
#

idk just i want bot hosting

#

i have bot with py language

#

when i hostig .replit i have problem all time.

silver magnet
#
async def coinflip(interaction: Interaction):
    coinlist = ["Heads", "Tails"]
    result = random.choice(coinlist)
    await interaction.response.send_message(result)```

so im trying
dusky pine
#

like on vultr or linode or something

#

vultr is cheap ig

maiden fable
dusky pine
#

i'll see

timid field
#
current_language = "en" 
@bot.command()
async def search(ctx):

    #Load current lang for picture
    global current_language

    #Get user input
    msg = ctx.message.content.split(" ")
    request = msg[2:]
    request = " ".join(request)
    error = None


    try:

        wikicontent = wikipedia.search(request, results=20, suggestion=False) #Wikipedia search request
        print(wikicontent)
        print(" ".join(wikicontent))
        

        #If there are no results
        if not wikicontent:
            wikicontent ="К сожалению, нет результатов поска на: '{}'.".format(request)
            embed = discord.Embed(title="Результаты поиска Википедии:", color=0xe74c3c, description=wikicontent)
            embed.set_thumbnail(url="https://www.wikipedia.org/static/images/project-logos/{}wiki.png".format(current_language))
            await ctx.reply(embed=embed)

        #If there are do:
        else:
            embed = discord.Embed(title="Результаты поиска Википедии:", color=0, description="\n".join(wikicontent))
            embed.set_thumbnail(url="https://www.wikipedia.org/static/images/project-logos/{}wiki.png".format(current_language))
            await ctx.reply(embed=embed)


    #Handle random errors
    except Exception as error:
        error = str(error)
        await ctx.reply("Sorry, a random error occurred. Please try again.")
        print(error)```


Error:
```An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub!```
dense swallow
placid skiff
placid skiff
dense swallow
#

so what else should i use?

placid skiff
#

What do you want to do? D_D

shrewd apex
#

what is even prepare once?

dense swallow
#

add pagination to my help embed

shrewd apex
#

lemme send u an good example

dense swallow
#

ok

shrewd apex
dense swallow
#

i have sub-classed my HelpCommand

dim sentinel
shrewd apex
#

so?

#

read the whole doc

dim sentinel
#

from what am i even supposed to choose

shrewd apex
#

which i send scroll down

dim sentinel
#

there's no scroll down apparantly

shrewd apex
shrewd apex
dim sentinel
shrewd apex
#

type in the categories place there should be some pop up of suggestions choose from there

dim sentinel
#

ooof gotcha

#

i thought u had to choose from something

#

thanks

shrewd apex
#

👍

dim sentinel
# shrewd apex 👍

yeah, i just submitted, it says to wait for 2 weeks to get verified, how will i know once its verified?

shrewd apex
#

they will send a mail probably

slate swan
maiden fable
#

I thought u meant Discord Verification and I be like: From when does discord cares about that

slate swan
#

they often take months lol

maiden fable
dim sentinel
#

imma just wait then

wanton cipher
#

How can I respond to an interaction without any visible output? (I am trying to make buttons and I need to respond to the interaction and I don't wanna make it give an annoying output)

leaden solar
#

Yo how could i make my on_reaction_add event get the content of this message embed and store the footer of the embed? The thing is that im trying to make the system detect the embed that the reaction came from and store the footer content of that embed

@bot.event
async def on_reaction_add(reaction, user):
    message = reaction.message
    channel = discord.utils.get(message.guild.channels, name="paid-services")
    if message.channel.id == 983745489763725364:
        print(reaction.emoji)
        if user != bot.user:
            if reaction.emoji == "🤝":
                embed = message.embeds
slate swan
wanton cipher
#

Yes, thank you :D

wanton cipher
slate swan
#

also, check if the message has an embed first, or this will raise an IndexError

leaden solar
#

oh

wanton cipher
#

yeah, that too

leaden solar
#

i will, because this event is only listening to a specific channel there it only sends embeds

#

so i hope it will still work lol

slate swan
#

oh, well if thats the usecase, sure.

wanton cipher
#

Is there a way I can have a view run for a certain amount of time and it doesn't matter what buttons are pressed? For example, I have this thing run for a minute, no more, no less, and during that time, I can press any buttons, if any at all, and after that minute the view will end or I can proceed with my code after said view

wanton cipher
#

ah

#

that might work

#

thank you

shrewd apex
#

view also has a on timeout feature which u can use in conjunction with that

silver magnet
#
async def ping(ctx):
    await ctx.send(f"In milliseconds: {round(bot.latency * 1000)}")```

no errors it just doesnt give output
shrewd apex
#

no message sent? do u have intents enabled for ur bot in dev page also by any chance do u have an on_message event?

slate swan
#

how do I make a command only work on a specific server ?

#
@commands.command(name='reniciar', description='reciar o bot')
async def suporte(reniciar : discord.Interaction):
    ReniciarEmbed = discord.Embed(title='Code Lab está reiniciando...', description='Code Lab está reiniciando em todos os servidores!')
    ReniciarEmbed.add_field(name='O que isso é?', value='Um dos nossos desenvolvedores fez alguma alteração na Code Lab e ela precisa reiniciar para aplicar as mudanças.')
    ReniciarEmbed.set_thumbnail(url=thumb)
    ReniciarEmbed.set_image(url=codelab_banner)
    ReniciarEmbed.set_footer(text='Code Lab Bot')
    await reniciar.response.send_message(embed=ReniciarEmbed)
#

add a check

#
if reniciar.guild.id == guild_id:
   #dostuff
#

thanks

paper sluice
#

Hunter tried hunting penguins, he failed, now he doesn't like penguins

slate swan
#

lol

paper sluice
#

I know everything

slate swan
#

special ai

modern fiber
#

so the one with most members gets on top

proud apex
#

How to make the bot insert the user's avatar in the picture?

sonic flax
#

how do i make it display the bot's avatar and name at the top

heady sluice
#

!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.
paper sluice
heady sluice
#

wait is there a bot.avatar?

paper sluice
heady sluice
#

!d discord.Client.user

unkempt canyonBOT
heady sluice
#

it would be bot.user.avatar.url

paper sluice
#

Ya

heady sluice
#

now wait

#

it's also icon_url=

sonic flax
sonic flax
heady sluice
#

it's not discord.embed

#

the class's name is discord.Embed, but you don't use that

#

you use an instance of it

#

which you most probably just named embed

sonic flax
#

yes

heady sluice
#

so what did you do

sonic flax
sonic flax
#

fixed now tho

heady sluice
#

then ig you use 1.7

copper panther
#

!e
i = 1
if i == 1:
print("o")

unkempt canyonBOT
#

@copper panther :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 |     print("o")
003 |     ^
004 | IndentationError: expected an indented block after 'if' statement on line 2
heady sluice
#

in your case it's avatar_url, not avatar.url

copper panther
#

!e
i = 1
if i == 1:
print("o")

unkempt canyonBOT
#

@copper panther :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     if i == 1:
003 | IndentationError: unexpected indent
heady sluice
copper panther
#

oh ok

#

ty

sonic flax
#

!e
print('test')

unkempt canyonBOT
#

@sonic flax :white_check_mark: Your eval job has completed with return code 0.

test
slate swan
#

how do i mass delete a server's channels i need it cuz i want to restart my server

sonic flax
# heady sluice <#267659945086812160>

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

heady sluice
#

please just show your code

#

did you do discord.Embed.set_author()?

slate swan
#

can i make like 3 buttons in a row then change the row if yes how can i

#

yea

sonic flax
heady sluice
slate swan
#

oh

sonic flax
# heady sluice please just show your code
bot.command()
@has_permissions(administrator=True)
async def help(ctx, command=None):
  if command is None:
    embed=discord.Embed
    embed.set_author(name=bot.user.name, icon_url=bot.user.avatar_url)
slate swan
#

oh ok

heady sluice
heady sluice
#

you didn't actually make an instance of it

slate swan
sonic flax
sonic flax
heady sluice
#

embed=discord.Embed(title="You have to have something in the embed itself")

slate swan
# sonic flax how do i fix it
@bot.command()
@has_permissions(administrator=True)
async def help(ctx, command=None):
  if command is None:
    embed=discord.Embed
    embed.set_author(name=bot.user.name, icon_url=bot.user.avatar_url)
paper sluice