#discord-bots

1 messages · Page 1058 of 1

warped mirage
#

so tell me for example mee6 bot

#

whats are theirs tos

stone beacon
#

Yes... yes they can

stone beacon
warped mirage
#

why do u need a tos?

#

its not like ur adding a illegal command

stone beacon
#

Poor Ash

slate swan
warped mirage
#

bruh no f sense im so bad at this stuff

slate swan
#

😭

warped mirage
#

Unless otherwise specified, the terms of use detailed in this section apply generally when using this Website.

Single or additional conditions of use or access may apply in specific scenarios and in such cases are additionally indicated within this document.

By using this Website, Users confirm to meet the following requirements:

There are no restrictions for Users in terms of being Consumers or Business Users; so can i just copy this?

jade tartan
#

I cant seem to get this working

stone beacon
#

Vscode is screaming at you to format your code that's all

warped mirage
#

wait

stone beacon
#

try that, it might help

#

If it doesn't help then you just gotta manually fix your indents and tabs

jade tartan
#

Where did you find that?

warped mirage
#

this stuff makes no sense lmao , so i must write pages of tos and violations and stuff

stone beacon
#

🤣

slate swan
#

your questions are hellish now, told you it makes sense so it does

warped mirage
#

OHHHHHH

jade tartan
warped mirage
#

wait so u basically add a guide or whatever for stuff eg if there is stuff u can buy

warped mirage
#

correct?

#

then tf is this

slate swan
#

....

stone beacon
#

terms of service = how consumers should use your service. Nothing complex about it fam just state what people are allowed to do

slate swan
warped mirage
#

use commands

stone beacon
#

Poor Ash

slate swan
#

I'm out

warped mirage
#

bruh

warped mirage
slate swan
#

basically to protect from getting your app counterfeited

warped mirage
#

how tho ..... its not like im gonna add anything bad

#

like it doesnt make sense u get what i mean?

slate swan
warped mirage
#

and my app is the bot application right?

slate swan
#

yes

jade tartan
#

Where did you find that format document thing?

#

And it aint working

warped mirage
#

so can i copy the tos that people have

slate swan
stone beacon
warped mirage
#

wdym by my app

stone beacon
#

anywhere or just search for it in vscode

warped mirage
#

so people can access my app?

stone beacon
slate swan
warped mirage
#

do people have access to this?

slate swan
warped mirage
#

wait so uknow the invite link for the bot that i get ... do i share that , is that the only thing they can access

royal geode
#

How do I code a bot

slate swan
warped mirage
#

not access it , correct?

slate swan
#

they can access it

#

since thats how they add the app

royal geode
#

What is the bace code I need

slate swan
#

I swear I'll have to meditate for 30 minutes today

warped mirage
robust fulcrum
#

If i use message
Then it will edit only 1 time
How can I edit it 4 times

robust fulcrum
#

Like i used message.edit(content=anything)
If i want to edit it after 1 second again how can I?

warped mirage
#

@slate swan I figured it out lol

#

Just for the Tos tho nothing else rn

#

Basically talking about ur bot/app

slate swan
warped mirage
#

Lmao ur a girl and I wasted ur time

#

Sos lol ………….

#

I’m usually not like this

stone beacon
#

Extended meditation period

slate swan
stone beacon
robust fulcrum
stone beacon
#

you can keep calling .edit() on it

warped mirage
stone beacon
#

Unless they changed that

slate swan
warped mirage
#

Right now time to fix my bot xD

slate swan
robust fulcrum
warped mirage
#

I’m a nightmare

#

500+ questions for 1 thing

stone beacon
#

Put that on your Linkedin

warped mirage
stone beacon
dull terrace
#

Start of day 7 and my bot is at 59 servers eyesintensify if it keeps growing exponentially like this...

robust fulcrum
slate swan
#
@Bot.command
async def foo(ctx: Context):
   msg = await ctx.send("...")
   for _ in ["edit1", "edit2", "edit3"]:
      await msg.edit(_)
      await asyncio.sleep(1)

thts how you edit multiple times (using a list is optional though)

stone beacon
#

message = ctx.send()
message.edit()

#

Just keep editing the message

robust fulcrum
#

Ok

stone beacon
#

Idr the rate limit though

#

But I think it's like 15 calls / sec so you should be fine

robust fulcrum
#

Oh i understood

slate swan
#

!e

_ = "..."
print(_)
unkempt canyonBOT
#

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

...
robust fulcrum
#

My bot keep adding aiohttp again and again even i installed it

slate swan
robust fulcrum
#

Everytime it add it

slate swan
#

or install the specific version it requires

warped mirage
#

btw can someone help me fix my bot

#

doesnt respond to commands but no errors

dull terrace
#

thanks froggy_chill not sure what to do next to get it to more people

slate swan
warped mirage
#

takes time to understand

slate swan
#

its fine, dont be apologetic if you dont understand things

warped mirage
dull terrace
slate swan
jade tartan
#

Ayee i got my code formatted

warped mirage
#

hey @dull terrace may i ask how long did it take to code ur bot?

jade tartan
#

I got a question ```@commands.command()
@commands.has_permissions(manage_messages=True)
@commands.cooldown(1, 5, commands.BucketType.guild)
async def mute(self, ctx, member: discord.Member, *, reason=None):
guild = ctx.guild
mutedRole = discord.utils.get(guild.roles, name="Muted")

    if not mutedRole:
        mutedRole = await guild.create_role(name="Muted")

        for channel in guild.channels:
            await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
    embed = discord.Embed(title="Muted", description=f"{member.mention} was muted ", colour=discord.Colour.blue(
    ), timestamp=datetime.datetime.utcnow())
    embed.add_field(name="Reason:", value=reason, inline=False)
    await ctx.reply(embed=embed)
    await member.add_roles(mutedRole, reason=reason)
    await member.send(f"You have been muted from: {guild.name} Reason: {reason}")``` When someone gets muted how do i make it to where the user wont be able to type any message
dull terrace
#

of daily work pretty much

jade tartan
#

if that make sense

warped mirage
#

ok no wonder it has a big descriptions

jade tartan
#

or send any message in any channel

warped mirage
#

/

jade tartan
#

Hello

warped mirage
#

\//

#

//

#

alright

dull terrace
warped mirage
robust fulcrum
#

Help anyone pls help
My replit is being mad
It keeps downloading aiohtto again and again and not starting my bot

dull terrace
slate swan
warped mirage
#

as u can see my bio im developing a bot that will be published lol

warped mirage
#

i mean status

robust fulcrum
#

I did

slate swan
#

refresh

dull terrace
warped mirage
slate swan
dull terrace
robust fulcrum
dull terrace
slate swan
robust fulcrum
#

Are you encouragimg me or discouracmging

slate swan
slate swan
#

dont overthink.

warped mirage
# dull terrace what type of bot are you making

idk , so far what i made was ban command kick mute unmute some helper functions , and in development almost finished my leveling system , i need to finish my enable , disable system then add a leaderboard

maiden fable
warped mirage
#

i cant really identify the type yet probs multipurpose

slate swan
maiden fable
#

Thanks

dull terrace
#

got a wild 20% click through on one of them i spent $1 on

maiden fable
#

Oh, cool

warped mirage
#

bruh my bot doesnt respond to any commands , or has errors

#

smh

slate swan
maiden fable
slate swan
#

youll be making money

dull terrace
warped mirage
dull terrace
#

maybe a fun theme

robust fulcrum
slate swan
maiden fable
#

Hm, my bot is in like 160 servers in || 11 months ||

slate swan
dull terrace
slate swan
#

i can advertise it too

#

more ppl need to see it

dull terrace
#

sure

jade tartan
#

Hello

#

no body answered me

maiden fable
#

Olie gets lucky 👀

#

Ngl, I don't really like bot deving much since all the ideas are already taken

slate swan
maiden fable
#

Agreed

warped mirage
#

and also py @client.group() async def slvl(ctx): return

#

not that much xd @slate swan

maiden fable
#

No embed

#

!paste exists

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.

dull terrace
warped mirage
dull terrace
#

it's a moderation bot but with x

maiden fable
#

X

#

Define x

warped mirage
#

idk ima probs add minigames to my bot along with truth or dares , along with 8 ball and stuff uknow , make the bot full on good

vocal plover
#

If you're going to make a moderation bot you need your average ban|kick|mute etc. but more importantly you need something really unique that makes it worth it over some of the kings of mod bots like gearbot/zeppelin

jade tartan
#
    @commands.has_permissions(manage_messages=True)
    @commands.cooldown(1, 5, commands.BucketType.guild)
    async def mute(self, ctx, member: discord.Member, *, reason=None):
        guild = ctx.guild
        mutedRole = discord.utils.get(guild.roles, name="Muted")

        if not mutedRole:
            mutedRole = await guild.create_role(name="Muted")

            for channel in guild.channels:
                await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
        embed = discord.Embed(title="Muted", description=f"{member.mention} was muted ", colour=discord.Colour.blue(
        ), timestamp=datetime.datetime.utcnow())
        embed.add_field(name="Reason:", value=reason, inline=False)
        await ctx.reply(embed=embed)
        await member.add_roles(mutedRole, reason=reason)
        await member.send(f"You have been muted from: {guild.name} Reason: {reason}")```  When someone gets muted how do i make it to where the user wont be able to type any message
warped mirage
#
@client.command(description="Mute the specified user")
@commands.has_permissions(administrator=True)
async def mute(ctx, member: discord.Member, *, reason=None):
    guild = ctx.guild
    mutedRole = discord.utils.get(guild.roles, name="Muted")

    if not mutedRole:
        mutedRole = await guild.create_role(name="Muted")

        for channel in guild.channels:
            await channel.set_permissions(mutedRole, speak=False, send_messages=False)
    await member.add_roles(mutedRole, reason=reason)
    bedem = discord.Embed(name="Muted", description=f"{member.mention} has been muted because {reason}", color=0xBFFF00)
    await ctx.send(embed=bedem)
    await member.send(f"You have been muted in {guild.name} for {reason}")``` basic enough
#

u must have a role called Muted

vocal plover
#

Why not use native timeouts?

warped mirage
#

idk tbf

#

anyways can someone help me fix my bot?

dull terrace
jade tartan
jade tartan
#

So thats basically not that

#

Do we make it like this

warped mirage
#
for channel in guild.channels:
            await channel.set_permissions(mutedRole, speak=False, send_messages=False)```
#

this.

warped mirage
heavy shard
dull terrace
#

if you're doing something that's already been done, the only way for it to be worth it is to do it better than anything that's been done

warped mirage
vocal plover
#

if I think of a good original idea imma keep it for myself kek

stray carbon
#

yo

vocal plover
#

not too many of those flying around nowadays

stray carbon
#

im a mysql user

warped mirage
heavy shard
#
        if levelsys and not levelsys[0]:
            return

in on_message

stray carbon
#

cant i set connection attr

#

so i dont have to connect again and again?

#

for each cog

jade tartan
warped mirage
heavy shard
warped mirage
#

ok

dull terrace
jade tartan
dull terrace
#

whatever you're interested in

warped mirage
jade tartan
warped mirage
heavy shard
warped mirage
stray carbon
#

i did this in on_ready

try:
    db = mysql.connector.connect(user='user', password='password',
                                 host='host',
                                 database='database')
except:
    print('Error')

bot.db = db

Still got error object Bot has not attribute db

warped mirage
heavy shard
warped mirage
stray carbon
#

does it work in nextcord?

jade tartan
#

@warped mirage it still doesnt work

warped mirage
heavy shard
warped mirage
heavy shard
#
        if levelsys and not levelsys[0]:
            return
slate swan
#

How can my bot make a send all warnings of a user in one embed?

warped mirage
#

but then nothing else works

#

all works

#

apart leveling

robust fulcrum
#

@slate swan
Your command gave me this error

heavy shard
warped mirage
#

one more issue tho.

#

doesnt send the message like system has been disabled / enabled

dull terrace
slate swan
#

so i have this code in a module im using

class PyKingError(Exception):
    pass

class ApiError(PyKingError):
    def __repr__(self) -> str:
        return "The API is down"

class InvalidKeyError(PyKingError):
    def __repr__(self) -> str:
      return "invalid key"

class DailyLimitError(PyKingError):
    def __repr__(self) -> str:
        return "limit hit"```
what i wanna add in the main code incase a error of these happen:|
```py
except PyKingError(The error name i wanna add it here or specify a action to do for each error)```
pliant gulch
warped mirage
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'int' object is not subscriptable``` any ideas
#
@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
    async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
                                (ctx.guild.id,)) as cursor:
        levelsys = await cursor.fetchone()
    if levelsys:
        if not levelsys[0] == 1:
            return await ctx.send('The leveling system is already disabled')
    async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
                                (ctx.guild.id,)) as cursor:
        data = await cursor.fetchone()
    if data:
        em = discord.Embed(title="Leaderboard")
        count = 0
        for table in data:
            count += 1
            user = ctx.guild.get_member(table[2])
            em.add_field(name=f"{count}.{user.name}", value=f"Level -**{table[0]}** | XP -**{table[1]}**", inline=False)
        return await ctx.send(embed = em)
    return ctx.send("There are no users stored in the leaderboard")``` this is what i coded
#

@slate swan would u know ? , this is my last thing i need

#

or @heavy shard

dense swallow
#

can u have many status playing one after the other in a sub-classed bot class?

#

ik theres a way to do it the normal way, ie: bot = commands.Bot()

#

but when the bot is in class, it has the activity arg

small ravine
#

What resources would you suggest a beginner for developing bots?

potent spear
warped mirage
#

its been a bit

small ravine
potent spear
#

If you scroll in the pinned messages, there’s a quickstarter

warped mirage
# potent spear Read the full error

idk tbf this is the last thing i need for my level system , here is my last code ```py

@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
(ctx.guild.id,)) as cursor:
levelsys = await cursor.fetchone()
if levelsys:
if not levelsys[0] == 1:
return await ctx.send('The leveling system is already disabled')
async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
(ctx.guild.id,)) as cursor:
data = await cursor.fetchone()
if data:
em = discord.Embed(title="Leaderboard")
count = 0
for table in data:
count += 1
user = ctx.guild.get_member(table[2])
em.add_field(name=f"{count} - {user.name}", value=f"Level -{table[0]} | XP -{table[1]}", inline=False)
return await ctx.send(embed = em)
return ctx.send("There are no users stored in the leaderboard")```

paper sluice
#

levelsys[0] == 1: what do you expect?

potent spear
warped mirage
#

int is not subscriptable...

potent spear
#

You’re just sending the last lines and hour whole code…

#

An error traceback contains so much more info

warped mirage
#

so i know what im saying .....

small ravine
potent spear
potent spear
warped mirage
#
user = ctx.guild.get_member(table[2])```
#

this

potent spear
#

Well, have you googled the error first?

heavy shard
slate swan
#

hi, i have a little question about discord bot ability. i dont want to be bothersome is anybody here to hear my question?

placid skiff
potent spear
#

Sad AND true

slate swan
#

To use (my own) bot to give me a role

potent spear
#

Not very discord bot related

placid skiff
slate swan
#

the issue: i dont have admin in server but my bot here does

placid skiff
#

Uh

#

!d discord.Member.add_roles this one is the method that gives one or more roles to a member

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to
use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list
of roles than the highest role of the member.
slate swan
#

thank you, i will check on this and if i have more questions come back here

#

and how to say which person you give that role to

placid skiff
#

It is a Member object

#

!d discord.Member

unkempt canyonBOT
#

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

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

There are various ways to retrieve a Member, through an id, through a message, through his name or discriminator it depends on what information do you have in that moment

warped mirage
#
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
AttributeError: 'NoneType' object has no attribute 'name'``` any ideas?
slate swan
#

so if i put discord.Member= 977931752469311549 above this thats how i can say who it is right

placid skiff
#

!d discord.Guild.get_member nope to get a member through an id you can use this method

unkempt canyonBOT
#

get_member(user_id, /)```
Returns a member with the given ID.

Changed in version 2.0: `user_id` parameter is now positional-only.
warped mirage
#

guys how do i make a global leaderboard , is it possible or nah

slate swan
#

if u want to pay the least its stays yours for 1 year but u can choose how much to stay

#

custom domains of course

#

but they dont support all tlds

#

u can have that

#

ok

maiden fable
#

Renew from namecheap, then from some other registrar and so on

potent spear
#

Github has free hosting for an account 🤷‍♂️

slate swan
#

thats nothing special lmao

warped mirage
#

So that it’s multi guide I guess

potent spear
warped mirage
heavy shard
potent spear
#

No, I’m busy
You gotta TRY first

potent spear
# warped mirage huh

You have to learn how to debug, do that for half a day and it’ll make you ask 90% less questions here

warped mirage
#

Lol

#

Till then help me fix the only thing that I need xD

potent spear
#

I won’t

#

Learning how to debug won’t even require us to help you afterwards

warped mirage
#

Bruh it’s probs one fix but idk

potent spear
#

Learning what the error means is 1 step in the right direction

warped mirage
#
AttributeError: 'NoneType' object has no attribute 'name'```
#

This is the error lmao

warped mirage
#

I already told u where the error comes from

#
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
AttributeError: 'NoneType' object has no attribute 'name'``` any ideas?
terse coyote
#

how to timeout user?

potent spear
potent spear
unkempt canyonBOT
#

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

Applies a time out to a member until the specified date time or for the
given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").

You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to
use this...
stray carbon
#
Traceback (most recent call last):
  File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\client.py", line 417, in _run_event
    await coro(*args, **kwargs)
  File "c:/Users/Akai/Desktop/Sugari/dashboard.py", line 72, in on_guild_join
    cursor.execute('INSERT INTO prefixes (prefix, guild) VALUES (%s, %s)', (',', guild.id))
  File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\mysql\connector\cursor_cext.py", line 269, in execute
    result = self._cnx.cmd_query(stmt, raw=self._raw,
  File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\mysql\connector\connection_cext.py", line 528, in cmd_query
    raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.DataError: 1264 (22003): Out of range value for column 'guild' at row 1

Hi???

#

what does this mean

warped mirage
#

Guild I think is the problem

potent spear
#

Nope

terse coyote
warped mirage
#

Bruh idk then

potent spear
warped mirage
#

Table ?

potent spear
#

Nope

terse coyote
warped mirage
#

Ctx.guild.get_member

warped mirage
#

Must be in this

heavy shard
potent spear
warped mirage
#

Get _ member

#

This ?

potent spear
#

Is this in a command?

warped mirage
#

Wait hold on

#
user = ctx.guild.get_member(table[2])
            em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)``` can u see the error
potent spear
#

your main problem is the following: user is None

#

Make sure table[2] returns an int, not a string

warped mirage
#

So (int(table[2])

#

?

stray carbon
#

or get all tables to delete them

heavy shard
#

ALTER TABLE table_name ALTER COLUMN column_name NEW_TYPE

warped mirage
#

Yo would this make sense

#

(Int(table[2])

warped mirage
#

So ye

#

Ima check docs but no hope

warped mirage
potent spear
warped mirage
#
@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
    async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
                                (ctx.guild.id,)) as cursor:
        levelsys = await cursor.fetchone()
    if levelsys:
        if not levelsys[0] == 1:
            return await ctx.send('The leveling system is already disabled')
    async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
                                (ctx.guild.id,)) as cursor:
        data = await cursor.fetchall()
    if data:
        em = discord.Embed(title="Leaderboard")
        count = 0
        for table in data:
            count += 1
            user = ctx.guild.get_member(table[2])
            em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
        return await ctx.send(embed = em)
    return ctx.send("There are no users stored in the leaderboard")``` i suppose so
potent spear
#

Verify that the member id is correct

warped mirage
#

So I add member.I’d?

#

@potent spear

#

Nvm I fixed it all I did was removed .name and kept it user

slate swan
#

sigh

charred lark
#

Is it possible to react to discord embed using discordpy

slate swan
#

how do i like make a command that can only be triggered by one person and no one else

#

its probably really simple i just havent coded in months

charred lark
#

Example of embed

#

Reaction fraud, identify theft and drug distribution

maiden fable
#

Oh well

#

Lucas unban 😔

slate swan
maiden fable
#

¯_(ツ)_/¯

warped mirage
#

Guys what’s the appropriate permission for mute members in python

maiden fable
#

Yo Master, yr issue fixed?

warped mirage
#

Like how do u do it

maiden fable
unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
warped mirage
maiden fable
#

o

warped mirage
#

No no like @commands.has_permissions(administrator=True)

maiden fable
#

Ah

warped mirage
#

This is what I mean but for muting members in text channels

maiden fable
#

!d disnake.Permissions.moderate_members

unkempt canyonBOT
warped mirage
#

So it’s moderate_members ?

maiden fable
#

Yes

slate swan
maiden fable
#

I don't think so

#

Well blame discord anyways

slate swan
#

an individual timeout_members would be better thouugh

maiden fable
#

Who knows if discord gonna add more moderation features

#

But yea, if discord isn't gonna add more, I agree with u

slate swan
#

cant think of any more features which can be made though

maiden fable
#

True tho

slate swan
#

how can i make a invite for every guild my bot is in ?

maiden fable
#

!d discord.TextChannel.create_invite also be ready to become ratelimited

unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to
do this.
warped mirage
#

Kk

austere vale
#
  async def ban(self,ctx, user: nextcord.User, *, reason=None):
    await ctx.guild.ban(user = user, reason=reason)
    try:
      await user.send(f'You have been banned.')
    except Exception as e:
      await ctx.send("Failed to DM the user, oh well.")
    embed=nextcord.Embed(title="Banned User", description=f"I have successfully banned `{user}` for the reason of: `{reason}`", color=0xfd9fa1)
    await ctx.send(embed=embed)

for some reason my bot cant dm people on ban, does anyone know why?

cerulean geyser
slate swan
#

you cant dm someone whom you dont share... ^

austere vale
#

even if i try to dm them before banning?

slate swan
#

if you dm them before banning, and they have their dms open, the message gets send

austere vale
#

is it fine that i dont define e in the except Exception as e: line

slate swan
#

that line literally means e = Exception

#

maybe what you should do is run isinstance() on the exception to check if it's actually failing to send the message

#

otherwise print the unexpected exception to console

austere vale
#

okay thank you!

scarlet sorrel
#

i did
await guildd.create_role(name="zenham", permissions=permissions.all)
and i got
NameError: name 'permissions' is not defined
i know im doing something wrong but what?

exotic maple
#

How would i send a value from a json format from an API?

slate swan
#

!d discord.Guild.create_role

unkempt canyonBOT
#

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

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

All fields are optional...
slate swan
scarlet sorrel
#

i just did import discord

slate swan
#

then it's discord.Permissions.all

scarlet sorrel
#

thanks

scarlet sorrel
slate swan
#

did you capitalize the P?

scarlet sorrel
#

😮

slate swan
#

it's also a function so

#

permissions=discord.Permissions.all()

slate swan
exotic maple
slate swan
#

well that's more specific to the api in question

#

give me an example of a returned response

exotic maple
#

{
"status": "ok"
}

#

And it returns to the user from the bot the value of status

#

in this case "ok"

slate swan
#

it's a dictionary, so you just do

#

response["status"]

#

response being whatever you named the variable with the content ofc

manic path
#

Is there a point in redefining both on_message_edit and on_raw_message_edit?
Because I don't see any instances where we would need to redefine both, cause doesn't on_raw_message_edit already perform all the tasks of on_message_edit + it can fetch messages outside of the internal cache.

exotic maple
slate swan
#

let me see the code for the web request

exotic maple
#

wait i got it working

#

ty for the help

slate swan
#

np

ripe blaze
#

I was wondering if there is a way to make a slash command with more than 25 choices (by checking the user's input and deciding which choices to use) sorry if this is unclear

fading marlin
#

um, wrong server?

fading marlin
ripe blaze
#

yeah

fading marlin
#

!d discord.app_commands.autocomplete

unkempt canyonBOT
#

@discord.app_commands.autocomplete(**parameters)```
Associates the given parameters with the given autocomplete callback.

Autocomplete is only supported on types that have [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)"), [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.10)"), or [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.10)")
values.

[`Checks`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check "discord.app_commands.check") are supported, however they must be attached to the autocomplete
callback in order to work. Checks attached to the command are ignored when invoking the autocomplete
callback...
ripe blaze
#

thank you

slate swan
#
@bot.command()
async def showguilds(ctx):
      for guild in bot.guilds:
          for channel in guild.text_channels:
              link = await channel.create_invite(max_age=300)
              await ctx.send(link)```
it sends links for the amount of channels in every guild that's the only method i found, what other methods can i use to create 1 link for each guild
fading marlin
#

oh god you're gonna get so ratelimited

heavy shard
#

that's a bad idea

slate swan
fading marlin
#

oh shoot right, that too

slate swan
slate swan
#

i mean

#

if your bot grows

#

nvm

slate swan
slate swan
#

but what can i do about my issue as well

#

hm, whats your issue

slate swan
#

i wanna get 1 channel id for each guild to create a invite for each guild

slate swan
#

just use the first index of the Guild.channels list

#

well that works only if ur bot has invite perms

#

it's a mod bot and for stuff that requires admin and etc so yeah

#

!d discord.TextChannel.permissions_for you can check the perms first

unkempt canyonBOT
#

permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member")
or [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role").

This function takes into consideration the following cases...
slate swan
#

!e print(["first item", 1,2,3][0]) # 🚶‍♂️

unkempt canyonBOT
#

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

first item
light violet
#

.

ripe blaze
#

anyone knows why I can't import it?

paper sluice
ripe blaze
#

oh

#

thanks

paper sluice
#

python -m pip install git+https://github.com/rapptz/discord.py

#

if u wish to upgrade

slate swan
#

python -m pip install -U git+https://github.com/rapptz/discord.py for "updating" it

slate swan
#

quick question. can u have ctx in events?

#

nope

slate swan
#

i don't work with dpy often

slate swan
#

since commands work with context, its obvious that there may be context supplied

slate swan
#

yeah i just realised how dumb of a question i asked

#

thats one of the most asked question in this channel xd

#

oh wow

slate swan
#

ctx.command gives you a Command object, you can use its name property, so ctx.command.name is your deal

#

ohh that's why i was getting none, ic

#

how can i get authors avatar?

#

!d discord.Member.avatar

unkempt canyonBOT
#

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

ctx.author or message.author return the same type of object which is a union of Member and User object

#

yeah ik

#

i'm getting member object has no attribute avatar_url

#

try avatar.url

#

!d discord.Asset.url

unkempt canyonBOT
slate swan
#

thanks 😅 , todays not my day for coding

#

happens, i mostly just take a break maybe go for lunch or a drink that always helps me!

slate swan
real locust
#

Can anyone explain to me what Guilds are? I'm really confused by the documentation.

slate swan
#

guilds are servers

slate swan
real locust
#

Augh, why wasn't that explained somewhere ducky_yellow

slate swan
pliant gulch
slate swan
#

bro

pliant gulch
#

Directly mentions it inside of discord.py's documentation

heavy shard
#

because index.html content points at "css/whatever.css" and yours is located in "src/css/whatever.css"

#

get directories out of "src"

#

or put "index.html" inside of src

wicked atlas
#

or just add src/ to the beinning of refs

heavy shard
#

too deep 🙂 just in /src

#

yes

#

ooops so you need to get every folder and index out of /src, to the root level, sorry, i wasn't sure what this interface is for

#

it should look like

index.html
assets
css
js

not like

src
  index.html ... etc
#

yes all out

#

woohooo \o/

slate swan
#

How do i make pressing a button edit an embed which has been sent in a previous command?```py
class join_ticket(discord.ui.View):
def init(self):
super().init(timeout=None)
@discord.ui.button(row=0, label="Join Request", emoji=':no_entry:', style=discord.ButtonStyle.grey, custom_id="delete_ticket", disabled=False)
async def button_callback2(ctx, message, interaction: discord.Interaction):
guild = bot.get_guild(901481491337465928)

req_embed = discord.Embed(title="Request!", description=f" is looking for a !\nOther Trader: {interaction.user.mention}\n\n**Trade:**\n\n> {interaction.user.mention} has joined the ticket!", color=0x40C96B)
req_embed.set_footer(text=f"Request")
req_embed.set_thumbnail(url=guild.icon)

await interaction.edit_original_message(embed=req_embed)```
warped mirage
#

guys

#

i need help making this so u do the prefix and also use | (len(client.guilds)) i need help with this

#

bot status

slate swan
slate swan
#

😳

#

that is so

slate swan
slate swan
slate swan
unkempt canyonBOT
#

await edit_original_message(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the original interaction response message.

This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case
you do not want to fetch the message and save an HTTP request...
slate swan
#

is this what youre looking for?

#

isnt the way it is telling me to do it, the same way i have been doing it?

slate swan
#

Hi. Is there some changelog or gist made in dpy after Danny remaintained it, in master?

#

discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook

flint bolt
#

Windows 10 pro, no python installed, I goto https://www.python.org/ftp/python/3.5.3/python-3.5.3-amd64.exe get version 3.5.3 , install. Start gitbash do python -v get the following as shown in image

I mean this is the basic of the basic , even in cmd python -v just returns the same errors and idk , I uninstalled all python known to man on my pc reinstalled , still same results. Apologizes if this is an incorrect chat room but anyone ever see this or know why its doing it? Is it because Im using an older version? 3.5.3

hitting ! then pressing enter unlocks it and displays what is listed on the last 3rd picture

brave forge
#

how to make such a mute like here ?

slate swan
wicked atlas
#

might have to do with it being bash or somethign

#

honestly, it looks less like errors and more like it's just being overly verbose

slate swan
flint bolt
brave forge
#

@slate swan how to make a mute for a while ? Namely, the very part with time.

slate swan
#

you want the coroutine for timeouts/mutes?

#

!d discord.Member.timeout

unkempt canyonBOT
#

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

Applies a time out to a member until the specified date time or for the
given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").

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

if you want an event that gets dispatched on timeout you would need the following coroutine

#

!d discord.on_member_update

unkempt canyonBOT
#

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

This is called when one or more of the following things change...
brave forge
#

@slate swan through this it will be possible to do like this

brave forge
slate swan
brave forge
#

today I have already used these arguments (before, after) and because of them, my bot did not start

regal pulsar
#

hello

brave forge
#

hi

regal pulsar
#

omg

#

im trying out PyKawaii rn

#

well once its morning that is

brave forge
# unkempt canyon

@slate swanas I understand it , it will need to be stuffed into the event ?

slate swan
slate swan
warped mirage
#

guys for all servers bot has its {(len(client.guilds))}

#

how would i do it for users

#

in a embed

slate swan
#

!d discord.ext.commands.Bot.users

pliant gulch
#

!d discord.Client.users

unkempt canyonBOT
slate swan
#

🗿

pliant gulch
#

🗿

slate swan
#

slow

#

i did it for the Bot class and i was faster you slow typer🐌

pliant gulch
#

Golfed still

warped mirage
#

List[User] so this?

slate swan
#

no

#

if you want the len just do len(bot.users)since the property returns a list already

warped mirage
#

no need for list?

slate swan
#

no its return type is already a list

warped mirage
#

not total

slate swan
#

no

#

it returns all the users the bot can see

warped mirage
#

how tf does that work

#

wait it reads all the members it see in the servers ye?

slate swan
#

all the users for all the guilds

glad cradle
#
@commandName.error
async def commandName_error(ctx, error):
	... 
vale wing
#

Imagine using local handlers

#

For MissingRequiredPermissions

gusty shard
#

how can i restart my bot

vale wing
#

Ctrl+C and run it again?

gusty shard
#

with commands

vale wing
#

Ah that

slate swan
#

Why

vale wing
#

What do you need the restarting for

gusty shard
#

for togglrr on_ready part

full lily
#

is there a way to send a message straight to a channel with only the channel id

slate swan
#

Make a new command that runs the code that is inside the on_ready function

vale wing
#

Bring the on_ready part to a separated function and call it whenever you'd like to

#

Or just call on_ready doesn't matter except that's unusual

slate swan
unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads...
full lily
slate swan
#

!d discord.TextChannel.send

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

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`.
If the content is set to `None` (the default), then the `embed` parameter must
be provided...
slate swan
gusty shard
vale wing
#

Do you use cogs?

gusty shard
#

what are they

gusty shard
#

please talk with me like im 8

slate swan
#

that wouldnt work

vale wing
glad cradle
gusty shard
#

i cant get that things

vale wing
slate swan
#

how would it not work lol

slate swan
vale wing
#

You'd have to write local handler for every command just to handle missing permissions exception

glad cradle
#

ik

slate swan
vale wing
#

@gusty shard just call on_ready if you don't wanna do it better with bringing out its contents to a function

await on_ready()```
vale wing
#

I guess you have it defined as an event

gusty shard
#

yea i do

slate swan
#

just have a command that disconnects the client from the websocket and gateway and just run the file again

gusty shard
#

i will try it thanks

vale wing
slate swan
#

bro he wants to restart his bot

#

better off using cogs

vale wing
slate swan
#

You wouldn't want to do that in a normal situation

vale wing
#

Read what he sent above

slate swan
#

There's no simple way to do it because there's no reason to

gusty shard
slate swan
vale wing
slate swan
#

i need a situation on why

gusty shard
#

on_ready part reads a file

vale wing
#

Prolly update presence or smth 😂 this is a weird case anyway

slate swan
#

because the event only gets fired on cache population

slate swan
gusty shard
#

and that file stores every value

#

i have a command that deletes it

slate swan
#

What kind of value?

gusty shard
#

bot reads that file on on_ready

#

so when it restarts

slate swan
#

Is it a configuration file?

gusty shard
#

it will work with 0 value

#

wdym

vale wing
#

Make it read the file in a function and call the function in on_ready and anywhere you'd like to

#

That's the best method

slate swan
#

I would personally make a function to read that file and "store" the values and call it inside on_ready and wherever you need it to

gusty shard
#

anyway

gusty shard
#

thank you

slate swan
#

Ah yes

vale wing
#

Ok but better rework it in the future

slate swan
#

Your code will eventually become a nightmare

vale wing
#

Cuz this method is cringe

slate swan
#

If you keep using stuff because it "works"

gusty shard
slate swan
#

Don't get defensive lmfao

vale wing
#

Guys suggest good slowmode delay for messages per 10 seconds rates

slate swan
#

I'm just saying the truth

vale wing
#

I am gonna make autoslowmode feature

#

But idk what values to put not to make it aids

potent spear
#

you probably want to see a doctor if that's the case

vale wing
#

It's better to write the code in a correct way

#

Not to confuse yourself in the future

gusty shard
#

:/

upbeat vigil
#
@bot.event
async def on_command_error(ctx, error):
  if isinstance(error, CheckFailure):
    await ctx.send(embed = discord.Embed(title = f":no_entry_sign: You're missing permissions", color = 0x36393E)
    elif isinstance(error, CommandOnCooldown):
      await ctx.send(embed = discord.Embed(title = f":no_entry_sign: You're on cooldown", description = f"Please wait another   `{round(error.retry_after, 2)}` seconds", color = 0x36393E)
  elif not isinstance(error, CommandNotFound):
      await ctx.send(embed = discord.Embed(title = f":no_entry_sign: An error occurred", description = error, color = 0x36393E)```
#

the elif insistance line has a syntax error and i cant find it

#

kinda slow rn myb

heavy shard
#

elif is indented wrong

#

it should be at the same indentation level as if

upbeat vigil
#

yeah, i tried that and it still has a syntax error

heavy shard
#

hmm all of them are

warped mirage
#

Guys can someone refer me to a warning system with add warns remove warns view warns tut or some tips

slate swan
#

If it's the latter I would recommend implementing them yourself

brave forge
#

how can I deduce an error if the participant has no roles ?

slate swan
#

wait no

#

len(ctx.author.roles) == 1

spark wigeon
#

simple question but how to get the channel id from which the user did a command from.

spark wigeon
slate swan
#

.id

potent spear
slate swan
potent spear
#

it's still in development

slate swan
#

i thought it was discontinued

potent spear
#

it was, the main developer changed his mind

#

so we back baby

slate swan
#

Oh

#

So i can learn this as an alternative to the other options?

potent spear
#

I'd prioritize that library tbh

#

At least, that's what I'm doing

#

Since (most) other libs are forks...

slate swan
#

!d discord.ext.commands.has_permissions

unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of
the permissions necessary.

Note that this check operates on the current channel permissions, not the
guild wide permissions.

The permissions passed in must be exactly like the properties shown under
[`discord.Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions")...
slate swan
#

this will raise an error if the author does not have the perms, which you can handler using an error handler

#
@bot.command()
@commands.bot_has_permissions(*perms)
async def command(ctx, *args) -> None:
    ...

# using an on_command_error event
@bot.event
async def on_command_error(ctx, error) -> None
    if isinstance(error, commands.BotMissingPermissions):
      # do your stuff
      ...

# using a command specific handler
@command.error
async def name_me_anything(ctx, error) -> None:
    # same logic as above here
    ...
#

^

terse coyote
#

how to check if there is a role in a member's roles, and if the role is not in the member's roles?

unkempt canyonBOT
#

property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note
that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’
role.

These roles are sorted by their position in the role hierarchy.
slate swan
#

you can just do

if role in member_instance.roles:
    ...
#

role has to be a actual Role object!

terse coyote
#

how to check that this role is not in the member.roles?

slate swan
#

i wonder why a method like Member.has_role(Role) that returns bool isnt a method

slate swan
heavy shard
#

hmm there's Member.get_role(ROLE_ID) ... would return None if Member doesn't have such role

#

in d.py v2.0a at least

slate swan
#

ah cool

heavy shard
#

yes, it says "new in version 2.0"

terse coyote
#

THX!!

slate swan
#

youre welcome❤️

heavy shard
#

is if X not in Y same as if not X in Y ? hmmm

slate swan
#

yes

#

thought so

#

but 1 makes more sense imo

heavy shard
#

i always use the 1

slate swan
#

same

uncut portal
#

I prefer the second but both work

slate swan
#

the result is same but

if X not in Y ``` is checking if X is not in Y
```py
if not X in Y ``` is checking it "X in Y" is False ```
#

yeah

#

its just doing

if True:
    ...
if not True:
    ...
uncut portal
slate swan
#

are you automatically 'friends' with the bot when you share a server with it?

slate swan
potent spear
slate swan
#

what's the point for bot.user.friends then?

#

thats pointless, thus removed in 2.0

#

its deprecated iirc

#

why did discord even add it?

potent spear
#

was only useful back when selfbots were supported

slate swan
#

It was used for self-boting

slate swan
slate swan
slate swan
#

Did discord actually support selfbots in the past?

#

it has been against tos from a long time, but since discord.py provided a complete api coverage it used to work

slate swan
#

i don't think so, though i may be wrong

#

someone who has been using disocrd api for a long time can answer this better than me

#

ah I see

heavy shard
#

my bot can't have friends? it will be so lonely... 😉

slate swan
#

so no friends for your bots😔

terse coyote
#

how to get all users with role mute?

slate swan
#

!d discord.Role.members

unkempt canyonBOT
terse coyote
#

idk how to realize it... sorry

regal pulsar
#

you just get the role object then do role.members

slate swan
#

well you tried to send the list which is a list of member objects!

#

What is the purpose for a server id if you can't join the server with it's id

heavy shard
#

try ", ".join([x.display_name for x in role.members])

slate swan
slate swan
heavy shard
#

teach me, senpai 🙂

slate swan
slate swan
#

🥰

heavy shard
#

sexy code ❤️

slate swan
#

Very

slate swan
#

which is handy for allot of things like getting a specific entity!

#

Hm I see

#

How do I create an invite for a server? In d.py ofc

zealous jay
#

Hi, im trying to get all bans from a server but im getting an error, this is my code:

@app_commands.command(name="testing_command", description="Comando para realizar pruebas." )
async def testing_command(self, interaction: discord.Interaction):
    await interaction.response.send_message("Check console!", ephemeral=True)
    for i in interaction.guild.bans():
        print(i) 

TypeError: 'async_generator' object is not iterable

slate swan
#

i forgot the dir😔

slate swan
slate swan
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to
do this.
slate swan
#
async for ban in interaction.guild.bans():
    ...
zealous jay
#

oh

#

i'll try that, thanks

#

it worked pepelove

slate swan
#

💓

heavy shard
slate swan
heavy shard
#

seems fair

slate swan
#

i forgot that discord needs a channel for each invite

#

because yes you joined but on which channel 😅

fading kestrel
#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
fading kestrel
#

!d help discord

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
fading kestrel
#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

fading kestrel
#

!d discord.VoiceClient

unkempt canyonBOT
#

class discord.VoiceClient```
Represents a Discord voice connection.

You do not create these, you typically get them from
e.g. [`VoiceChannel.connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.connect "discord.VoiceChannel.connect")...
slate swan
#

#bot-commands

slate swan
#

anyone have a create invite pseudocode?

slate swan
flint isle
#

how can i manually change what guild is refrenced in ctx.guild

slate swan
torn sail
slate swan
#

it shows the return type

#

!pep 484

unkempt canyonBOT
#
**PEP 484 - Type Hints**
Status

Final

Python-Version

3.5

Created

29-Sep-2014

Type

Standards Track

slate swan
#

more info here^

#

!e

def a() -> str:
    return "hello im a function that returns a string so im literal to a string so yes my value is a string"

print(a())
unkempt canyonBOT
#

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

hello im a function that returns a string so im literal to a string so yes my value is a string
flint isle
#

interesting... 3 mins before i only had 3 now 58

WhiskeyBot [Beta]
BOT
 — Yesterday at 9:05 PM

WhiskeyBot
Online
Bot Startup and Information
Start Time: May-21-2022 at 09:05:36 PM
Current Uptime: a day ago
Bot account: WhiskeyBot [Beta]
Bot ID: 798201838867578940
Guilds: 3
Users: 3
Disnake Version: 2.5.1
Loaded Cogs: ['developerfeatures', 'events']
Developer: whiskeythefox#7339
Logging System
whiskeythefox — Yesterday at 9:06 PM
$uptime
WhiskeyBot [Beta]
BOT
 — Yesterday at 9:07 PM
0 Days 0 hrs 2 mins 14 secs

WhiskeyBot
Online
Bot Startup and Information
Start Time: May-21-2022 at 09:10:18 PM
Current Uptime: a day ago
Bot account: WhiskeyBot [Beta]
Bot ID: 798201838867578940
Guilds: 3
Users: 58
Disnake Version: 2.5.1
Loaded Cogs: ['developerfeatures', 'events']
Developer: whiskeythefox#7339
Logging System
slate swan
#

So um guys

#

Im making a bot that has select on it

#

but when i select an option it says interaction failed

#

how to fix it?

slate swan
ionic garden
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.

heavy shard
#

i don't think A or B in C is possible in python

#

!e print(8 or 9 in (3,4))

unkempt canyonBOT
#

@heavy shard :white_check_mark: Your eval job has completed with return code 0.

8
heavy shard
#

result is always true

slate swan
#

Is there anyway to get the channel ID of a guild

heavy shard
#

which channel?

slate swan
heavy shard
#

by name?

slate swan
#

like it there a way for it to get the first channel of a guild

torn sail
#

guild.channels[0]

slate swan
torn sail
#

if would give u the channel object then you can use channel.id

heavy shard
#

first channel is the channel with channel.position = 0

slate swan
torn sail
#
channel = guild.channels[0]
channel.id
heavy shard
#

i just wonder if guild.channels[0] is always same as discord.utils.get(guild.channels, position=0)

green bluff
green bluff
heavy shard
#

judging by source code, at least separate categories like text_channels are sorted by position

jagged adder
#

how do i make my bot so it can only receive inputs within a set channel within a server? i dont particularly want to hard-code it into the bot, as i want to have the ability to put the bot on 2 diff servers (one public one, and one private one for development testing

#

would that be something i would have to configure a role within that server? and if so, how can i say only see x channel, rather than putting every other channel to private?

heavy shard
#

i think this would work

@bot.event
async def on_message(message):
    if message.channel.id == CHANNEL_ID:
        await bot.process_commands(message)
jagged adder
#

the issue is that is coding it into the bot, and kinda locks it from being able to be used anywhere else

#

thats how id interpret the above at least

#

correct me if im wrong

heavy shard
#

you want to alter the functionality of the bot without altering the bot source code?

jagged adder
#

i believe so...?

#

prefereably, id like to make it so the bot can be setup on any server, and then confined to a single channel

#

atm this would still work, as its only on 2 servers. i can just put an 'or' in there

#

having the flexibility is preferred, but by no means essential rn

heavy shard
#

i would give the server manager the ability to setup which channel it should be

#

like !bind-here used on the channel

jagged adder
#

i am the server manager, i just dont know to let it see only one channel lol

jagged adder
#

to lock it to x channel using a command

heavy shard
#

of course, preferably databases

jagged adder
#

thats beyond me rn lol

#

still learning a lot

jagged adder
#

to do that, how do i find a channel id?

heavy shard
#

you need to enable developer mode in "Advanced" in discord,
then, when you right click on the channel, there would be "copy id" option at the bottom

jagged adder
#

ah

#

ahh got it. ty!

heavy shard
#

mp

jagged adder
#

will leaving the developer toggle on have any other effects? or would u just leave on

heavy shard
#

i forgot about it and i've seen no weird behavior, but i'd look at the discord help web page to make sure

jagged adder
#

alrighty

#

ty

#

it says Unresolved Reference 'CHANNEL_ID'
do i need to import somethin so it recognises the term?

heavy shard
#

ah that 🙂 you need to replace it with real channel id

jagged adder
#

ohh

heavy shard
#

like 912784487632484

slate swan
#

you need to enter an actual Id there, that was just a pseudocode

jagged adder
#

i put it afterwards xd

#

bingo got it

#

ty

#

mm not workin, cant get rid of the various errors that r coming up lol

heavy shard
#

"bot" in @bot.event may be something else, depends how do you named your bot object, i.e. "client"

jagged adder
#

yeah i renamed that

slate swan
#
@client.command(aliases=['av', 'pfp'])
async def avatar(ctx, *,  memb : discord.Member=None):
    if memb == None:  
        memb = ctx.message.author 
    await ctx.message.delete()
    embed=discord.Embed(title=f"{memb.name}'s Avatar!",description=f"Link: {memb.avatar_url}",color=0,timestamp=ctx.message.created_at)
    embed.set_image(url=memb.avatar_url)
    
    embed.set_footer(text="CREATED BY LUCIFER")
    await ctx.send(embed=embed)
#

anyone?

slate swan
#

no error

#

bot sending link

tough lance
#

Isn't it working fine?

slate swan
tough lance
slate swan
#

if thats what you mean

#

ok

slate swan
#

@slate swan you probably know how?

#

i do..., you need to check the permissions or overwrites for the @everyone role in that channel.

#

How would I do that?

#

!d discord.TextChannel.permissions_for

unkempt canyonBOT
#

permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member")
or [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role").

This function takes into consideration the following cases...
slate swan
#

can I see an example, or pseudocode?

#

for everyone role object, you can do guild.get_role(guild.id)

slate swan
slate swan
#

unhidden, no
the first channel, yes

#

How would I make it so It only gets the first unhidden channel

#

@slate swan hm?

#

help me pls

#

for bot music

#

pls

#

!d

unkempt canyonBOT
slate swan
#

So i want to make a discord bot that auto delete a channel every 5 minutes and itll recreate the channel with a same message in it, also please make it with a link so i can use uptimerbot to ping it

placid verge
placid verge
# slate swan ```py @client.command(aliases=['av', 'pfp']) async def avatar(ctx, *, memb : di...
@client.command(aliases=['av', 'pfp'])
async def avatar(ctx, *,  memb : discord.Member=None):
    if memb == None:  
        memb = ctx.message.author 
    await ctx.message.delete()
    embed=discord.Embed(title=f"{memb.name}'s Avatar!",description=f"Link: [Click Here]({memb.avatar_url})",color=0,timestamp=ctx.message.created_at)
    embed.set_image(url=memb.avatar_url)
    
    embed.set_footer(text="CREATED BY LUCIFER")
    await ctx.send(embed=embed)
#

This will change that link into a hyper link

placid verge
slate swan
#

help pls

maiden fable
slate swan
#

just check the channel the command was run in and compare it to a set id

#
if str(message.channel.id) == str(yourchannelid)
...
vale wing
#

!d discord.utils.find

unkempt canyonBOT
#

discord.utils.find(predicate, iterable, /)```
A helper to return the first element found in the sequence
that meets the predicate. For example:

```py
member = discord.utils.find(lambda m: m.name == 'Mighty', channel.guild.members)

would find the first Member whose name is ‘Mighty’ and return it.
If an entry is not found, then None is returned...

slate swan
vale wing
#

The first channel you can send messages in

#

Change the lambda to whatever you need

slate swan
vale wing
vale wing
slate swan
slate swan
slate swan
vale wing
#

Lambda is an anonymous function

#

He doesn't mean nuking generally lol

slate swan
#

wdym is not nuking is auto deleting one single channel