#discord-bots

1 messages ยท Page 762 of 1

slate swan
#

Loop thru bot.guilds , and check Guild.me.guild_permissions

#

in on_ready event

echo wasp
#

Right thank you how would I add it into this code?

#

Getting code

slate swan
#

use a for loop on bot.guilds and print(guild.me.guild_permissions)

green bluff
#

how do i jumble the words in the list and yes i know a is meant to be an x

#

like if i put in

#

as ds cs ls

#

it would randomize

#

and shoot out something like ds cs ls as

slate swan
#

!e py import random print(random.shuffle(['a' , 'b' , 'c']))

potent spear
#

you have a list and execute the shuffle method on it

green bluff
#

oh thank you

slate swan
green bluff
#

thank you for the help

#

no response?

echo wasp
slate swan
green bluff
#

oh

final iron
#

How is this looking?

#

btw I noticed the type in the CPU usage field

green bluff
#

isnt this a list

slate swan
#

u changed it rn

#

and send a , not x

#

!e py from random import shuffle ; a = [1,2,3] shuffle(a) print(a)

unkempt canyonBOT
#

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

[3, 1, 2]
potent spear
final iron
green bluff
#

ahh k

final iron
#

Like a dimm

potent spear
final iron
#

Thats true

potent spear
#

that's where stuff really gets interesting

echo wasp
#

That didn't work right

#

Please tell me how to run it in a cog

#

I think self has to go in front

slate swan
potent spear
slate swan
#

not guild.client

#

bruh

unkempt canyonBOT
#

property me: discord.member.Member```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
echo wasp
slate swan
#

read it

echo wasp
#

Read that. what does this code mean

#

8589934591

green bluff
#

how do i split the first two

#

and to team 1, team 2

#

like how do i split the shuffled a

#

into 2 parts

potent spear
#

that's called slicing, you should look into that

slate swan
#

use *slicing or numpy

fervent shard
green bluff
#

what would team to be 2:4?

#

team two**

final iron
#

Whats the formatting for emoji's again?

#

And can I send custom emojis in embed fields names?

slate swan
# fervent shard

add * before reason arg , or use command like +unban <user> 'long reason with full display'

slate swan
slate swan
final iron
#

Its looking like this now but the emoji is too small

#

Would that be my fault for cropping it badly?

potent spear
#

true, make it nice for people who don't know anything about hardware too

#

50% of people won't understand the RAM stick

final iron
#

So what would I do?

potent spear
#

find cool examples

final iron
#

What do you mean?

#

Look at what other bots use?

fervent shard
potent spear
final iron
#

When most people think of ram, what do they think of?

#

Thats the million dollar question

fervent shard
green bluff
#

i learnt splicing it works but how do i get rid of these annyoing brackets

slate swan
#

it should work

unkempt canyonBOT
#

join

Joins a list with a string, like Pythonโ€™s str.join(list)

For example:

{{ value|join:" // " }}
```  If `value` is the list `['a', 'b', 'c']`, the output will be the string `"a // b // c"`.
final iron
#

Turn it in to a string

fervent shard
vale wing
#

!d discord.TextChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

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

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
vale wing
#

^ overwrites kwarg check the docs for more info

glad thicket
#

hey does anyone know how to use the ctx.channel.purge() command in a cog?

#

I get an error saying that the cog has no atribute channel

final iron
slate swan
#

you probably didnt added self as the first arg

glad thicket
#

oh wait I fixed it

#

I forgot the self tag since I was rushing

slate swan
#

mhm

glad thicket
drifting arrow
#

What am I doing wrong?

async with aiosqlite.connect("notes.db") as db:
            for n in notes:
                note = notes[n]
                cur = await db.execute(
                    "INSERT INTO notes VALUES(?,?)",
                    (steamid, note),
                )
                await db.commit()
            await db.close()

sqlite3.OperationalError: database is locked D:
And no. The answer isn't 'Unlock it'

potent spear
drifting arrow
potent spear
slate swan
#

What happened
It was working alright until yesterday?

obsidian ledge
#

whats "RuntimeWarning: Enable tracemalloc to get the object allocation traceback"

drifting arrow
obsidian ledge
#

oh

drifting arrow
potent spear
# obsidian ledge oh

if you read the whole traceback, you would've known, the error isn't always on the last line

drifting arrow
#

i'll just try and run my code in a different way I guess.

potent spear
obsidian ledge
#

also why is my "get_channel" not defined

#

what do i have to import

honest shoal
#

what does 'str' object has no attribute 'channel' mean?

potent spear
potent spear
obsidian ledge
potent spear
obsidian ledge
#

kay

potent spear
#

it's a method, not an attribute!

slate swan
#

or if you dont have a guild object , you can even use bot.get_channel

potent spear
slate swan
#

mind showing your code?

potent spear
honest shoal
slate swan
#

and yeah , jishaku is really better than other bot's eval commands
( if you are actually making it by yourself then its better tho)

slate swan
honest shoal
slate swan
#

thats the reason

#

for you , the self becomes ctx and the ctx becomes body

obsidian ledge
#

how do i make the bot send a message and ping the user i mentioned

honest shoal
slate swan
honest shoal
honest shoal
slate swan
#

btw , it uses many in-class functions

#

so its suggested to use it in the cog

#

why not use jishaku though?

honest shoal
#

I just want to test it, will be shifing to jsk anyways

slate swan
#

i find it better , it has additional functions too

#

ah

slate swan
honest shoal
#

make a member parameter

obsidian ledge
#

how do i make that

green bluff
#

how do i get the name of all the people in ctx.authors voice channel

honest shoal
#

!d discord.VoiceChannel.members

unkempt canyonBOT
honest shoal
#

@green bluff^^

green bluff
#

yeah

#

so whats property,

drifting arrow
#

\o/ fixed my issue

honest shoal
#

wdym

green bluff
#

can i have an example

drifting arrow
#

I was having a db issue lol

green bluff
#

how do i make it so that it gets the id of authors channel

slate swan
#

That doesn't exist.

green bluff
#

u do this in discord dev portal dont you?

slate swan
green bluff
green bluff
slate swan
#

Whoever created the channel?

green bluff
#

nope whoever is in the channel and used the command

slate swan
#

Well you have a channel object, use the id attribute.

green bluff
slate swan
#

channel.id ;-;

green bluff
#

oh k ctx.author.get_channel.id?

slate swan
#

No, ctx.author.channel.id

green bluff
#

k thanks

slate swan
#

Or just ctx.channel.id actually.

green bluff
#

yeh sure

#

like this cause the bot doesnt give a response

honest shoal
#

what actually is channel

#

you didn't mention specific channel in code, nor its a param

green bluff
#

voice channel

honest shoal
honest shoal
green bluff
#

yez

#

yes

slate swan
#

That will give the voice channel.

green bluff
#

.id for the id? or no id needed?

slate swan
#

It's to get the channel id and nothing else, so you choose if you need it or not.

green bluff
#

yeh i dont think i do

#

now if there r 4 ppl in the voice chat can i split them into two different voice chats?

slate swan
drifting arrow
drifting arrow
slate swan
fleet sparrow
#

whats wrong here?

@client.command(pass_context=True)
async def coin(ctx, amount: int, other: discord.Member):
    other_id = str(other.id)
    if str(other.id) not in amounts:
        amounts[other_id] = 0
        _save()
    else:
        amounts[other_id] += amount
    _save()

def _save():
    with open('data.json', 'w+') as f:
        json.dump(amounts, f)```

i keep getting this error: 

``line 46 
amounts[other_id] = 0
TabError: inconsistent use of tabs and spaces in indentation``

line 46 is ``amounts[other_id] = 0``
slate swan
#

also there were many unused imports

drifting arrow
drifting arrow
#

Also depending on how big your data is, it may be best to use a database instead.

fleet sparrow
#

is empty xd

drifting arrow
#

OH! @fleet sparrow you're right!

#

he isnt passing the amounts to the _save()!

drifting arrow
#

amounts isnt being passed to the _save()

#

Unless amounts is meant to be a global variable?

fleet sparrow
drifting arrow
#

Then you need to pass the variable into the save function

fleet sparrow
#

json.dump(amounts, f)

#

?

drifting arrow
#

no

#
@client.command(pass_context=True)
async def coin(ctx, amount: int, other: discord.Member):
    other_id = str(other.id)
    if str(other.id) not in amounts: #Maybe try if not str(other.id) in amounts:
        amounts[other_id] = 0
        _save()
    else:
        amounts[other_id] += amount
    _save() #is this meant to be here? or is it meant to be tabbed 1 more time to be in the else part?
    #Maybe add amounts to save()?
def _save(): 
    with open('data.json', 'w+') as f:
        json.dump(amounts, f) #where is it getting the variable amounts from? Perhaps consider adding a parameter called amounts to def _save()?
#

Some notes

pliant gulch
#

Should also know pass_context has long been deprecated

drifting arrow
#

idk what pass_context even is xD

green bluff
#
async def clist(ctx):
    channel = ctx.author.voice.channel

    members = channel.members

    memberlist = [] 
    for member in members:
        memberlist.append(member.mention)

    random.shuffle(memberlist)
    team1 = memberlist[0:2]
    team2 = memberlist[2:4]
    embed = disnake.Embed(title='**The teams have been chosen**', colour=disnake.Colour.blue())
    embed.add_field(name="**Team 1 is**", value=f'{team1}')
    embed.add_field(name='**Team 2 is**', value=f'{team2}')
    await ctx.send(embed=embed)``` how do i move team 1 into a different vc and team 2 in another one
drifting arrow
maiden fable
green bluff
#

anyone help

#

with mycode

pliant gulch
#

At least iirc

green bluff
#

andy can u help

maiden fable
#

Ah yea, cz it can also return a custom class, right?

green bluff
#
@client.command()
async def clist(ctx):
    channel = ctx.author.voice.channel

    members = channel.members

    memberlist = [] 
    for member in members:
        memberlist.append(member.mention)

    random.shuffle(memberlist)
    team1 = memberlist[0:2]
    team2 = memberlist[2:4]
    embed = disnake.Embed(title='**The teams have been chosen**', colour=disnake.Colour.blue())
    embed.add_field(name="**Team 1 is**", value=f'{team1}')
    embed.add_field(name='**Team 2 is**', value=f'{team2}')
    await ctx.send(embed=embed)```
#

please help

#

how do i move team 1 to a seperate vc from team 2

pliant gulch
maiden fable
#

Ah, gotcha

pliant gulch
#

Then *args and **kwargs goes to this class

maiden fable
#

Yea

fleet sparrow
potent spear
#

this will ONLY work if team1 and team2 are a list of member objects, NOT member mentions

potent spear
green bluff
potent spear
#

ah, that's good Ig, then you can ignore that note

green bluff
#

wdym member obhjects not member mentions

potent spear
#

your memberlist is a list of member mentions

green bluff
#

whats a member object

#

is it the id

potent spear
#

ever went through the docs?

green bluff
#

so do i just search it up

potent spear
#

a member object is an instance of the discord.Member class

potent spear
green bluff
#

yes ik

potent spear
#

also, the command will throw an error when you invoke it when you're not in a voicechannel, handle that

#

put the last line outside of the if block

#

then everything will work again

#

correct

#

don't remove it from the event ofc, just get it out of the if block

#
if True:
  #shit
#put it here```
#

gl hf

finite fox
#

how to make discord bot

finite fox
#

i need music

potent spear
#

learn the basics first, then try to implement the things you want

finite fox
#

ok

karmic lintel
#

guys whats the error idk pls help me

import keep_alive
import os
import discord
from discord.ext import commands
from discord.ext import tasks
import asyncio
import random


bot = commands.Bot(command_prefix='?') 
@bot.event
async def on_ready():
  print('bot is ready')


@bot.command()
async def impo(ctx):
  embed = discord.Embed(title = 'Find The Impostor My Boi', description = ':redamongus: Red'                
  ':1yellow: Yellow'

  ':1black: Black'

  ':Blue: Blue', color = discord.Color.red())
  msg = await ctx.send(embed = embed)
  await msg.add_reaction(':redamongus:')
  await msg.add_reaction(':1yellow:')
  await msg.add_reaction(':1black:')
  await msg.add_reaction(':Blue:')


keep_alive.keep_alive()
bot.run(os.getenv('TOKEN'), bot=True)
karmic lintel
keen talon
slate swan
#

!e print("Hello\nWorld")

unkempt canyonBOT
#

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

001 | Hello
002 | World
karmic lintel
#

yes

slate swan
#

makes a new line

keen talon
karmic lintel
#

i know that

#

so?

slate swan
#

why arent you using it?

keen talon
slate swan
#

seems like you didnt know itpithink

karmic lintel
#

can we use in dc bots?

slate swan
#

yes

keen talon
#

Ofc LoL

karmic lintel
#

my bad sed

slate swan
#

its built ins

keen talon
slate swan
keen talon
#

So Cute emoji lol

slate swan
#

ikr best emoji

keen talon
#

๐Ÿ˜†

slate swan
karmic lintel
slate swan
#

...... Ss when

karmic lintel
#

me?

slate swan
#

Send a ss

#

Of error

#

or maybe ctrl c ctrl v with a code blockpithink

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

!spoiler

keen talon
finite fox
#

who will create bot for

slate swan
#

no one

slate swan
slate swan
slate swan
finite fox
#

dank

finite fox
karmic lintel
keen talon
unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

you got rate limited

finite fox
#

!code

keen talon
finite fox
#

bruh

karmic lintel
slate swan
karmic lintel
#

f in the chat

keen talon
slate swan
karmic lintel
slate swan
karmic lintel
#

ok

shy elm
#

@karmic lintel change it to bot.run(os.environ['TOKEN'])

shy elm
keen talon
slate swan
karmic lintel
#

it is working now i got rate limited

slate swan
#

yah no need

shy elm
slate swan
shy elm
#

Not what I thought was happening

slate swan
#

the tb says it allpithink

shy elm
#

I see it now at the bottom lol

slate swan
#

lmao

#

429 http codes are always to many requests

shy elm
#

How'd you even get that many requests?

#

Someone spam the command?

slate swan
#

so someone is making to many requests

#

hmm

#

so it will rate limit the whole ip

shy elm
#

Damn

slate swan
#

making so no user on that ip can interact with the api

karmic lintel
#

@slate swan @keen talon tysm guyz โค๏ธ

karmic lintel
#

โค๏ธ

slate swan
#

pros

keen talon
karmic lintel
#

can we use if and elif in dc bot? ..... isn't it against rules?

karmic lintel
#

โค๏ธ ty pros

slate swan
#

there built ins lol

quick gust
#

no ofc its not against the "rules"

slate swan
karmic lintel
slate swan
#

yah

#

!e

a = 1
if a == 1:
    print("true")
unkempt canyonBOT
#

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

true
karmic lintel
#

you guys and sarthak are good....and others just trolls me here lol

slate swan
karmic lintel
keen talon
slate swan
slate swan
karmic lintel
slate swan
keen talon
slate swan
karmic lintel
#

gtg bye guysss

slate swan
#

lol

#

laterrrr

#

cya

keen talon
slate swan
keen talon
slate swan
#

jk im stuck with a error in docs with sphinx

#

๐Ÿ˜”

keen talon
slate swan
#

what is the event for interaction of a button?

slate swan
keen talon
shy elm
#

Youtubedl is the thing for music correct?

slate swan
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
shy elm
slate swan
slate swan
keen talon
slate swan
unkempt canyonBOT
#

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

The callback associated with this UI item.

This can be overriden by subclasses.
heavy folio
slate swan
#

yah ytdl is against tos

keen talon
slate swan
heavy folio
#

sigh

slate swan
keen talon
#

I mean, why notpithink

slate swan
#

you have to wait for the button๐Ÿ˜”

slate swan
slate swan
heavy folio
#

on 2.0?

shy elm
keen talon
slate swan
#

!d discord.ui.View

unkempt canyonBOT
#

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

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

New in version 2.0.
heavy folio
#

bruh no

shy elm
#

Das sucky

heavy folio
#

there is such an event but not recommended...

slate swan
slate swan
slate swan
shy elm
heavy folio
#

!d discord.on_interaction

unkempt canyonBOT
#

discord.on_interaction(interaction)```
Called when an interaction happened.

This currently happens due to slash command invocations or components being used.

Warning

This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.

New in version 2.0.
slate swan
#

thats the only event afaik

keen talon
heavy folio
#

no.

slate swan
heavy folio
maiden fable
#

Facts

slate swan
shy elm
slate swan
keen talon
heavy folio
slate swan
#

nah just quit discordpithink

slate swan
maiden fable
#

It was the best
It is the best
It will be the best

slate swan
heavy folio
#

and still is the best

slate swan
maiden fable
#

what's happening

slate swan
shy elm
#

@slate swan what if I get it through Spotify instead?

slate swan
# slate swan how
@disnake.ui.button(label="Traceback", style=disnake.ButtonStyle.red)
async def callback(self, button: disnake.ui.Button, intr: disnake.MessageInteraction):
    await intr.send("msg", ephemeral=True)
    self.value = True
    self.children[0].disabled = True
    self.stop()

wheres the event๐Ÿ˜”

heavy folio
slate swan
heavy folio
#

if your on dpy 2.0

slate swan
heavy folio
#

it's different here, you subclass ui.View

slate swan
keen talon
shy elm
slate swan
#

lol

shy elm
slate swan
shy elm
#

A popular song then

keen talon
#

๐Ÿ‘

slate swan
keen talon
slate swan
#

sadly๐Ÿ˜”

slate swan
karmic lintel
#

is there any syntax like

if blah blah user clickes reaction:
  await ctx.send('blahhh')

and whoever uses command and clickes reaction bot rplies to them only not others

keen talon
#

Yes there is

slate swan
slate swan
#

but if your doing something like reaction roles or something use buttons

maiden fable
#

!d discord.on_reaction_add

unkempt canyonBOT
#

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

Note

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

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

Note

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

thats for buttons

keen talon
#

!d disnake.ui.View.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.

This is useful to override if, for example, you want to ensure that the interaction author is a given user.

The default implementation of this returns `True`.

Note

If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.View.on_error "disnake.ui.View.on_error") is called.
slate swan
#

interaction_check()

karmic lintel
keen talon
#

Nvm I read it wrong

slate swan
maiden fable
#

Ok

keen talon
drifting arrow
#

@keen talon you use that emoji a lot lol

slate swan
#

cause thats him

drifting arrow
#

I was scrolling up to find my mention and that's all i saw

slate swan
keen talon
slate swan
keen talon
#

Why wouldn't I , it's so cute

slate swan
karmic lintel
#

i just need to know checks now lol bcuz i dont know advance python a lot but basic ik so i am coming yt....ty guys once again โค๏ธ

karmic lintel
slate swan
karmic lintel
#

yeah python really easy bcuz java goes brrrrrrrrrrrrrr

slate swan
#

yeah

#

ruby go rbrbrbrbbrbrbrb

shy elm
# karmic lintel the same channel

Oh then yea do what that guy said and set up reaction role and when someone clicked it the bot sends a message @ing the user. Or use pycord and make buttons and do the same thing

slate swan
#

any fork has the View class

potent spear
shy elm
#

...

slate swan
#

!d discord.ui.View

unkempt canyonBOT
#

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

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

New in version 2.0.
shy elm
#

Disnake, pycord, etc

potent spear
#

I thought that was your question and my answer lol

slate swan
#

oh lol

shy elm
vernal osprey
#
print("hello")
slate swan
vernal osprey
#

Okay

potent spear
keen talon
shy elm
slate swan
keen talon
potent spear
karmic lintel
#

yeah checks are easy tho just simple methods lol

slate swan
shy elm
#

What would be better, using the new timeout feature or sticking with regular muting roles?

slate swan
slate swan
maiden fable
slate swan
slate swan
slate swan
shy elm
slate swan
shy elm
#

Or 2

#

Etc

slate swan
#

timeouts max i think were 28 days

shy elm
#

Plus perm mutes

slate swan
#

!d disnake.Member.timeout

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.
maiden fable
keen talon
slate swan
maiden fable
#

Btw I don't think someone will wanna mute someone for more than 28 days... Kick them instead lol

keen talon
slate swan
#

** Supports up to 28 days in the future.**pithink

slate swan
shy elm
maiden fable
#

Yea ik

slate swan
#

history*

maiden fable
#

That's what am saying

slate swan
#

is a better term

#

a history of everything

maiden fable
shy elm
keen talon
#

yeah

#

timeout is more annoying

slate swan
#

yeah

shy elm
#

But is the mute this is low in the hierarchy it won't work

#

But Ig you could add move_role to it tho

slate swan
#

timeout doesnt give you a role

shy elm
#

Not timeout

slate swan
shy elm
slate swan
#

move a role?

shy elm
#

The mute role

potent spear
#
  1. set a max limit for mute: like 1day
  2. save the mute in a db: you don't want a poor guy being muted forever because you restarted your bot
slate swan
cloud dawn
shy elm
# slate swan why

Ok say you have a member role and the mute role is below the member role. The mute role won't work because the permissions from the member role will override kt

slate swan
cloud dawn
#

Morning y'all :3

slate swan
#

3am๐Ÿ˜”

shy elm
cloud dawn
slate swan
shy elm
slate swan
shy elm
#

It won't work then

slate swan
cloud dawn
#

Just use the timeout function from discord...

slate swan
cloud dawn
#

Yeah dutch autocorrect

shy elm
slate swan
potent spear
shy elm
slate swan
#

Which Library is mostly used nowadays for discord bots?

slate swan
slate swan
unkempt canyonBOT
keen talon
#

Disnake , pycord ,

cloud dawn
#

Not pycord..

keen talon
cloud dawn
#

Pycords internals are pretty bad and no docs

keen talon
#

Disnake is best

#

๐Ÿ™‚

potent spear
#

personal preference

karmic lintel
shy elm
shy elm
#

BUT now I just muted myself and got muted even tho the role is below me

slate swan
#

yes you can add roles that are below you

karmic lintel
slate swan
karmic lintel
slate swan
karmic lintel
#

cuz its general

slate swan
karmic lintel
#

hand over to pros then

slate swan
shy elm
karmic lintel
#

see pro knows it all

shy elm
#

Someone help me with this bit bruh

#

Bot

slate swan
slate swan
#

@cloud dawn

cloud dawn
# slate swan

Seeing as we are a python server we don't really help with external build errors

slate swan
#

look at the top

#

it says it all

cloud dawn
#

But you can send over the code for us to check.

slate swan
#

INFO:

cloud dawn
#

But yeah I recommend using only one version of aiofiles

cloud dawn
#

@shy elm you okay??

cloud dawn
slate swan
shy elm
#

I need the remove thing

#

How I get the help remove

slate swan
#

wdym

cloud dawn
#

Where you set the prefix aswell

slate swan
cloud dawn
slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

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

just set it to None or subclass the help command

cloud dawn
slate swan
shy elm
cloud dawn
shy elm
slate swan
#

you starting swearing to the bot?!?!?๐Ÿ˜ญ

shy elm
slate swan
#

close is for help channels

maiden fable
#

What's happening

cloud dawn
shy elm
slate swan
devout iris
#

Can i see bot's log on discord with command or smthng?

velvet tinsel
#

hello

velvet tinsel
slate swan
maiden fable
#

let's ignore okimii

slate swan
maiden fable
slate swan
#

stop stalking mepithink

maiden fable
slate swan
#

<33

cloud dawn
#

๐Ÿคจ

slate swan
devout iris
slate swan
cloud dawn
unkempt canyonBOT
#

Source code: Lib/logging/__init__.py...

slate swan
#

!d discord.ext.commands.Bot.on_command_error

unkempt canyonBOT
#

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

The default command error handler provided by the bot.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.9)") however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for command error.
devout iris
#

i mean all errors. Syntax error, module errors etc.

slate swan
#

if thats what you mean im not sure

cloud dawn
unkempt canyonBOT
#

Source code: Lib/logging/__init__.py...

slate swan
velvet tinsel
#

!d isinstance

unkempt canyonBOT
#

isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.

Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
devout iris
#

Thx

slate swan
#

no just that

#

no instances so it will catch all exceptions

velvet tinsel
#

I mean

#

If you want to catch a particular error

cloud dawn
#

My error handler hella fancy

velvet tinsel
#

Ok

slate swan
#

my on command error

async def on_command_error(self, ctx, error):
    embed = disnake.Embed(
        title="Command Error",
        description=f"``{error}``",
        color=0xffffff,
        timestamp=datetime.datetime.utcnow())

    await ctx.send(embed=embed)
```![pithink](https://cdn.discordapp.com/emojis/652247559909277706.webp?size=128 "pithink")
slate swan
#

mines simple

cloud dawn
#
async def on_command_error(self, ctx, error):
    await ctx.send(error)
``` why bother at that point
slate swan
#

got a point

#

but i have to make it look better ofc

#

nice one panda

quick gust
#

backslashes dont work

cloud dawn
#

bad discord

slate swan
mental kraken
#

This typehint is mine though
Related to low level component interface

leaden hollow
#

does DPY support ui buttons,if yes can someone link me the docs

keen talon
#

!d disnake.logging

unkempt canyonBOT
#

disnake logs errors and debug information via the logging python module. It is strongly recommended that the logging module is configured, as no errors or warnings will be output if it is not set up. Configuration of the logging module can be as simple as:

import logging

logging.basicConfig(level=logging.INFO)
```  Placed at the start of the application. This will output the logs from disnake as well as other libraries that use the `logging` module directly to the console.

The optional `level` argument specifies what level of events to log out and can be any of `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG` and if not specified defaults to `WARNING`.
heavy radish
#
# Miniboss Channel Unlock/Lock
  @commands.Cog.listener()
  async def on_message(self, message):
    Unlock = discord.PermissionOverwrite(send_messages=True)
    Lock = discord.PermissionOverwrite(send_messages=False)
    Role = message.guild.default_role
    if message.channel.id == 814207750342705164 and message.content.lower().startswith("rpg miniboss"):
      await message.channel.set_permissions(Role, overwrite=Unlock)
      await message.channel.send(f":white_check_mark: Unlocked {message.channel.name}")
      await asyncio.sleep(1.0)
    if message.channel.permissions(Role, overwrite=Unlock):
      await message.channel.set_permissions(Role, overwrite=Lock)
      await message.channel.send(f":white_check_mark: Locked Down {message.channel.name}")

I'm trying to check if channel is locked, and if it isn't, to lock it. But Idk how to do the if command

slate swan
mental kraken
#

accidentally saw that message so I replied

#

(I know it was yesterday)

keen talon
cloud dawn
#

Big smh that we still gotta maker functions like this ```py
async def member_get_or_fetch(guild: Guild, id: int) -> Member:
return guild.get_member(id) or await guild.fetch_member(id)

slate swan
#

disnake has this built in though

#

!d disnake.Guild.get_or_fetch_member

unkempt canyonBOT
#

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

Tries to get a member from the cache by ID. If fails, it fetches the user from the API and caches it.
slate swan
#

Has an disnake.Guild.getch_member alias

cloud dawn
#

!d disnake.Guild.getch_member

unkempt canyonBOT
#

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

Tries to get a member from the cache by ID. If fails, it fetches the user from the API and caches it.
cloud dawn
#

Meh don't want to cache the user aswell

#

Other than that nice

slate swan
#

still help

#

anyoneeeeeee

maiden fable
#

What's that? Show your requirements.txt file @slate swan

unkempt canyonBOT
#

Hey @slate swan!

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

slate swan
slate swan
maiden fable
#

Wait, just edit the file to include only those modules, which u have imported

slate swan
#

oki

honest shoal
#

!d discord.Guild.owner

unkempt canyonBOT
#

property owner: Optional[discord.member.Member]```
The member that owns the guild.
fervent shard
leaden chasm
#

help same old cog error for me'

fervent shard
leaden chasm
#

no

quick gust
#

your folder is named cog not cogs

leaden chasm
#

ah

#

my mistake

#

apologies

quick gust
#

happens

heavy radish
#
# Miniboss Channel Unlock/Lock
  @commands.Cog.listener()
  async def on_message(self, message):
    Unlock = discord.PermissionOverwrite(send_messages=True)
    Lock = discord.PermissionOverwrite(send_messages=False)
    Role = message.guild.default_role
    if message.channel.id == 814207750342705164 and message.content.lower().startswith("rpg miniboss"):
      await message.channel.set_permissions(Role, overwrite=Unlock)
      await message.channel.send(f":white_check_mark: Unlocked {message.channel.name}")
      await asyncio.sleep(40.0)
    if message.channel.permissions == Unlock:
      await message.channel.set_permissions(Role, overwrite=Lock)
      await message.channel.send(f":white_check_mark: Locked Down {message.channel.name}")
``` Someone help me with the IF part. I need to check if channel is unlocked
heavy folio
#

i dont get what your trying to do

zealous dagger
#

Having a problem with selects

tawdry perch
heavy radish
#

Check if the channel is open, and if it, close it.

#

yes

zealous dagger
heavy folio
zealous dagger
heavy radish
heavy folio
unkempt canyonBOT
#
No way, Josรฉ.

No documentation found for the requested symbol.

heavy folio
#

eh

#

oh yeah

heavy radish
#

BRB

zealous dagger
#

Please help

#

I need help, me asked this question many time but didn't get the answer I want

heavy folio
#

!d discord.TextChannel.permissions_for to see if send_messages is True or not, e.g ```py
if ctx.channel.permissions_for(ctx.guild.default_role).send_messages:
print("Is unlocked")
else:
print("Is locked")

unkempt canyonBOT
#

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

This function takes into consideration the following cases...
heavy folio
#

wait actually i'll test the code to see

#

@heavy radish

river kindle
#

I'm creating a mute command, but I'm having problems even though the console has no errors. Send the message but do not change the user, here my code:

@commands.has_permissions (kick_members = True)
async def mute (ctx, member: discord.Member):
    role = discord.utils.get (ctx.guild.roles, name = "Mutato")
    guild = ctx.guild
    if role not in guild.roles:
      perms = discord.Permissions (send_messages = False)
      await guild.create_role (name = "Mutato", permissions = perms)
      await member.add_roles (role)
      await ctx.send ("** Mutato ** role created and assigned to user.")
    else:
      await member.add_roles (role)
      embed = discord.Embed (description = f "I mutato {member.mention}", color = discord.Colour.green ())
      await ctx.send (embed = embed)```
maiden fable
honest vessel
#

also when u create role, u never fetch it again to be used member.add_roles()

#

so it will try to give a role that still is None, even if it is created

river kindle
#

and how can i fix?

placid skiff
#

!d disnake.Member.timeout also consider changing to disnake and use this right there

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.
maiden fable
#

Yea

honest vessel
#

if u misstaken can u send timeout with duration 0, and it overwrites and unmutes?

#

oh set duration to None, removes it

kindred epoch
#

Hm ok, thanks

honest vessel
slate swan
#

Facts

#

Well slash commands exist , or use commands.when_mentioned as your prefix

honest vessel
#

commands.when_mentioned_or() ?

slate swan
#

nope , commands.when_mentioned , it's used to make the bot mention your prefix

#

you would be able to acess the message content if the bot was pinged in the message

honest vessel
#

ah yeah with the new shit they edit

#

aslong bot was pinged u get context

honest vessel
#

@slate swanso they basicly wants to remove all prefixes ๐Ÿ˜„

slate swan
honest vessel
#

๐Ÿ˜„

#

or ping

slate swan
#

don't think anyone would like to use mentions as prefix lol

#

Especially for Mobile users

honest vessel
#

all starts name em selfs as the bots nick

#

and same icon

cloud dawn
#
Ignoring exception in on_application_command_autocomplete
Traceback (most recent call last):
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\client.py", line 515, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1357, in on_application_command_autocomplete
    await self.process_app_command_autocompletion(interaction)
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1274, in process_app_command_autocompletion
    await slash_command._call_relevant_autocompleter(inter)
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\slash_core.py", line 537, in _call_relevant_autocompleter
    await inter.response.autocomplete(choices=choices)
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\interactions\base.py", line 978, in autocomplete
    await adapter.create_interaction_response(
  File "C:\Users\eboss\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\webhook\async_.py", line 216, in request
    raise NotFound(response, data)
disnake.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
``` any way to suppress this?
karmic lintel
#

@slate swanhey! you here! thank god
i wanna know that as randint returns random integer...is there anything that makes randreactions

honest vessel
#

randreactions?

#

random reaction to react on a msg?

cloud dawn
slate swan
honest vessel
#

^

karmic lintel
honest vessel
#

thats only guilds emojis tho

slate swan
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").
coral vessel
#

I have python but why this happen?

karmic lintel
honest vessel
#
reactionlist = ["๐Ÿ˜Š", .. etc]
reaction = random.choice(reactionlist)
karmic lintel
#

and then i click on any random reaction if its true it says hurray correct and if false it says oh no

cloud dawn
honest vessel
#

@karmic lintelhttps://github.com/python-discord/bot/blob/main/bot/exts/fun/duck_pond.py i found this the other day, maybe u can take a look at it too

GitHub

The community bot for the Python Discord community - bot/duck_pond.py at main ยท python-discord/bot

#

its basicly same, but u gonna find a duck

karmic lintel
#

ok ty โค๏ธ

#

@honest vesselif you wont mind may i dm you?.... not for this purpose

coral vessel
slate swan
zealous dagger
#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 163, in help
    label = event.component[0].label
TypeError: 'Select' object is not subscriptable

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1353, in invoke
    await super().invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Select' object is not subscriptable```
#
  await ctx.send("Testing selects for help command!",embed=embed_hm,
        components=
        [Select(placeholder="Command Category which you want to see!",
                            options=[
                                SelectOption(
                                    label="Option 1",
                                    value="option1",
                                    description="See option 1",
                                    emoji="๐Ÿ˜„" 
                                ),
                                SelectOption(
                                    label="Option 2",
                                    value="option2",
                                    description="See option 2",
                                    emoji="๐Ÿ˜„" 
                                ),
                                SelectOption(
                                    label="Option 3",
                                    value="option3",
                                    description="See option 3",
                                    emoji="๐Ÿ˜„" 
                                ),
                            ])]
                            ) 
  e1 = discord.Embed(title="embed1", description="a really exciting embed")
  e2 = discord.Embed(title="embed2", description="a really exciting embed")
  e3 = discord.Embed(title="embed3", description="a really exciting embed")

  while True:
      try:
        event = await client.wait_for("select_option", check=None)

        label = event.component[0].label

        if label == "Option 1":
          await event.respond(type=InteractionType.ChannelMessageWithSource,ephemeral=True,
                        embed=e1
                    )
        elif label == "Option 2":
          await event.respond(type=InteractionType.ChannelMessageWithSource,ephemeral=True,embed=e2)
        elif label == "Option 3":
          await event.respond(type=InteractionType.ChannelMessageWithSource,ephemeral=False,embed=e3)
#

This is my full code

#

Please help anyone

#

@trail flower helped me a lot but apparently it couldn't make it though also

#

Please help anyone

unkempt canyonBOT
#

@zealous dagger :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 25
002 |     e1 = discord.Embed(title="embed1", description="a really exciting embed")
003 | IndentationError: unexpected indent
unkempt canyonBOT
#

@zealous dagger :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     Not fine
003 |         ^^^^
004 | SyntaxError: invalid syntax
zealous dagger
coral vessel
# slate swan Did you install python with the installer provided on the website?

yes i did, before this happen i follow this tutorial, https://youtu.be/CO4BGZOuUkM

then this error appear!

Run csharp and .NET program in visual studio code on windows
Hey, guys in this video I'm going to show you how you can configure visual studio code (#vscode) to run C# program on #Windows10 OS (operating system) visual studio code C# and I'm also gonna show you how you can run two sample user input program on #vscode_csharp dotnet core in vscod...

โ–ถ Play video
slate swan
#

Looks like you just forgot to check the "add python to path" option

#

you need to either run setup again, marking that option

#

or do it manually

zealous dagger
#

@soft depot can you help bud

honest vessel
#

u can try run the full path to python.exe

#

like "C:......\python39\python.exe" "c;...\fullpath\yourscript.py"

karmic lintel
#

@slate swanheiye

brittle flume
#

I was trying make the following commands with but it is not working.

class Moderation(commands.Cog):
  def __init__(self, bot):
    self.bot = bot

  @commands.command(aliases = ['purge'])
  @commands.has_permissions(manage_messages = True)
  async def clear(self, ctx, amount = 1):
    await ctx.channel.purge(limit = amount+1)
    await ctx.send(f'{amount} number of messages have been deleted from the channel', delete_after= 5)
    
  @commands.command(aliases = ['boot'])
  @commands.has_permissions(kick_members = True)
  async def kick(self, ctx, member: discord.Member, *, reason= None):
    await member.kick(reason=reason)
    await ctx.send(f'{member.mention} have been kicked!', delete_after=15)
  
  @commands.command(aliases = ['hammer'])
  @commands.has_permissions(ban_members = True)
  async def ban(self, ctx, member: discord.Member, *, reason= None):
    await member.ban(reason=reason)
    await ctx.send(f'{member.mention} have been banned!', delete_after=15)
    
  @commands.command(aliases = ['forgive'])
  @commands.has_permissions(ban_members = True)
  async def unban(self, ctx, member):
    ban_list = await ctx.guild.bans()
    member_name, member_discriminator = member.split('#')
    for ban_entry in ban_list:
      user = ban_entry.user
      if user.name and user.discriminator == member_name and member_discriminator:
        await ctx.guild.unban(user)
        await ctx.send(f'{user.name} have been unbanned', delete_after=15)
        break

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

error:

Extension 'cog.Moderation' raised an error: TypeError: cogs must derive from Cog

heavy folio
brittle flume
#

oh yea

#

im so dum

slate swan
#

GuraSpeen Making a cog without passing bot in __init__ is fun

slim ibex
#

๐Ÿ™ƒ

zealous dagger
#

@slate swan you help

vale wing
zealous dagger
#

You helped before lso

vale wing
#

Is the issue

zealous dagger
zealous dagger
#

It is the issue

vale wing
#

Pretty sure it's not a list

zealous dagger
#

Buddy

#

I know

vale wing
#

Then why are you subscripting it

slate swan
zealous dagger
# slate swan What library do u use
import discord
import os
import discord
import random
from discord.ext import commands, tasks
from PIL import Image
import youtube_dl
from pypresence import Presence
from discord_components import Button, Select, SelectOption, ComponentsBot,DiscordComponents
from discord_interactions import InteractionType
import asyncio
from typing import Optional, Set
import time 
vale wing
#

Dpy 2.0 then?

slate swan
#

and the imports in the cog?

slate swan
#

It's view

slim ibex
#

lmao

zealous dagger
vale wing
#

Why just why ๐Ÿฅฒ

zealous dagger
#

I know only this one

#

that works without class and all

vale wing
#

The good developer is the one that is able to leave the comfort zone and search for a better solution

slate swan
vale wing
#

Class is much more convenient to use once you get used to it

slate swan
#

U don't need to learn class for using views

zealous dagger
#

I have used it before

vale wing
#

Not really ๐Ÿ˜

zealous dagger
#

The class

vale wing
#

You can put the view classes to the separated python module and then just import them

slate swan
#
           viewโ€‹ย โ€‹=โ€‹ย โ€‹Viewโ€‹() 
 โ€‹ย ย ย ย ย ย ย ย โ€‹buttonsโ€‹ย โ€‹=โ€‹ย [ 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย โ€‹Buttonโ€‹( 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹styleโ€‹=โ€‹ButtonStyleโ€‹.โ€‹urlโ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹labelโ€‹=โ€‹"Inviteย Bot"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹urlโ€‹=โ€‹ctxโ€‹.โ€‹botโ€‹.โ€‹invite_urlโ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹emojiโ€‹=โ€‹"๐Ÿ”—"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ), 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย โ€‹Buttonโ€‹( 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹styleโ€‹=โ€‹ButtonStyleโ€‹.โ€‹urlโ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹labelโ€‹=โ€‹"Vote"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹urlโ€‹=โ€‹f"https://top.gg/bot/โ€‹{โ€‹ctxโ€‹.โ€‹botโ€‹.โ€‹userโ€‹.โ€‹idโ€‹}โ€‹/vote"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹emojiโ€‹=โ€‹"๐Ÿ’™"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹disabledโ€‹=โ€‹Trueโ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ), 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย โ€‹Buttonโ€‹( 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹styleโ€‹=โ€‹ButtonStyleโ€‹.โ€‹urlโ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹labelโ€‹=โ€‹"Support"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹urlโ€‹=โ€‹f"https://discord.gg/โ€‹{โ€‹ctxโ€‹.โ€‹botโ€‹.โ€‹server_inviteโ€‹}โ€‹"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย โ€‹emojiโ€‹=โ€‹"๐Ÿ‘€"โ€‹, 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย ), 
 โ€‹ย ย ย ย ย ย ย ย ] 
 โ€‹ย ย ย ย ย ย ย ย โ€‹forโ€‹ย โ€‹buttonโ€‹ย โ€‹inโ€‹ย โ€‹buttonsโ€‹: 
 โ€‹ย ย ย ย ย ย ย ย ย ย ย ย โ€‹viewโ€‹.โ€‹add_itemโ€‹(โ€‹buttonโ€‹) 
  
 โ€‹ย ย ย ย ย ย ย ย โ€‹awaitโ€‹ย โ€‹ctxโ€‹.โ€‹replyโ€‹(โ€‹embedโ€‹=โ€‹embedโ€‹,ย โ€‹viewโ€‹=โ€‹viewโ€‹)```
zealous dagger
slate swan
#

Example

slate swan
zealous dagger
#

Just selects are causing

#

problem

#

When I try to reply them

#

@slate swan

slate swan
#

I never tried the library u r using

zealous dagger
#

Ok which one did you try

slate swan
#

What's the actual error

zealous dagger
#

I can work with

zealous dagger
slate swan
#

!PyPi Disnake

unkempt canyonBOT
zealous dagger
zealous dagger
#

@slate swan

slate swan
#

yes , without any external libraries

zealous dagger
#

Then

#

how to migrate on it

slim ibex
#

!pypi nextcord

unkempt canyonBOT
slate swan
dreamy sluice
#

How do I make a page system for displaying info through embed?

slim ibex
#

Pagination

unkempt canyonBOT
#

Hey @brittle flume!

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

heavy folio
#

!d disnake

#

oops

#

!d disnake.ui.View

unkempt canyonBOT
#

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

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

New in version 2.0.
heavy folio
#

!d disnake.ui.Select

unkempt canyonBOT
#

class disnake.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.

This is usually represented as a drop down menu.

In order to get the selected items that the user has chosen, use [`Select.values`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Select.values "disnake.ui.Select.values").

New in version 2.0.
heavy folio
#

subclass View, add select in

spring flax
#

in a cog I can have two commands.Cog.listeners() both for async def on_message(self, message) exactly the same

brittle flume
#

It is a rule command with cog

  @commands.command(aliases = ['rules'])
  async def rule(self, ctx, number=None):
    await with open("rules.txt", 'r') as f:
      rules = f.read()
      rule = f.readlines()
    if number == None:
      await ctx.send(rules)
    else:
      ruleEmbed = discord.Embed(title = f'Rule {number}', discription = f'{rule[int(number)+1]}', color =0x552E12)
      await ctx.send(embed = ruleEmbed)

Input:

.rule 4

Error:

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range
honest shoal
#

how do I load jishaku in disnake

shy elm
brittle flume
#

Ok

slate swan
#

heyy. I have this code but it gives this error. (its a server ip not mine)```python
@commands.command()
async def test(self, ctx):
r1 = requests.get(f'http://51.89.34.216:30802/players.json')
events1 = r1.json()
name = str(config['servername'])
em = nextcord.Embed(title=':green_circle: Server Is Online!', description=f"ฮ“ฮนฮฑ ฮฝฮฑ ฯƒฯ…ฮฝฮดฮตฮธฮตฮฏฯ„ฮต ฯƒฯ„ฮฟฮฝ {name}ฮ‘ฮฝฮฟฮฏฮณฮตฯ„ฮฑฮน FiveM, ฯ€ฮฑฯ„ฮฌฯ„ฮต F8 ฮบฮฑฮน ฮณฯฮฌฯ†ฮตฯ„ฮฑฮน ", color=orange, timestamp=datetime.now())
em.set_author(name=name)
em.add_field(name = 'lolo:', value= int(events1['id'])+"\n", inline = True)
await ctx.send(embed=em)

```-Command raised an exception: TypeError: list indices must be integers or slices, not str```
#

Help me(

sacred sigil
#

Command isn't working

@bot.command(aliases=["nukechannel", "channelnuke", "n"])
@commands.is_owner()
async def nuke(ctx):
    channel = ctx.channel
    author = ctx.author
    await ctx.message.delete()

    def check(m):
        return m.author == author and m.channel == channel

    await ctx.send(f"are you sure you want to delete all messages in {channel} (**y**/**n**")
    msg = await bot.wait_for("message", check=check)

    if msg == "yes" or msg == "y":
        try:
            await channel.clone(reason=f"{author} requested channel nuke")
            await channel.delete(reason=f"{author} requested channel nuke")
            await author.send(f"I nuked <#{channel.id}> for you :thumbsup:")

        except:
            channel.send("I'm missing `MANAGE_CHANNEL` perms")


    elif msg == "no" or msg == "no":
        await channel.purge(limit=2)
        await ctx.send("nuke cancelled :thumbsup:", delete_after=5)

    else:
        pass
#

anyone?

slate swan
#

not me

serene lynx
#

where is the self_bot parameter in pycord?

slate swan
#

self bot is against tos

#

So it has been deprecated

serene lynx
#

okay thanks for the information

serene lynx
#

what error?

slate swan
#

don't think someone would help u with a nuke command

sacred sigil
#

"are you sure you want to delete all messages in {channel}"

#

its nicknamed nuke cuz other verified bots call it that too

slate swan
#

Mhm makes sense

sacred sigil
#

it works by cloning the channel and deleting the last one to "purge" all messages

slate swan
#

Your issue?

sacred sigil
#

stops at the wait for

#

i type "y" and it doesn;t do anything

#

no error printed either

slate swan
#

Msg is a discord.Message object so you'd be using py if msg.content=="yes"...
Like this

#

!d discord.Message.content

unkempt canyonBOT
sacred sigil
#

ahhh

slate swan
#

Pycord is not supported in the bot , most of people here use Disnake and nextcord forks so they exist

serene lynx
sacred sigil
#

would I store it in a var?

slate swan
#

yeah , store the cloned channel in a variable , and use variable.send

sacred sigil
#

appreciate it

honest vessel
#

#help-cake help for regxp -> find banned words (advanced?)

left crater
#
@commands.has_permissions(ban_members = True)
async def ban(ctx, member :  discord.Member, *,reason=None):
    if member == None or member == ctx.message.author:
        await ctx.channel.send("You cannot ban yourself")
        return
    if reason == None:
        reason = "Being bad!"
    message = f"You have been banned from {ctx.guild.name} for {reason}"
    await member.send(message)
    await member.ban(reason=reason)
    await ctx.send(f"{member} is banned!")
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50007): Cannot send messages to this user ```
#

help

slate swan
#

Error says all.

left crater
#

it was working before idk what happened

slate swan
#

The user has private messages disabled or does not share a server with the bot.