#discord-bots

1 messages · Page 722 of 1

sage otter
#

Consider following in this example

listthing = [{"Case": 1}, {"Case": 2}]

for i in listthing:
    print(f"{list(i.keys())[0]}: {list(i.values())[0]}")
#

@valid galleon ^^

pliant gulch
#

Can't you just use items

#
for name, value in dict.items(): ...
sage otter
#

that works too AMshrug

final iron
#

Can someone link the docs for leaving a guild? (disnake)

sage otter
#

!d disnake.Guild.leave

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://docs.disnake.dev/en/latest/api.html#disnake.Guild.delete "disnake.Guild.delete").
final iron
#

Also one last thing, if I moving from dpy to disnake what changes will I have to make

#

Apart from refactoring discord to disnake

pliant gulch
#

literally nothing

#

It's a fork

final iron
#

Just double checking

soft lynx
#

@slash.slash(name="join",
             description="Join a nation of your choice.",
             guild_ids=[877730319434919946], options=[
               create_option(
                 name="country",
                 description="Choose your country.",
                 required=True,
                 option_type=8)])


async def join(ctx: SlashContext, country: discord.Role):
#

Right now, because I’m using option 8, my bot will allow any role as an argument, how can I restrict that to only certain roles?

maiden fable
#

Cz they use pterodactyl panel, and the owner can literally see everything in the people's servers, even the code (unrelated). I didn't ask much, but could be the owner leaked them or someone from the staff team did 🤷‍♂️

soft lynx
#

also

#
async def join(ctx, country: str=None): 
    member = ctx.author
    country1 = discord.utils.get(ctx.guild.roles, name = country)
    await member.add_roles(country1)

im getting the following error - howcome?

sage otter
#

country1 is None

#

so your utils.get() lookup failed.

soft lynx
#

yeah lol

#

fixed ty

sage otter
#

What the fuck

#

elif exists btw

#

Literally just check for the one and return if not.

crude crater
#

No it won't

soft lynx
crude crater
#

No it doesn't

soft lynx
crude crater
#

No

#

Yes, I am

#

Are you one of those as well? Just out of curiosity

sage otter
soft lynx
#

how do i make it unfail

sage otter
#

Well actually no...

#

If it failed to convert it would raise commands.BadArgument

soft lynx
#

also, where can i get slash cmd help?

sage otter
#

command arguments are typed as strings only if they arent type hinted in the function signature

soft lynx
#

For slash commands, @sage otter do you know if for option 8, you can specify certain roles as options

sage otter
#

I honestly have no idea or knowledge about slash commands

sage otter
soft lynx
#

Yeah, I’m using replit

slate swan
#

how to ask follow-up questions in a discord.py command
?

#

pls help

heavy folio
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
heavy folio
#

@slate swan

slate swan
#

if you mean something like getting answers from.user , use wait_for with message as the event

#

you can use a check to make sure the message is from the command's author

#

actually i am creating a giveaway cmd so there i want that when i ll trigger that cmd the bot will ask questions such as which channel it ll be hosted, what is the time limit, how many winners and accordinf to the answer it ll execute the rest part of the code

#

Yeah so you can use it

#

ok

#

can u give an example?

#
@client.event
async def on_message(message):
    if message.content.startswith('$greet'):
        channel = message.channel
        await channel.send('Say hello!')

        def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await client.wait_for('message', check=check)
        await channel.send(f'Hello {msg.author}!')
#

an example from the docs

#

ok tysm

livid hinge
#

how do you keep track of the context between the original message and follow-ups ? you just use wait_for directly inside the original command function?

valid galleon
#

so im using client.get_all_members() to get the number of people using the bot, but it returns a list of people, but without commas, so i cannot use len() to get the number of people. how can i fix this?

slate swan
unkempt canyonBOT
slate swan
#

len(client.users) ez

vast gale
#

don't do this.

Use the guarding clause concept.

#

additionally, since you're checking if any of them are true, we can use ors to make it more readable

#

so I'll show both

#

brb

unkempt canyonBOT
#

@fierce pelican Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!

boreal ravine
#

ok

vast gale
#
if messages[0] >= 100:
    if Guest in user.roles:
        return
    if Member in user.roles:
        return
    if Moderator in user.roles:
        return
    if Administrator in user.roles:
        return
    if Organizer in user.roles:
        return
    
    await user.add_roles(Guest)

this is the guard clause concept. Each if does not request the last if to exist.

https://maximegel.medium.com/what-are-guard-clauses-and-how-to-use-them-350c8f1b6fd2
(yea its not in python but this is a programming concept which is applicable to all languages)

Medium

A way to protect your methods against invalid inputs and outputs.

#

however, since the result is the same no matter what fails here, we can use some or logic

#

although...

#

because we're checking for user.roles we can make it even cooler

#

I'll show 2 more ways

boreal ravine
#

how do i get the commands of a command group

#

no

#

a command group

vast gale
#

@hidden hazel
this is way two ```py
if messages[0] >= 100:
if (
Guest in user.roles
or Member in user.roles
or Moderator in user.roles
or Administrator in user.roles
or Organizer in user.roles
):
return

await user.add_roles(Guest)

shadow wraith
#

i was wondering how people get the full tracebacks with an on_command_error event, it only shows 1-2 actual lines of the error, not a traceback :[

boreal ravine
#

!d discord.ext.commands.Bot.group this

unkempt canyonBOT
#

@group(*args, **kwargs)```
A shortcut decorator that invokes [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.group "discord.ext.commands.group") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
unkempt canyonBOT
#

Source code: Lib/traceback.py

This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful when you want to print stack traces under program control, such as in a “wrapper” around the interpreter.

The module uses traceback objects — this is the object type that is stored in the sys.last_traceback variable and returned as the third item from sys.exc_info().

The module defines the following functions:

shadow wraith
#

i've heard about this, but i've never really used it

#

which means, idk how to use it ¯_(ツ)_/¯

vast gale
#

IIRC its traceback.format_tb

shadow wraith
#

!d traceback.format_tb

unkempt canyonBOT
#

traceback.format_tb(tb, limit=None)```
A shorthand for `format_list(extract_tb(tb, limit))`.
boreal ravine
shadow wraith
#

hey what does limit do

vast gale
#

@hidden hazel way three ```py
if messages[0] >= 100:
for role in user.roles:
if role in {Guest, Member, Moderator, Administrator, Organizer}:
return
else:
# this runs if the loop went all the way through without breaking early
await user.add_roles(Guest)

boreal ravine
shadow wraith
# boreal ravine click the link

new error :|

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/client.py", line 505, in _run_event
    await coro(*args, **kwargs)
  File "/Users/sadancooler/Documents/Code/Python/bots/infinity/lounge.py", line 105, in on_command_error
    realError = traceback.format_tb(error)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/traceback.py", line 57, in format_tb
    return extract_tb(tb, limit=limit).format()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/traceback.py", line 72, in extract_tb
    return StackSummary.extract(walk_tb(tb), limit=limit)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/traceback.py", line 364, in extract
    for f, lineno in frame_gen:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/traceback.py", line 329, in walk_tb
    yield tb.tb_frame, tb.tb_lineno
AttributeError: 'CommandNotFound' object has no attribute 'tb_frame'
vast gale
#

@shadow wraith, ah. I'm using traceback.print_exc() in my error handler

#

no args

#

whole method is

#
    async def on_error(self, event_method: Any, *args, **kwargs) -> None:
        """Log all errors without other listeners."""
        print(f"Ignoring exception in {event_method}", file=sys.stderr)
        traceback.print_exc()
#

!d discord.ext.commands.Group.commands @boreal ravine

unkempt canyonBOT
#

property commands: Set[discord.ext.commands.core.Command[discord.ext.commands.core.CogT, Any, Any]]```
A unique set of commands without aliases that are registered.
boreal ravine
#

thanks

vast gale
#

its on context objects as ctx.command.commands

slate swan
#

lol Vscode is better then replit ig?

boreal ravine
shadow wraith
slate swan
shadow wraith
#

becuase replit uses a fucking shared ip therefore you can be blocked by discord api

shadow wraith
slate swan
shadow wraith
#

get a debugger/extension which debugs python or something

#

anyways, this discussion should go in another channel so talking about this more is what i won't do.

#

is that in an on_message event?

bitter kite
#

hey, when or how is bot.owner_id set? its always None for me

slate swan
#

though the api should already do it for u

bitter kite
#

that's what I'm wondering about. Even a call to application_info does not set it 🤔

sick birch
#

This could definitely use some rewriting haha

maiden fable
#

Using Python 3.9 or 3.10?

#

Open a command prompt and do python -V

#

Oh then use match case

#

!d match

unkempt canyonBOT
#

8.6. The match statement

New in version 3.10.

The match statement is used for pattern matching. Syntax:


match_stmt   ::=  'match' subject_expr ":" NEWLINE INDENT case_block+ DEDENT
subject_expr ::=  star_named_expression "," star_named_expressions?
                  | named_expression
case_block   ::=  'case' patterns [guard] ":" block
```...
maiden fable
#

See this for more information. A better thing for your usecase (:

#
>>> flag = False
>>> match (100, 200):
...    case (100, 300):  # Mismatch: 200 != 300
...        print('Case 1')
...    case (100, 200) if flag:  # Successful match, but guard fails
...        print('Case 2')
...    case (100, y):  # Matches and binds y to 200
...        print(f'Case 3, y: {y}')
...    case _:  # Pattern not attempted
...        print('Case 4, I match anything!')
...
Case 3, y: 200
#

An example

#

Wym

#

???

#

!d discord.Member.mention this?

unkempt canyonBOT
maiden fable
#

Just typehint to discord.Member

#

user: discord.Member

#

This will make user a discord.Member object automatically

sick birch
#
async def commandName(..., arg: discord.Member, ...):
  arg = ctx.author or arg

Will either be the given mention or the person who sent the command. Of course it'll be the object

#

It can be a mention, ID, or even a name

#

$profile Robin
$profile @sick birch
$profile 432643355634171905

#

All of those will get you the discord.Member object for a certain user

#

And it's really nice since it's all done behind the hood

boreal ravine
sick birch
#

wdym

#

I meant to give it =None

#

Mostly just psuedocode though

maiden fable
#

@sick birch that won't take into account, if the person gives it a member

#

Since u r telling Python to set it to either author or the other user

#

Meaning... it will become the other user only if ctx.author returns None which is never

sick birch
#

Have the default as it I mean

#

That's my favourite way to do it when i want it to default to the command author

dim otter
#

How do you make a mute and unmute command using dpy ?

slate swan
#

I want to make this in my code

#

The -help or /help are in a code block

sick birch
slate swan
#

I can't write this in my code

slate swan
#

```\n-help or /help \n```

pseudo lake
#

it only works inside your python string

heavy folio
#

@maiden fable remember i was asking bout the ban command, if i use commands.Greedy it'll appear as [days=1]..., how do i prevent it from happening (so it'll only show [days=1]

astral quiver
#

Does anyone have experience with using the Rich library with Discord.py?

slate swan
#

What's that?

#
hm = SelectOption(label='h', value='wa')
  menu = SelectMenu(placeholder='hm', min_values=1, max_values=1, options=hm, disabled=False, row=None) 
  await ctx.respond('h', menu)```
error:
hm = SelectOption(label='h', value='wa')
  menu = SelectMenu(placeholder='hm', min_values=1, max_values=1, options=hm, disabled=False, row=None) 
  await ctx.respond('h', menu)
#

help please
i am using py-cord to make a help menu

#

view=menu

astral quiver
slate swan
#

No colorful texts will be sent on discord , unless u use markdown

#
+ As in diffs
``` ```fix
or fixs

Etc...

astral quiver
#

Gotcha, I'm trying to get the table output this to pass as an object and print in a channel. I dont care about the coloring.

slate swan
#

I see , well you would have to see how wide the text appears since every device / window has different message widths

sage otter
#

I honestly forgot rich existed

#

Just a better version of colorama

astral quiver
#

So far passing the table, all I can get the discord bot to print is the object mem reference. This is where I'm stuck, trying to capture the std out and print but that didnt change the outcome.

slate swan
# slate swan view=menu

still same error
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: init() got an unexpected keyword argument 'placeholder'

silver pulsar
#

Hi guys a beginner(I only know python)here so I wanted to o create a discord bot. How much Python knowledge do i need for it and is there a guide. I've heard theres one library called d.py which was disbanded so i am clueless using which library should I start. Pls guide me or give tutorials if possible.

silver pulsar
#

All in one

#

But I would prefer chatbot

#

As a first project

slate swan
#

memes,image,etc

silver pulsar
#

None of these

#

Chatbot which uses ai to reply/respond

slate swan
#

ohhh

silver pulsar
#

However I can go with the easier option like games or economy for gaining some experience

slate swan
#

do you want slash commands in it?

silver pulsar
#

Both

slate swan
#

oh then learn py-cord

cedar stream
#

And learn from docs

slate swan
#

dp.y disbandned due to discord was making every bot into slash

silver pulsar
#

Ok

slate swan
#

and py-cord is a library which is almost same as d.py but with slash commands

silver pulsar
#

So I don't HV any options?

#

Except slash commands

slate swan
#

pycord's slash implementations are too bad

slate swan
cedar stream
#

Yes, if ur bot isnt verified you can still use classic commands

slate swan
#

Not here to bitch about the Library. But disnake and nextcord are doing better

silver pulsar
#

Ok

slate swan
#

i am rn learning about so I can switch

cedar stream
slate swan
silver pulsar
#

Disnake or nextcord?

cedar stream
#

I use disnake

slate swan
#

Same

silver pulsar
#

Ok

#

How much Python should Ik?

#

Like idk oops

cedar stream
#

Are u familiar with asynchronous programming

silver pulsar
#

Nope never heard of

cedar stream
slate swan
#

you need to learn about async def as its key

cedar stream
#

Synchronous vs asynchronous vs multithreaded vs multiprocessing

#

Learn those concepts

silver pulsar
#

Ok actually there's a book called python Crash Course I haven't done classes and objects is that ok?

slate swan
#

another thing , don't watch yt tutorials
They are all outdated

silver pulsar
cedar stream
slate swan
silver pulsar
cedar stream
#

And how instances work

#

Etc.

slate swan
cedar stream
#

And It’ s hsndy

silver pulsar
cedar stream
#

Handy

cedar stream
#

Basically class is an object that creates new objects, those objects are called instances

silver pulsar
#

In the first place what is object?

cedar stream
slate swan
#

This is a Test to know if you are ready to make a bot using discord.py: ```prolog
A: in your words, what is the purpose of a For Loop?
B: what is Blocking? and why do you have to use Async for a discord bot?
C: how do you know if a line of code is inside a Block or Scope (like a Function, Class, For Loop, etc...);
and how do you make that piece of code be outside of the Block or Scope?
D: if you have to make an HTTP Request with your bot, what Libriary would you use?
E: in your words, what is Object Oriented Programming (OOP) and how does it get used in python?
F: what are Fstrings (3.6+) and how can you use them to just get 2 Decimal Places of a Long Float?
G: what is Try-Except, and how can you use it to except Specific Errors?
H: how would you Force to get an Error in the case of not getting one (or atleast know where the problematic line is)?
I: what are the use case of Function Decorators? and what are they really in the background?
J: how would you store Multiple Pieces of Data that are related to more data? (Example: Name1 = James, Name2 = Steve, etc...)

cedar stream
#

For example “hello” is an object created by str object

silver pulsar
#

Ok

cedar stream
silver pulsar
acoustic marsh
#

What is a Discord chatbot and how do I find it؟

astral quiver
slate swan
silver pulsar
silver pulsar
cedar stream
silver pulsar
slate swan
#

All of them are made in python

astral quiver
cedar stream
silver pulsar
#

Lol how? Web scraping maybe?

cedar stream
slate swan
#

Requests

silver pulsar
#

O_O

cedar stream
#

Discord literally exposed their api

silver pulsar
silver pulsar
cedar stream
#

You dont even need a wrapper, you can make direct requests

graceful mulch
#

connection timeout
https://stats.uptimerobot.com/GA8lYTBq86
Down for 7 h, 4 min
The reason was Connection Timeout.

Details:The response took so long that the connection timed out.

January 1, 2022, 00:10 GMT +00:00

#

how to solve this

cedar stream
slate swan
#

This is not replit/uptimerobot support channel.

graceful mulch
#

hey but it is related to discord bot

upbeat otter
graceful mulch
cedar stream
slate swan
#

you linked your repl and the site badly

upbeat otter
slate swan
#

Nothing related to discord

silver pulsar
slate swan
#

Unless. Your bot was ratelimited

upbeat otter
cedar stream
#

Or tcp

graceful mulch
#

okkkk

silver pulsar
graceful mulch
#

going to replit server

cedar stream
upbeat otter
silver pulsar
graceful mulch
upbeat otter
silver pulsar
cedar stream
graceful mulch
#

ik

graceful mulch
upbeat otter
silver pulsar
cedar stream
slate swan
#

how do you send messages to threads in discordpy?

maiden fable
#

Time to host a spam bot on repl

cedar stream
maiden fable
silver pulsar
slate swan
#

really?

cedar stream
cedar stream
slate swan
cedar stream
maiden fable
cedar stream
maiden fable
#

No

slate swan
#

im just gonna test

cedar stream
maiden fable
#

Yea iirc

slate swan
#

!d discord.Thread <=

unkempt canyonBOT
#

class discord.Thread```
Represents a Discord thread.

x == y Checks if two threads are equal.

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

hash(x) Returns the thread’s hash.

str(x) Returns the thread’s name.

New in version 2.0.
heavy folio
slate swan
#

ah

maiden fable
maiden fable
maiden fable
#

🤣

slate swan
#

¯\_(ツ)_/¯

silver pulsar
slate swan
#

sorry i just woke up after a new years eve party lol

silver pulsar
#

Then why code rn

#

That too discord bot lol

maiden fable
#

Breh

heavy folio
# maiden fable Show code
async def ban(self, ctx, member: discord.Member, days: commands.Greedy[int]=1, *, reason: str="No reason provided"):
maiden fable
#

It's his/her wish 🤷‍♂️

slate swan
#

her :)

#

there is an event called Discord Bot Hackathon
Participants will make a discord bot on the given topic and would be given points on the basis of creativity, the team/individual with the most points wins sweating would anyone wanna work w me ?

silver pulsar
heavy folio
maiden fable
maiden fable
slate swan
silver pulsar
maiden fable
slate swan
silver pulsar
#

@slate swan what?

heavy folio
slate swan
maiden fable
#

Idk how to fix it ngl

maiden fable
silver pulsar
maiden fable
slate swan
slate swan
heavy folio
#

im using greedy because days is optional, and it must be an int

maiden fable
#

!d discord.ext.commands.Greedy @cedar stream

unkempt canyonBOT
#

class discord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.

When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.

For example, in the following code:

```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
    await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
```  An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
heavy folio
#

there's another reason argument behind days so if days is not passed in, some error will be raised

cedar stream
maiden fable
#

Yea

slate swan
#

😳 don't Reveal me

silver pulsar
maiden fable
#

🤨

silver pulsar
#

😂 😂 😂

maiden fable
slate swan
#

Indeed

cedar stream
maiden fable
silver pulsar
#

😂

maiden fable
#

.....?

#

self, inter

slate swan
cedar stream
#

!indent

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

me with 125 mbs.

maiden fable
slate swan
#

python: can't open file 'bot.pypython': [Errno 2] No such file or directory

cedar stream
maiden fable
maiden fable
slate swan
#

Enslo , it appears like this only for u

cedar stream
#

Ohh

maiden fable
slate swan
#

but idk where is the error i mean

maiden fable
cedar stream
#

🤷🏼‍♂️

slate swan
#

They missed a. self , as hunter told

slate swan
maiden fable
#

I told the problem but okay

cedar stream
slate swan
maiden fable
#

He most probably did bot.pypython instead of bot.py

cedar stream
slate swan
#

but idk where fisrtly

#

It's failing in the ```bash
$python <file>

maiden fable
#

Startup iirc

slate swan
cedar stream
slate swan
#

Go there , look-up for a bot file field

#

i using host for hosting and making in it bot too

#

Man

cedar stream
#

slate swan
heavy folio
#

is there a built in method to check if a user is not banned or must i iterate through guild.bans()

slate swan
#

You bot file's name is bot.py and you mentioned something weird there

maiden fable
heavy folio
heavy folio
#

oh ok

cedar stream
maiden fable
#

Took a new year resolution to use light mode most of the time BTW

cedar stream
#

I dont think It’ s wise to store data in a json, especially in ur use case

maiden fable
heavy folio
#

if user is not in ban list then

cedar stream
#

!unban

slate swan
#
class Ping(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self._last_member = None

    @commands.slash_command(description="Shows bot ping")
    async def ping(inter):
        await inter.response.send_message(f'Pong! **{round(self.bot.latency * 1000)}**ms')``` you should pass self in ping arguments to be able to access the class attributes  ![shrug](https://cdn.discordapp.com/emojis/916709286590152816.webp?size=128 "shrug")
velvet tinsel
#

Using slash commands

#

💀

maiden fable
# heavy folio unban command

Then just do await ctx.guild.unban(discord.Object(id)) and if it raises an error, that means either u dont have the perms or the person isn't banned

heavy folio
#

hm

cedar stream
velvet tinsel
maiden fable
# heavy folio hm

But would be better to iterate through guild.members first since many people like me like to use the unban cmd to try and unban people still in the server

velvet tinsel
#

Cool

cedar stream
velvet tinsel
#

what’s so good about making a class for bot

#

yert explain

maiden fable
slate swan
heavy folio
#

how do i check if the user's id is in guild.bans() or not

#

dont really get it

velvet tinsel
#

Thank

cedar stream
#

!d discord.Guild.bans

unkempt canyonBOT
#

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

Retrieves all the users that are banned from the guild as a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

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

Can someone explain to me what Guild.chunk does?

slate swan
#

oh sorry shrug

maiden fable
heavy folio
#

oh that

boreal ravine
slate swan
unkempt canyonBOT
#

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

Requests all members that belong to this guild. In order to use this, [`Intents.members()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") must be enabled.

This is a websocket operation and can be slow.

New in version 1.5.
cedar stream
#

Banned users = [ban_entry.user for ban_entry in bans()]

heavy folio
slate swan
#

yeah all the members in te guild

maiden fable
boreal ravine
slate swan
#

But doesn't the bot already does the same for u itself

cedar stream
boreal ravine
slate swan
cedar stream
slate swan
#

It does

#

if you have member intents

boreal ravine
heady sluice
#

im sure this question has been asked a bunch already but - what's the best alternative library to discord.py rn?

slate swan
#

Oh I see

cedar stream
#

I remember using guild.get_members and I didnt get every member

maiden fable
slate swan
maiden fable
#

My suggestion: Don't use any fork and make your own private wrapper

heady sluice
slate swan
#

so basically the method is used inside the on_ready too

heady sluice
#

is there a reason in particular that you prefer disnake over the others?

maiden fable
#

Before on_ready

slate swan
slate swan
maiden fable
#

It's triggered when the cache is completed and the bot is connected

cedar stream
maiden fable
#

!d discord.on_ready

unkempt canyonBOT
#

discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.

Warning

This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
maiden fable
maiden fable
slate swan
heady sluice
#

gotcha, thanks!

slate swan
maiden fable
# maiden fable Nope.

I have made a private wrapper for revolt (discord alike) and it took me hardly a day (a day cz I was new to all the websockets and stuff and didn't know anything about those)

slate swan
#

I mixed it with Equinox ig

maiden fable
#

Lmao facts

slate swan
#

Here

cedar stream
maiden fable
#

I did cache, but there ain't any ratelimits for now, since the API and Client are still in beta or smth

slate swan
#

I like revolt , but it's kinda slow atm

maiden fable
#

Facts

cedar stream
#

Ill take a look at dpy source code

maiden fable
#

So yea, for now, its (the wrapper) sort of completed... Tho the API is HEAVILY incomplete, like the member join and stuff events don't return the whole User object and just the User ID, soooo

slate swan
#

The ids are kinda weird lmao

#

Like they ain't integers

heady vector
#

can i ask someting?

#

how to create python discord command

#

all script that i use wasn't work

slate swan
#

can you show your script , and the issue u faced

maiden fable
slate swan
#

{ctx.author.mention} doesnt work anymore can someone tell me why

#

it does , show code

#

k

#
import os
from discord.ext import commands

bot = commands.Bot(command_prefix='!') #bot's prefix

@bot.event 
async def on_ready():
    print('We have logged in as {0.user}'.format(bot)) #tells us that our bot is online

@bot.event #responding to messages
async def on_message(message):
    message.content = (message.content.lower()) #makes all messages lowercase, from the bot's perspective
    if message.author == bot.user: #to not respond to bots
        return
    if "quit" in message.content:
        await message.channel.send("{ctx.author.mention} hello mf") #response



bot.run






#

@slate swan

#

wait

#

i think i have to import right?

pseudo notch
slate swan
#

o

pseudo notch
#

i would like to code a bot

slate swan
#

what type

pseudo notch
#

which bot type?

slate swan
#

ya

pseudo notch
#

hmm, should have some moderation commands, utility

slate swan
#

ok

pseudo notch
#

oh sure

#

can i have the link?

slate swan
#

ok

pseudo notch
#

thank you

slate swan
#

Oh so u did it

#

obviosuly im not gonna show token

slate swan
near sail
#

It's not defined anywhere

slate swan
#

im stupid LOL

#

It would be message.author.mention

#

i forgot to define im dumb asf

pseudo lake
#

message.author.mention

slate swan
#

Indeed

pseudo lake
#

also just do

    if message.author.bot:
        return None #to not respond to bots```
#

it returns a bool if message.author is a bot

#

where True = a bot, and false isnt

boreal ravine
pseudo notch
pseudo lake
boreal ravine
#

🤔

slate swan
#

TCR , the coding realm?

boreal ravine
slate swan
#

Right

pseudo lake
#

oh my brother loves to talk there ig

slate swan
pseudo lake
#

thats cool ! lemon_happy

boreal ravine
pseudo notch
#

ty

slate swan
#

from what I've seen

#

is vco's tutorial updated with 2.x?

pseudo lake
pseudo notch
#

i am new to coding

pseudo lake
#

then consider learning python first!

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
pseudo lake
#

coding a discord bot is not a beginner friendly project

pseudo notch
#

oh

slate swan
#

More like a trap you would like to fall into

slate swan
boreal ravine
#

Never ask in the discord.py server about dpy questions if your still a beginner :^)

slate swan
#

Ye

slate swan
pseudo lake
#

a key to helping others is maintaining a kind behaviour and patience

#

ops a typo

slate swan
#

What’s user mention again bc I cba defining the stuff

#

Straight to the function lol

pseudo lake
#

message.author.mention , where message.author is the author object and .mention is the property

slate swan
#

Kk

slate swan
#

🗿

#

i've seen people who dont know how to create a .py file

slate swan
#

True

#

I try to help them but sometimes the error is so easy I just feel the need to do resources like syntax error or variable

pseudo lake
slate swan
#

Ye

cedar stream
slate swan
#

if you find the docs hard, maybe learn how to read them before trying to make a bot

#
async def kick(ctx...
   discord.Member.kick
``` :troll:
#

💀

cedar stream
slate swan
cedar stream
slate swan
#
async def import(member, ctx
  ctx send "hello"
)

import

will this work

slate swan
slate swan
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

vale wing
#

How to make slash command accept list of arguments (eg. list of roles) in disnake?

@bot.slash_command()
async def addroles(inter, user: disnake.Member, *roles: disnake.Role)```
doesn't work
vale wing
#

How

slate swan
#

what library is that?

cedar stream
slate swan
#

disnake

vale wing
#

Disnake yes

vale wing
cedar stream
vale wing
#

I know that

cedar stream
#

Then do that

slate swan
#
async def give(ctx, member, amount):
      with open('users.json', 'r') as f:
        users =  json.load(f)
        await add_points(users, member, amount) 
      with open('users.json', 'w') as f:                      
        json.dump('users', 'f') 
      await ctx.send(f'given {member} {amount} programming points')``` this command dosent working  i need to re run my bot to show the error cuz my friend made a lot of spam
slate swan
#

i dont quite remember the new way to do that , but in the old method ( dont know if it still works ) py @slash_command( name = 'prefix' , description='Change prefix for the server', options = [ Option(name='newprefix' , description='The new prefix for the server',type=OptionType.string , required=True) ] ) is how you could add options

vale wing
slate swan
#

d! usermetion

slate swan
unkempt canyonBOT
#

property mention: str```
Returns a string that allows you to mention the given user.
vale wing
#

Ight

#

There must be a way without custom converters that's why I am asking

cedar stream
vale wing
#

Because I need discord to hint roles

slate swan
#
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot.py", line 270, in give
    users =  json.load(f)
  File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
boreal ravine
#

add {} to your JSON file

slate swan
#

('users.json', 'r') change it to {'users.json', 'r'}

cedar stream
slate swan
slate swan
upbeat otter
pseudo lake
#

afterall dont use json as a database 🤷‍♂️

upbeat otter
slate swan
upbeat otter
upbeat otter
slate swan
#

LOL

#

i cba define

pseudo lake
pseudo lake
slate swan
#

o ye XD

slate swan
pseudo lake
#

thats if your willing to use json to store temp data. which isnt suggested

cedar stream
upbeat otter
cedar stream
pseudo lake
slate swan
cedar stream
pseudo lake
# cedar stream Yes but It’ s temporary data, isnt it?

well in most cases you want to add stuff to the json file while the program is running. like user leveling up and etc, if you did that in ram you'd need some sort of dict that stores stuff into ram. therefore if anything happens that causes the bot to restart the dict would go back to whats it original value was. which is most likely an empty dict

cedar stream
#

Best bet is to use a db

slate swan
#

🏃‍♂️ mongodb /pgsql would be great choice in that case

cedar stream
#

Mongo is probably cheaper

slate swan
#

my host can save data , but its a small bot so i simply use sqlite3

#

ill move to pgsql later

eager trail
#

How do i get user from reactions?

cedar stream
#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

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

hash(x) Returns the message’s hash.
slate swan
eager trail
#

num 2

pseudo lake
slate swan
#

!d discord.on_reaction_add , the 2nd arg

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
cedar stream
#

!d discord.Reaction.users

unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Examples

Usage

```py
# I do not actually recommend doing this.
async for user in reaction.users():
    await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
pseudo lake
cedar stream
cedar stream
slate swan
#

I might sound stupid but how do you define = f”{ctx.author.mention}

cedar stream
slate swan
#

@cedar stream see im doing test ping command but i want to ping user doing command

eager trail
slate swan
#

ctx.author.mention doesnt seem to work

cedar stream
#

await ctx.send(ctx.author.mention)

#

U have to send it

cedar stream
#

Click the link

eager trail
#

um okie

slate swan
#

k

#

await message.channel.send(" f'{ctx.author.mention}, pong")

cedar stream
#

With decorators

slate swan
#

kk

#
        await message.channel.send(" f'{ctx.author.mention},pong")```
pseudo notch
#

how to delete this bot-main

pseudo lake
#

well. that isnt a command

pseudo lake
heavy folio
pseudo notch
#

theres no option to delete

heavy folio
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
pseudo lake
heavy folio
#

!d discord.ext.commands.Command and this

unkempt canyonBOT
#

class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.

These are not created manually, instead they are created via the decorator or functional interface.
cedar stream
pseudo lake
slate swan
#

ok

pseudo notch
#

how to install py

slate swan
slate swan
pseudo lake
cedar stream
pseudo lake
#

just have message.author.mention 🤷‍♂️

slate swan
cedar stream
pseudo notch
#

windows

cedar stream
cedar stream
slate swan
#

!d str.format

pseudo notch
#

oh

cedar stream
pseudo lake
#

dont suggest this.

#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

pseudo notch
#

i have created discord bot and invited to my server

slate swan
#

f strs are more preferable

#

yes

pseudo notch
#

should i use vsc for coding?

cedar stream
slate swan
pseudo notch
#

ok

slate swan
pseudo lake
pseudo notch
#

how to delete this bot-main

slate swan
slate swan
slate swan
cedar stream
pseudo lake
slate swan
pseudo lake
slate swan
#

or if you are on linux , you can use ctrl +q to delete the file ( dont)

pseudo lake
#

the function or the event you have that code on

pseudo lake
cedar stream
#

Lmfao

cedar stream
#

slate swan
#

Ok

#

Lol

pseudo lake
#

uh not exactly what i'm looking for

pseudo notch
#

should i create a folder for my bot?

cedar stream
pseudo lake
#

a coroutine is a function that has async before it like wise

async def coroutine(arguements):
  """
  this right here is a coroutine and needs to be awaited
  """
  ...```
slate swan
#
import os
from discord.ext import commands

bot = commands.Bot(command_prefix='!') #bot's prefix

@bot.event 
async def on_ready():
    print('We have logged in as {0.user}'.format(bot)) #tells us that our bot is online

@bot.event #responding to messages
async def on_message(message):
    message.content = (message.content.lower()) #makes all messages lowercase, from the bot's perspective
    if message.author == bot.user: #to not respond to bots
        return
    if "ping" in message.content:
        await message.channel.send(" <@{message.author.id}> pong")```
slate swan
slate swan
unkempt canyonBOT
#

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

i ate an apple
slate swan
pseudo notch
pseudo notch
slate swan
pseudo lake
#
import discord
import os
from discord.ext import commands

bot = commands.Bot(command_prefix='!') #bot's prefix

@bot.event 
async def on_ready():
    print('We have logged in as {0.user}'.format(bot)) #tells us that our bot is online

@bot.event #responding to messages
async def on_message(message):
    message.content = message.content.lower() #not sure why you needed to make it a tuple
    if message.author == bot.user: #to not respond to bots
        return
    if "ping" in message.content:
        await message.channel.send(f"{message.author.mention} pong")```
#

then why dont you use them

slate swan
#

o

slate swan
slate swan
#

can relate

pseudo lake
#

also if you really wanted to be a bit fancy

slate swan
#

I don’t like fancy lol

cedar stream
#

LMFAOOO

slate swan
#

less fancy faster code smh

#

not true

slate swan
cedar stream
#

By fancy they probably meant cleaner

pseudo lake
cedar stream
#

Like higher level

pseudo lake
slate swan
#
number : int = 1 
string : str = "heh"
``` ```
number = 1
string = 'heh'``` the first one is fancier yet faster
cedar stream
#

Yes

slate swan
#

cause the interpreter wont need to identify the data type of those variables itself

slate swan
cedar stream
slate swan
#

Anyone on vs code how do you keep your project on 24:7

pseudo lake
#

import discord
import os
from discord.ext import commands

bot = commands.Bot(command_prefix='!') #bot's prefix

@bot.event 
async def on_ready():
    """
    A listner that waits for the bot to be online
    ---
    Arguments -> None
    """
    print('We have logged in as {0.user}'.format(bot))

@bot.event 
async def on_message(message):
    
    """
    A listner that listens for messages
    ---
    Arguments -> None
    """
    if "ping" in message.content.lower() and not message.author.bot:
        await message.channel.send(f"{message.author.mention} pong")
        # mentioning the user by using the class method message.author and the propterty .mention```
pseudo lake
pseudo notch
slate swan
cedar stream
pseudo lake
slate swan
#

Ya

#

I can do paid but preferably free

pseudo notch
pseudo lake
slate swan
#

Yea ok

pseudo notch
#

any error?

pseudo lake
pseudo notch
#

.

slate swan
#

Bruh

cedar stream
slate swan
slate swan
pseudo lake
pseudo notch
#

ok

cedar stream
pseudo lake
#

please learn some python before dealing with packages like discord.py

cedar stream
#

Not heroku or repl?

slate swan
#

@pseudo lake also I normally use repl but with vs do you need to use .env to private token

pseudo lake
slate swan
pseudo lake
cedar stream
#

For how much time

pseudo lake
pseudo lake
cedar stream
#

Do u need a credit card?

pseudo lake
#

but railway has some rules

pseudo lake
cedar stream
slate swan
pseudo lake
# cedar stream Dumb ones?

not really. your total stuff worked should cost less than 5 dollars a month which is a bit of a high limit for bots that arent in much servers

pseudo lake
slate swan
#

i dont mind

pseudo notch
#

i am not able to install discord.py pip install discord.py

cedar stream
#

I hosted a bot on gcp and it cost me less than 1€ per month

cedar stream
pseudo notch
#

whats that

cedar stream
#

U should learn python b4 making bots

slate swan
#

@pseudo lake when I click start host it says login no sign up

slate swan
#

Paste in there and tap enter

pseudo lake
pseudo notch
#

ok

#

what about cmd?

#

`pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • pip install discord.py
  •   + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException`
cedar stream
pseudo lake
cedar stream
slate swan
#

they do a little trolling

cedar stream
slate swan
#

?

slate swan
cedar stream
#

Trolling?

slate swan
#

and afk pages from where you earn points to host your bot

pseudo lake
eager trail
#

!d discord.Status

unkempt canyonBOT
#

class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") ‘s status.
pseudo lake
slate swan
slate swan
#

ic

#

@pseudo lake hwo to host vs code with it

pseudo lake
slate swan
#

i got bot token ttho

pseudo lake
#

use env

#

!pip env

unkempt canyonBOT
slate swan
#

ok

slate swan
#

they totally don't steal your data

pseudo lake
#

i'm using it myself for hosting

#

they dont ask for any data btw

#

beside an email

#

without a password btw 🤷‍♂️

#

they make the password for you

slate swan
#

and get the env using os module

#

!d os.getenv

unkempt canyonBOT
#

os.getenv(key, default=None)```
Return the value of the environment variable *key* if it exists, or *default* if it doesn’t. *key*, *default* and the result are str.

On Unix, keys and values are decoded with [`sys.getfilesystemencoding()`](https://docs.python.org/3/library/sys.html#sys.getfilesystemencoding "sys.getfilesystemencoding") and `'surrogateescape'` error handler. Use [`os.getenvb()`](https://docs.python.org/3/library/os.html#os.getenvb "os.getenvb") if you would like to use a different encoding.

[Availability](https://docs.python.org/3/library/intro.html#availability): most flavors of Unix, Windows.
slate swan
#

@slate swan can u make quick vid how to setup

slate swan
pseudo lake
#

read the docs alex lemon_happy if you need help with a certain point you can just tell us

slate swan
#

github ofcourse is better but if you want to like change something in the code , which u dont want to reflect on the repo..

pseudo lake
slate swan
#

so no idea

quick gust
#

i find it pretty useful

boreal ravine
#

Is there anything wrong about this? ```py
limit = 3

await ctx.channel.purge(limit=limit, check=lambda m: m.author==self.bot.user)

slate swan
slate swan
cerulean heart
#

how can I get a list of all nitro users in the server?

slate swan
#

you cant

slate swan
#

you can get number of boosters in the server

cerulean heart
slate swan
#

!d discord.Asset.is_animated

unkempt canyonBOT
#

is_animated()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): Returns whether the asset is animated.
slate swan
maiden fable
#

!d discord.Guild.premium_subscribers

unkempt canyonBOT
cerulean heart
maiden fable
#

This (;

#

@cerulean heart

slate swan
#

grab all nitro users to send a scam

maiden fable
cerulean heart
maiden fable
#

Misread the question

pseudo notch
#

which is the latest version of python

cerulean heart
slate swan
pseudo notch
#

ty

maiden fable
#

!d discord.Member.premium_since

unkempt canyonBOT
#

An aware datetime object that specifies the date and time in UTC when the member used their “Nitro boost” on the guild, if available. This could be None.

slate swan
#

3.11 is in beta

maiden fable
#

This (:

cerulean heart
maiden fable
#

U can loop through guild.members

slate swan
#

what version of dpy are u using?

#

is it possible to make a music bot without using youtube-dl , i cant seem to find any methods

#

lavalink

cedar stream
cerulean heart
cerulean heart
slate swan
mental kraken
pseudo lake
#

print(discord.__version__)

cerulean heart
pseudo notch
#
Requirement already satisfied: discord.py in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (1.7.3)
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from discord.py) (3.7.4.post0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (3.0.1)
Requirement already satisfied: attrs>=17.3.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (21.4.0)
Requirement already satisfied: typing-extensions>=3.6.5 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (4.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (1.7.2)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (5.2.0)
Requirement already satisfied: chardet<5.0,>=2.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py) (4.0.0)
Requirement already satisfied: idna>=2.0 in c:\users\sreekumar\appdata\local\programs\python\python310\lib\site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py) (3.3)
cold sonnet
#

yes?

pseudo notch
#

.

cold sonnet
#

.

cold sonnet
cerulean heart
#

Will do

cerulean heart
slate swan
#

bot.run(os.getenv[TOKEN]; sytax error why tho

#

you should actually upgrade or shift to a fork

cold sonnet
slate swan
#

or , environ['TOKEN'] , dont mix em

slate swan
#

free host

#

my answer remains same

#

u didnt close the brackets too

#

@slate swan whats unexpected eof

pseudo notch
#

whats the command to make bot online

quick gust
#

are you talking about bot.run()?

slate swan
pseudo notch
slate swan
knotty gazelle
#

The TOKEN in bot.run needs to be a string

slate swan
#

im using env repl

silk mauve
#

Does {ctx.guild.boosts_level} exist?

knotty gazelle
silk mauve
#

If not, what is it?

slate swan
#

close the bracket

#

at the end

glacial bridge
#

.

#

@slate swan

silk mauve
slate swan
unkempt canyonBOT
#

The premium tier for this guild. Corresponds to “Nitro Server” in the official UI. The number goes from 0 to 3 inclusive.

slate swan
slate swan
#

but u can avoid the ratelimit

#

kill 1 in the shell gives u a new ip adress

glacial bridge
#

There’s other options

knotty gazelle
#

@glacial bridge what do you use?

slate swan
#

normally i use vs code

glacial bridge
#

Though I had a Rpi laying around, so a cheap host might be better

#

If you really need a free one, I heard heroku is free (but no free host will be without its downsides)

knotty gazelle
#

I also have 2 raspberry pi's

glacial bridge
knotty gazelle
#

But do you keep them on 24/7?

glacial bridge
#

Just transfer necessary files to them, then use screen to run them 24/7

#

I can tell you more in DMs

knotty gazelle
#

pls

#

my dms are opn

silk mauve
#

Its free and there is always help available

pseudo lake
#

i indeed vouch for welp.

pseudo lake
slate swan
#

Free host?

pure plover
#

Can anyone tell how to make an afk command in discord.py

#

@slate swan @pseudo lake @silk mauve @knotty gazelle @glacial bridge

bitter depot
#

!mute 783910297785335808 6h You were told to stop spamming.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @pure plover until <t:1641064823:f> (5 hours and 59 minutes).

silk mauve
#

wtf

glacial bridge
untold token
#

Bruh lmfao

untold token
silk mauve
#

Very very simple