#discord-bots

1 messages · Page 1035 of 1

sick birch
#

And the error?

keen mural
#

.

slate swan
#

did u just added intents?

#

can u show more down?

keen mural
slate swan
#

replace x with ur intent

cloud dawn
#

I mean he did do what you told him

keen mural
#

wdym my intent

sick birch
#

This is why I usually use some obscene names, like
intents.PUT_YOUR_INTENTS_HERE

slate swan
#

;-;

cloud dawn
sick birch
#

Copy pasting in this channel is very prominent

slate swan
#

also remove that unused imports

cloud dawn
#

The default one only lacks presences and members so might as well do all of them.

keen mural
#

the bot is on but not responding to commands

sick birch
slate swan
sick birch
#

It's fine during development, but just keep that in mind

keen mural
slate swan
keen mural
cloud dawn
#

Looks fine to me

slate swan
#

can u show whole code screenshot

#

@keen mural

keen mural
slate swan
#

uh

#

can u show that yellow lines

keen mural
#

its the old component stuff

#

like selectoption

slate swan
#

@keen mural bot doesnt work with intents and work without it?

keen mural
#

ig so

#

whatever i downloaded did it

slate swan
#

which cmd are u using

keen mural
#

help

#

built in one

slate swan
#

any erro

keen mural
#

no just nothing

slate swan
keen mural
#

i did

slate swan
keen mural
#

no lemme try smth tho

#

works now

slate swan
#

??

keen mural
slate swan
keen mural
#

just deleted some bad code

slate swan
#

Nice

buoyant zodiac
#

How do i make a group alias?

slate swan
#

imagine a bot that simulates the nft market place. Get “nfts” that are on the discord bot for currency you earn through jobs

slate swan
slate swan
buoyant zodiac
#

@unkempt canyon can it be added to servers

slate swan
#
    @commands.command(name="invites")
    async def invites(self, ctx : commands.Context, * , user: disnake.Member=None):
     user = ctx.author if not user else user
     print(user.name)
     for i in await ctx.guild.invites():
           print(i.inviter,i)
      ``` it prints user.name but nothing with for loop
#

it was working before smh

lucid vine
#

hm can someone maybe help me in #help-chestnut idk if its that relevant to post here maybe it is idk

boreal ravine
slate swan
#

This is not working

@bot.command()
async def ping(ctx):
await ctx.send('Pong!')

#

Help

paper sluice
slate swan
slate swan
#

alr

#

fine

#

@bot.command() async def ping(ctx): await ctx.send('Pong!')

#

woowww that was my first command :>

slate swan
supple thorn
slate swan
#

the for loop doesnt work

supple thorn
slate swan
slate swan
boreal ravine
slate swan
#

Ok

slate swan
boreal ravine
# slate swan ???

What do you by "not working"? Is there an error? Is the bot not responding?

slate swan
#

bruh

slate swan
#

I mean it's no responding

paper sluice
slate swan
slate swan
#

COPED CODE see that .format

boreal ravine
paper sluice
# slate swan anyone

rename the function from something other than invites because u did name='invites' although im not sure

slate swan
#

also thats not the issue

lucid vine
#

its a discord question i just wasnt sure if i was supposed to ask here or in a help channel cuz i wasnt sure if its more a discord or python relevant question, plus ur not a mod, not gonna get told off by a non mod

slate swan
#
@commands.command()
    async def invites(ctx, user: disnake.Member=None):
     user = ctx.author if not user else user
     if user != None:
         print(user.name)
         for i in await ctx.guild.invites():
                   print(i.inviter,i)
#

my all commands are like this
ik i can remove name=""

paper sluice
#

!d discord.Guild.invites

unkempt canyonBOT
#

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

Returns a list of all active instant invites from the guild.

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

..

keen mural
#

let me know if you need help

slate swan
slate swan
#

anyone help me!!

#

show a screenshot of the console

keen mural
slate swan
#

Yes

slate swan
slate swan
slate swan
slate swan
#

brooo

boreal ravine
slate swan
#

tf

keen mural
#

replit mobile??

lucid vine
keen mural
#

is that a thing

slate swan
lucid vine
#

but he is using both

slate swan
#

there is no way to be something else

boreal ravine
slate swan
lucid vine
#

he has it defined as bot but is using client

slate swan
#

ig he copied 2 code from 2 different places

#

But its working

keen mural
keen mural
slate swan
# slate swan <@456226577798135808> help me
@commands.command()
    async def invites(ctx, user: disnake.Member=None):
     user = ctx.author if not user else user
     if user != None:
         print(user.name)
         for i in await ctx.guild.invites():
                   print(i.inviter,i)
lucid vine
#

who spat in ur tea

#

kid got a broom up his arse

daring olive
#

hey, calm down

slate swan
#

didnt u read the msg

lucid vine
#

can u just leave me alone i dont need moderation from you i just said

#

when did i ask

daring olive
#

!silence

unkempt canyonBOT
#

✅ silenced current channel for 10 minute(s).

daring olive
#

everyone back up like 3 or 4 steps, and take a breath

#

fwiw, i don't think it's the worst thing to come and say hey i have a channel open in #help-name and to mention briefly what it's about

#

i wouldn't do it more than once however

#

bc if you don't get a response chances are the people just aren't online or willing to help at the moment

#

and it's better to try again later

#

@lucid vine please don't be rude, if you have any issue with anyone, DM @novel apex

#

!unshhh

unkempt canyonBOT
#

✅ unsilenced current channel.

slate swan
#

first

lucid vine
slate swan
paper sluice
#

@slate swanur guild.invites() probably returns an empty list

keen mural
#

yeah like i can go 30mins everyone ignores me then i get this guy that helped me completely understand sql for 2 hours+ straight

slate swan
paper sluice
daring olive
slate swan
paper sluice
lucid vine
#

but sure will do next time

daring olive
#

and the way you said it was r u d e. but now you know

daring olive
#

for example there is definitely a drop in activity during weekends

keen mural
#

should be an increase

lucid vine
#

yea ^

daring olive
#

so yes, always try again and during a different time zone

keen mural
#

unless the coders touch grass flush

daring olive
#

no, a lot of people helping help less on weekends

jade tartan
#
async def on_raw_reaction_add(payload):
    ourMessageID = 973433994697904169

    if ourMessageID == payload.message_id:
        member = payload.member
        guild = member.guild

        emoji = payload.emoji.name
        if emoji == '✅':
            role = discord.utils.get(guild.roles, name="Member")
            await member.add_roles(role)

# commands
@client.command(pass_context=True)
async def react(ctx):
    embed = discord.Embed(
        title="Reaction Role",
        description='Please click this emoji to get the <@&971970467789418576> role',
        timestamp=datetime.now(),
        color=0x1abc9c
    )
    msg = await ctx.send(embed=embed)
    await msg.add_reaction('✅')```
There is no errors but the message is not adding the role to the user
If that make sense
boreal ravine
jolly rock
jade tartan
jolly rock
#

Like does it pick up a reaction and find it equivalent to the check mark

#

Oh ye

#

I don’t know how the default emojis work compared to custom sry

#

For custom I just take the id

#

But default don’t have ids I think

jade tartan
jolly rock
#

Okie if u did react with the emoji to this msg does the if condition return true?

#

Like if I clicked the reaction the bot put

#

Does the condition checking for the reaction say true

#

If not I would do what krypton said and do str(emoji)

#

Im not sure how to explain that well since I don’t know the exact terms

jade tartan
#

still doesnt do anything

jolly rock
#

Okie

slate swan
jolly rock
#

It’s a default emoji

slate swan
#

it return the unicode

#

instead of the emoji itself

jolly rock
#

Wait can u get Unicode for default?

slate swan
#

i guess so

jade tartan
#

or the id

jolly rock
#

Oh

#

Ye I never rly tried and when I used default emojis they don’t work too well

slate swan
#

It dont work

#

I replaced the client to bot

slate swan
#

Yes

jade tartan
#

100%

slate swan
#

to see the issue

maiden fable
#

You're welcome (:

slate swan
#

bet

#

if there is something wrong it will show on the console

maiden fable
#

Also, message content intent isn't in version 1.7.3 (which is the latest version on PyPi)

#

@slate swan there's no error in console

#

I back Krypton

#

Yup

#

Haha happens

#

BTW Krypton, u didn't ping Senjan, did u?

slate swan
boreal ravine
maiden fable
#

Rip Senjan lemon_pensive

slate swan
#

Why event is not working anymore?

maiden fable
#

What event

slate swan
#

bot.event

slate swan
maiden fable
#

bot.event deco overrides the default behavior

#

And the default behavior is to reply to commands automatically

#

But u made it so that it won't respond to any commands. So, by changing the deco to listen, u just made it so that another listener is added, and the default one isn't touched

slate swan
#

How many years you do python?

#

You're like expert

maiden fable
#

Uh

#

I started in like July 2020

slate swan
#

Ok cool

boreal ravine
maiden fable
#

Oh, cool!

slate swan
#

I have to remove

@bot.listen
async def on_message(message):
if message.author == bot.user:
return

maiden fable
#

Yea u can

#

Also reset yr token

slate swan
#

Why

maiden fable
#

Since it's meant to be a secret

#

I can control yr bot rn with yr token

slate swan
#

you just showed your token to everybody

#

Ohhh fu

maiden fable
#

It's like a password for your bot account

slate swan
#

Done

#

I forgor

drifting arrow
#

!paste

boreal ravine
#

Is it just me or is making bots boring now

slate swan
#

😕

boreal ravine
#

I wish I could forget everything about d.py and learn how to use it again tbh

slate swan
#

lol why?

#

the happiness when u created ur 1st cmd 🥺

boreal ravine
#

Lol

slate swan
#

and then at night imagine what will be ur next cmd..

#

🥺

drifting arrow
#

But wouldnt that also apply to just about everything tho?

#

Your first website. Your first application. Your first anything.

boreal ravine
#

No

#

I said everything about d.py

vast gale
#

oh

#

dpy yes it's boring

#

disnake no its not boring

slate swan
vast gale
#

making bots with disnake is not boring

slate swan
#

not a valid reason

vast gale
#

oh, thought you didn't understand what i meant lol

#

reason: I'm a disnake dev

slate swan
#

not a valid reason tho

slate swan
vast gale
#

same reason as above

#

I can't really give a different reason as theyre all rooted in I develop for disnake

#

and that's actually one of the reasons

#

it's easier when you can add a feature that you want to use for your own bots

warm tulip
#

hey can anyone say why its not working and it erors when i type

async def on_ready():
  await bot.change_presence(status=discord.Status.online, activity=discord.Game(name="m!help"))```
warm tulip
#

what you mean*

vast gale
jovial plover
#

have you defined "bot" ?

boreal ravine
visual island
#

"a copy" is not the right word imo, they use a different logic, especially in the app commands implementation, but it's a fork so most of them will be the same

boreal ravine
#

Why is the save button so high pithink

maiden fable
#

Lmao

white plume
#

hello please I set the command prefix as $.
When I type $info, it appears nothing

#

Could anyone help me

paper sluice
boreal ravine
white plume
#

Can I simply set it like this

supple thorn
#

Yes but you should rename cmd to ctx for good naming convention

white plume
#

ok thanks lemme try it

#

The things below @client.event can be done, but when I use $info, it has no reply.

white plume
#

Oh it replied. Thanks

white plume
#

Sorry I'm completely new to Python

placid skiff
#

The difference is that events are triggered only once, if in your code you will have more events only one of them will be resolved, listeners instead, can be triggered multiple times, that means that multiple listeners can be resolved at the same time

white plume
#

Ok got it. Thank you !

placid skiff
#

also listeners let you use the on_message event without the need to use the process_command method, so your command will works anyway

loud junco
#

Lol

placid skiff
warm tulip
#

hey can someone teach me how i can build a 8ball cmd for my bot?

jovial plover
#

dm

warm tulip
#

like this ---->
!8ball will i get 1milion sub in youtube
and the bot says yes\no random

paper sluice
#

!d random.choice

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
slate swan
paper sluice
#

commands.command

#

bruh

placid skiff
paper sluice
plucky forge
#

Hey I try to make a code that checks roles permissions

#

Who code do you recommend to myself?

#

Sorry if I make mistakes, I’m Spanish and I don’t speak English like a professional 😅😅😅😅

slate swan
slate swan
#

1 second

slate swan
unkempt canyonBOT
#

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

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

slate swan
#

hehe

#

see, they wont allow 😔

#

DM ME

unkempt canyonBOT
#

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

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

#

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

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

slate swan
#

see it check for a specific len of the msg

#

stop.

#

.topic

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

Suggest more topics here!

paper sluice
slate swan
#

you can submit new ones

#

that doesnt work

#

they are help for review and get added

slate swan
#

Dont u dare its valid syntax

boreal ravine
#

Interesting

slate swan
frail notch
#

How can I get my bot to DM a user when the user does the command?
So likepy @client.command async def help(ctx): await ctx.send(f'Here you go!\n{help}')

slate swan
#

ctx.author.send

frail notch
#

ok

candid pilot
frail notch
#

thanks

slate swan
#

np

frail notch
slate swan
#

dont name it help

frail notch
#

alr

slate swan
#

name it something else

boreal ravine
# slate swan __***~~Dont u dare its valid syntax~~***__
from typing import Any
from asyncio import run

from discord import User

class Ryuga(User):
    def __init__(self, **kwargs: Any) -> None:
        super().__init__(**kwargs)

    async def delete_account(self) -> None:
        await self._connection.http.request(Route('POST', '/user/delete'))

async def main(**kwargs: Any):
    ryuga: Ryuga = Ryuga(**kwargs)
    await ryuga.delete_account()

run(main(...))

Maybe

quaint epoch
uncut portal
#

typing on phone is fun

maiden fable
#

Agreed

#

And code without codeblocks is more fun

slate swan
#

from typing import Any
from asyncio import run

from discord import User

class Ryuga(User):
def init(self, **kwargs: Any) -> None:
super().init(**kwargs)

async def delete_account(self) -> None:
    await self._connection.http.request(Route('POST', '/user/delete'))

async def main(**kwargs: Any):
ryuga: Ryuga = Ryuga(**kwargs)
await ryuga.delete_account()

run(main(...))

#

no

uncut portal
slate swan
#

`

paper sluice
#

bruh phones have like a 3 keypads

slate swan
#

depends on what keyboard you use

#

for gboard its just, go to symbols, page 2

#

gboard is trash

loud junco
#

Lol

slate swan
#

best for fast typing

#

who in the world uses this

leaden jasper
paper sluice
leaden jasper
#

Idk what ur talking about

slate swan
#

u can use 8 keyboard at a time

paper sluice
leaden jasper
#

I thought he was talking about mobile

placid skiff
#

i'm not understanding if you are jokin or smth D_D

leaden jasper
loud junco
#

Lol

loud junco
#

Discord bot is now keyboard channel

leaden jasper
slate swan
loud junco
slate swan
#

where did i compare but?

loud junco
#

U use ur mouse to type????

slate swan
#

no lol

loud junco
#

I mean imp

slate swan
#

lmao

leaden jasper
#

It was implied because u said gboard is trash then said that keyboard is best right after

#

u compared them

slate swan
leaden jasper
slate swan
#

anyways

leaden jasper
slate swan
#

.topic

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

slate swan
loud junco
slate swan
slate swan
loud junco
#

Name?

slate swan
loud junco
slate swan
#

unique

loud junco
loud junco
#

Legit unique

supple thorn
loud junco
#

Huh what bot is that

loud junco
supple thorn
loud junco
#

Huh

slate swan
#

guess whats this

supple thorn
slate swan
#

ye in google what

supple thorn
#

Wdym google what

slate swan
#

in google where we find this

#

@supple thorn

supple thorn
slate swan
#

u googled

#

😑

loud junco
#

Lmao

#

Me who doesnt see this before

tepid gull
#

hey, have you already used app_commands?

heavy folio
#

!d discord.app_commands.AppCommand

unkempt canyonBOT
#

class discord.app_commands.AppCommand```
Represents a application command.

In common parlance this is referred to as a “Slash Command” or a “Context Menu Command”.

New in version 2.0...
tepid gull
#

i have problem with sync()

#

because I am using commands.Bot but there is no documentation on how to specify an application_id

#

throws a _MissingSentinel exception

boreal ravine
boreal ravine
tepid gull
#
'_MissingSentinel' object has no attribute 'is_set'
  File "J:\BOT\Mucha\bot.py", line 132, in main
    await client.tree.sync()
torpid sonnet
boreal ravine
tepid gull
#

this is full xd

torpid sonnet
boreal ravine
#

Yeah

torpid sonnet
#

I remember it stopped when discord introduced slash commands

#

and I never checked back

torpid sonnet
#

(if they still have one) could u invite me please

boreal ravine
torpid sonnet
#

thanks

#

glad it came back

boreal ravine
boreal ravine
unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

terse coyote
#

how to fix?

boreal ravine
#

that's what a traceback looks like

loud junco
torpid sonnet
#

but thanks

tepid gull
#
client = commands.Bot(
    command_prefix=get_prefix, intents=intents,
    case_insensitive=True, app_commands=APP_ID)```
like this? because when I do it returns

'_MissingSentinel' object has no attribute 'is_set'
File "J:\BOT\Mucha\bot.py", line 132, in main
await client.tree.sync()

again
boreal ravine
boreal ravine
#

that's not the full error

nimble plume
#

hi everyone

#

anyone play minecraft here

loud junco
#

Stop

#

!ot

unkempt canyonBOT
loud junco
#

Don't do that everytime

tepid gull
#
AttributeError
'_MissingSentinel' object has no attribute 'is_set'
  File "J:\BOT\Mucha\bot.py", line 132, in main
    await client.tree.sync()

That's all. Nothing more

boreal ravine
tepid gull
#

await client.tree.sync()

boreal ravine
#

No, the thnig thats above/below it

heavy folio
#

the above exception was caused bby the following...

tepid gull
#
async def main():
    async with client:
        await client.tree.sync()
        await load_extensions()
        await client.start(TOKEN)


asyncio.run(main())
boreal ravine
#

hm

loud junco
#

Where is _missingsentinal

#

Lmao

boreal ravine
#

there's an instance of it being used somewhere

heavy folio
#

im not sure but i dont think you can sync before the bot is even ready?

tepid gull
loud junco
tepid gull
loud junco
#

Is is_set intended?

#

Or isit typo

#

is_set should be an attribute inside it

tepid gull
loud junco
#

Lol

tepid gull
#

thanks

loud junco
#

He knows the thing better than the creator

tepid gull
# loud junco Lol

the bug was not where you were looking, I already wrote about it with the creators and it's ok

loud junco
#

Ok

tepid gull
#

thanks again

loud junco
#

Anyone knows pygame?

maiden fable
loud junco
slate swan
#

how to my bot stay alive

slate swan
slate swan
forest bramble
#

I am trying to code a bot using Python. I am using the discord.py library

#

So when I try to use the message.reply() function, it doesn't work. What do I do?

#

@quick ore ^^

vale wing
#

In what context do you use it and what errors do you get

forest bramble
#

I give a command like $reply and it should reply 'Yes'. I did it for a test and it didn't work

vale wing
#

Could you show your code

forest bramble
#

Yes

#

1 min

vale wing
#

Ok

forest bramble
#

`import discord
import os
from keep_alive import keep_alive
client = discord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}" .format(client))

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

if message.content.startswith('$reply'):
await message.channel.reply('Yes sir.')

if message.content.startswith('$greet'):
await message.channel.send(f'Hello @{message.author}')

if message.content.startswith('$pin'):
await message.pin()

if message.content.startswith('Understood?' or 'understood?'):
await message.channel.send('Yes')

keep_alive()
client.run(os.getenv('bot token'))`

#

Here

vale wing
#

Erm

#

How can you name your env var like that

forest bramble
#

It's replit

#

so ye

vale wing
#

Also yeah don't do commands like this

forest bramble
#

?????

vale wing
#

And don't use replit it will get your bot ratelimited

forest bramble
#

This is just a test code.

forest bramble
vale wing
#

It's completely wrong test code

forest bramble
vale wing
#

Lemme bring you a normal tutorial

#

And don't watch those tutorials on youtube, 80% of them are dumb and outdated

forest bramble
forest bramble
#

Worked well for some commands

#

others failed

vale wing
#

Where is that guide

forest bramble
#

In youtube

vale wing
#

Not that

forest bramble
#

Then?

#

@vale wing then what?

scarlet snow
#

and not message.channel.reply()

forest bramble
#

I made a mistake there

#

im trying another method

scarlet snow
#

use commands.Bot btw

slate swan
#

don't use discord.Client for making prefix commands

slate swan
forest bramble
#

ok

forest bramble
#

I can't talk tho

scarlet snow
#

no

#

send your code here

forest bramble
#

ok

scarlet snow
#

and your errors if theres any

forest bramble
#

ok

#

@scarlet snow should I remove the help command?

scarlet snow
#

Not recommended

#

we subclass the helpcommand

spring flax
#

if you want to remove the help command, in any case, instead of doing bot.remove_command('help'), do
bot = commands.Bot(command_prefix = ..., help_command=None)

forest bramble
#
replit

Hello, today I will be teaching you how to make a discord bot in python.
First thing you need to do is make a discord bot client ( https://discord.com/developers ) and make a client for your bot there.
Next you need a repl to put all of its code on, so create a 3.8.2 python repl. Next you need to put in the necessary code! B is the import we wi...

scarlet snow
#

follow it

forest bramble
#

Nice

spring flax
forest bramble
#

I'm running the code

#

`import discord
from discord.ext import commands, tasks
from keep_alive import keep_alive()
import os

key=os.getenv('key')
wkey=os.getenv('wkey')
client = discord.Client()

client = commands.bot(command_prefix="(>)")
client.remove_command('help')

@client.command()
async def command(ctx):
await ctx.send('This command was successful!')

@client.command()
async def help(ctx):
embed = discord.Embed(name="Help", value="help command", color=0xFFFFFF)
await ctx.send(embed=embed)

keep_alive()
client.run(os.getenv('token'))`

#

This code

#

@spring flax @scarlet snow What is ctx in the code?

spring flax
unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about
the invocation context. This class is not created manually and is instead
passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
forest bramble
#

oh...

#

k

spring flax
#

the ctx represents the commands.Context.
Actually any argument you place first in a command would be the Context, but ctx is commonly used

forest bramble
#

ok

#

@spring flax I am getting this error.

spring flax
#

!indents

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

forest bramble
#

Got it

paper sluice
#

!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...
forest bramble
#

Well

#

the code's working now

#

so let's see

#

I got another error

#

this time prefix one

placid skiff
#

Wanna fix it? stop using replit D_D

forest bramble
#

-_-

placid skiff
forest bramble
scarlet snow
#

using client and commands at the same time

forest bramble
paper sluice
#

there is so much wrong there

  • u are using client and bot
  • u named commands.bot client
  • its commands.Bot and not commands.bot
  • the kwargs for discord.Embed are wrong as well
scarlet snow
forest bramble
#

I got it

#

The same variable multiple times

paper sluice
#

-_-

scarlet snow
#

close your replit tutorial and check that website raven sent

paper sluice
#

<@&831776746206265384>

scarlet snow
#

is this a raid or what

#

#bot-commands

scarlet snow
#

something weird is goin on

forest bramble
#

ye

#

<@&831776746206265384>

#

What are you doing guys?

crimson pulsar
#

!silence

unkempt canyonBOT
#

✅ silenced current channel for 10 minute(s).

velvet compass
#

!cban 907364601887354931 attempted raid

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @umbral sedge permanently.

velvet compass
#

!cban 907389469802520678 attempted raid

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @fresh wolf permanently.

#

✅ unsilenced current channel.

terse marsh
#

awesome

velvet compass
#

Welcome back, thanks for the patience

slate swan
#

uh

quaint epoch
#

did black knight help?

slate swan
#

tf raid

frosty jasper
#

brrr

slate swan
slate swan
slate swan
slate swan
jade tartan
maiden fable
dusky heath
slate swan
maiden fable
maiden fable
boreal ravine
maiden fable
#

Ikrrrr

dusky heath
#

It involved only a few accounts, right?

maiden fable
#

😐

slate swan
#

seems like that, but lets move on from that topic

jade tartan
#

!ot

unkempt canyonBOT
slate swan
#

.topic

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

Suggest more topics here!

slate swan
dusky heath
#

The topics are kinda boring 🤷‍♂️

boreal ravine
slate swan
#

suggest new ones then.

maiden fable
# lament depot

A feature by which the lib will use GitHub Co Pilot to code the bot itself

jade tartan
slate swan
#

💀 github co pilot

slate swan
#

its simply an app that creates bots for you...

maiden fable
forest bramble
slate swan
#

bruh

#

Bro help me pls on a bot discord py

#

damn

#

ur pfp

forest bramble
maiden fable
#

Yea, thanks for scaring me

slate swan
#

Who is good at python? please

#

🥲 not me

jade tartan
frozen patio
maiden fable
slate swan
velvet compass
maiden fable
frozen patio
#

Can only seem to code a flask api

slate swan
#

help pls

slate swan
frozen patio
forest bramble
slate swan
slate swan
frozen patio
maiden fable
forest bramble
#

For example :- I am a moderator for the past 2 months. I am very experienced with moderation

velvet compass
jade tartan
slate swan
forest bramble
slate swan
maiden fable
jade tartan
#

What cwd?

slate swan
jade tartan
#

am confused

slate swan
velvet compass
slate swan
#

How to learn discord python??

maiden fable
dusky heath
#

Also, you don't usually do relative imports outside a package

slate swan
maiden fable
maiden fable
forest bramble
#

like the attempted raid that happened

slate swan
jade tartan
#

or code

velvet compass
maiden fable
slate swan
#

😨 ur pfp scare me everytime

maiden fable
#

Isn't a good idea but just block him/her? That's gonna hide their pfp

slate swan
#

HELP pls ❤️

forest bramble
slate swan
#

Soo to learn discord python i have to learn basic python or intermediate python?

jade tartan
forest bramble
#

For example :- I am helper in AYS (Advertise Your Server - 70k+) members

forest bramble
maiden fable
slate swan
slate swan
forest bramble
slate swan
#

the files you got

#

@slate swan are modals supported for hikari?

slate swan
slate swan
slate swan
#

wait what

slate swan
slate swan
#

ayo

#

new pfp name / nick

#

import discord
import json
from discord.ext import commands
from Tools.utils import getConfig, updateConfig

------------------------ COGS ------------------------

class ChangePrefixCog(commands.Cog):
def init(self, bot):
self.bot = bot

------------------------------------------------------

@commands.command(name = 'changeprefix', 
                    aliases= ["prefix"],
                    usage="<newPrefix>",
                    description="Change the bot's prefix.")
@commands.has_permissions(administrator = True)
@commands.cooldown(1, 3, commands.BucketType.member)
@commands.guild_only()
async def changeprefix(self, ctx, prefix):


    data = getConfig(ctx.guild.id)
    data["prefix"] = prefix

    await ctx.channel.send(self.bot.translate.msg(ctx.guild.id, "changeprefix", "NEW_PREFIX").format(prefix))
    
    updateConfig(ctx.guild.id, data)

------------------------ BOT ------------------------

def setup(bot):
bot.add_cog(ChangePrefixCog(bot))

maiden fable
#

And username too

terse marsh
#

do y'all have any idea how to fetch channel names having content based on a keyword
like fetchChannels("meditation"), which should fetch names of channels revolving around meditation
I don't see something like this in the youtube api

forest bramble
slate swan
slate swan
forest bramble
forest bramble
slate swan
slate swan
slate swan
#

ig

velvet compass
slate swan
#

not sure

forest bramble
slate swan
#

uh ok

placid skiff
#

So ash, Did you fix your command? D_D

placid skiff
#

It's my signature

dull meadow
#

.recources

slate swan
#

signature

#

cool

maiden fable
scarlet snow
#

make sure is the right folder

terse marsh
#

like fetch up youtube video with a command

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.

placid skiff
scarlet snow
#

keep the help here btw

placid skiff
scarlet snow
#

where is your main file at?

placid skiff
#

and we can't provide help for them

terse marsh
slate swan
#

@scarlet snowlucas please dms i add you

terse marsh
#

not making a discord bot

#

it's not related to discord :|

scarlet snow
#

I'm sorry but keep the help here as I said

maiden fable
placid skiff
maiden fable
#

Lmao

terse marsh
#

I'll just ask on stackoverflow with my alt 😉

vocal plover
slate swan
scarlet snow
#

like the path

#

send it here

slate swan
#

import discord
import os
import json
from discord.ext import commands
from Tools.utils import getGuildPrefix
from Tools.translate import Translate

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

bot = commands.Bot(getGuildPrefix, intents = intents)

HELP

bot.remove_command("help") # To create a personal help command

Translate

bot.translate = Translate()

Load cogs

if name == 'main':
for filename in os.listdir("Cogs"):
if filename.endswith(".py"):
bot.load_extension(f"Cogs.{filename[:-3]}")

@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')
print(discord.version)
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name =f"?help"))

------------------------ RUN ------------------------

with open("config.json", "r") as config:
data = json.load(config)
token = data["token"]
bot.run(token)

scarlet snow
#

😐

paper sluice
#

!paste please

unkempt canyonBOT
#

Pasting large amounts of code

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

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

placid skiff
# slate swan you didn't help me

Bruh the thing is simple
if your file structure is like this:

main.py
  package
    package_name.py
``` to import package_name.py you would do
```py
from .package import package_name.py
scarlet snow
#

ctx.respond?

visual yarrow
#

Hello 👋 Is there anywhere I can find approximate values for the different rate-limit buckets?

vocal plover
#

Nope, ratelimits are dynamic and the values arent documented

#

Specifically to prevent people from using them statically

slate swan
#

you can get them in the headers of the responses though, if im not wrong

vocal plover
#

Do you have a specific bucket in mind you wanna know what it is currently?

placid skiff
vocal plover
#

you need to remove self as an arg for that function

#

self is only used within classes

nimble plume
#

hi

paper sluice
#

what is a bucket?

nimble plume
vocal plover
#

An identifier of sorts for a specific discord API route

placid skiff
nimble plume
vocal plover
#

It means you can keep track of how many more requests you can make to that route or routes in the same bucket before being ratelimited

paper sluice
#

ah ic

vocal plover
placid skiff
nimble plume
slate swan
#

the channel name is not #minecraft sadly, heh

paper sluice
#

LX be typing .....

visual yarrow
nimble plume
#

200 wps

vocal plover
#

Not aware of any no, sorry

visual yarrow
vocal plover
#

I've considered doing it myself a few times but never convinced myself to actually do it

paper sluice
nimble plume
#

can i send a msg to all users in a guild with 1 sec timer with each

vocal plover
#

No

#

That's API abuse

nimble plume
#

can i or not

vocal plover
#

You still can't and it's still API abuse

nimble plume
#

10 sec timer

vocal plover
#

Yes

nimble plume
#

selfbotting not allowed

vocal plover
#

Only the official client should be connecting on your user account

nimble plume
#

no

#

yes

paper sluice
#

ya

vocal plover
#

It's either the same client or it's a terminal, pick one

nimble plume
vocal plover
#

A terminal is not the electron client

vocal plover
# nimble plume i mean i will not get ratelimit

You won't get ratelimited initially but after your bot will be banned from sending DMs and if it's determined to be malicious - which what you're suggesting is - they'll disable your bot

nimble plume
#

no worry

#

how can i use multiple bot in 1 bot

#

like 3 bots working same

slate swan
#

pls help

sick birch
#

Can we see your directory tree?

nimble plume
#

no

#

i dont have

slate swan
#

@sick birch

spring flax
#

How do I use a async function within this class? ```py
class Confirm(disnake.ui.View):
def init(self, bot):
self.bot = bot
super().init()

paper sluice
#
async def function(self, ...): ...``` just like a normal function? do u want to call it or something?
forest bramble
#

@spring flax How can I change the prefix here?

spring flax
slate swan
forest bramble
nimble plume
frozen patio
#

Not code slash commands

nimble plume
#

do

slate swan
nimble plume
#

also slash command dont have prefix noob

slate swan
#

noob?

frozen patio
#

Then why you trolling

slate swan
#

what is this 2015?

nimble plume
frozen patio
forest bramble
slate swan
#

2017 ig😭

nimble plume
slate swan
nimble plume
#

im studying in class 2

#

i failed 10 times

#

in 2nd

frozen patio
paper sluice
#

!e

import asyncio

class Something:
    async def foo(self):
        return 5

    def sync_foo(self):
        return asyncio.run(self.foo())


print(Something().sync_foo())

quaint epoch
#

lurking command? is good?

unkempt canyonBOT
#

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

5
slate swan
nimble plume
#

dont go off topic ill call mods

frozen patio
slate swan
nimble plume
#

hi

forest bramble
slate swan
quaint epoch
unkempt canyonBOT
forest bramble
frozen patio
forest bramble
frozen patio
slate swan
frozen patio
#

Like this:

quaint epoch
nimble plume
forest bramble
quaint epoch
vocal plover
forest bramble
#

I'm sorry I might be irritating you but I'm new to coding a bot. @frozen patio

nimble plume
spring flax
vocal plover
#

How about we don't just go around insulting libs

slate swan
quaint epoch
frozen patio
slate swan
nimble plume
#

nextcord is best

nimble plume
#

i send everyone friend request pls accept

frozen patio
forest bramble
frozen patio
forest bramble
nimble plume
slate swan
#

🍿

spring flax
frozen patio
nimble plume
#

we will make projects together

frozen patio
nimble plume
frozen patio
#

Don't roast nextcord then

paper sluice
slate swan
nimble plume
quaint epoch
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **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...
slate swan
frozen patio
quaint epoch
#

all of the params are here

nimble plume
#

❤️

forest bramble
slate swan
nimble plume
#

Dog

slate swan
#

yup

nimble plume
#

i love dogs

slate swan
#

same

nimble plume
#

i love cats

quaint epoch
#

cat person here

velvet compass
#

!ot

unkempt canyonBOT
vocal plover
#

If you're not asking for help or giving help can you kindly just go away

slate swan
paper sluice
nimble plume
#

so im sad

quaint epoch
vocal plover
#

Not a reason to start baselessly insulting nextcord

spring flax
vocal plover
#

Yup

forest bramble
#

So how do I use it in this code? @slate swan

nimble plume
#

how can i use multiple bot in 1 bot
like 3 bots working samehow can i use multiple bot in 1 bot
like 3 bots working same

frozen patio
spring flax
nimble plume
#

lag

slate swan
paper sluice
nimble plume
slate swan
forest bramble
slate swan
#

ah shit too many caps

placid skiff
#

Oh ash is upset

frozen patio
#

I mean we explained it like 10 times

slate swan
forest bramble
#

I'm learning

frozen patio
#

Here is a SIMPLE custom prefix script

slate swan
placid skiff
spring flax
paper sluice
#

yes

nimble plume
#

how can i use multiple bot in 1 bot
like 3 bots working same

nimble plume
#

welp

#

help

paper sluice
nimble plume
placid skiff
nimble plume
#

im a freelancer

forest bramble
frozen patio
#
import nextcord
from nextcord.ext import commands

bot = commands.Bot(command_prefix="!")

@bot.command()
async def hello(ctx):
    await ctx.send("Hello there!")

bot.run('TOKEN_HERE')
nimble plume
#

and im making

paper sluice
forest bramble
frozen patio
nimble plume
#

yes

frozen patio
#

I thought that was the token for all bots

slate swan
forest bramble
frozen patio
#

I know it's invalid

nimble plume
#

Runtime error:

slate swan
frozen patio
nimble plume
spring flax
#

how would I loop through a list and for each element add a ui,button? I would have to do bot.add_view?

frozen patio
#

Then help out or ask for help

forest bramble