#discord-bots

1 messages · Page 695 of 1

dapper cobalt
#

Show me your code.

boreal ravine
#

Do persistent views

tiny ibex
boreal ravine
#

github

#

check the github for examples

tiny ibex
#

Ty

boreal ravine
#

👌

unkempt magnet
#

I need some help with my slash command

#

every time i use the command that happens

boreal ravine
unkempt magnet
#
@slash.slash(name="Message", description="Sending a message command.", options=[create_option(name="message", description="What the message is.", option_type=3, required=True), create_option(name="channel", description="What channel the message should be sent to.", option_type=7, required=True) ])
async def message(ctx, Message: str, channel: discord.TextChannel):
    await channel.send(Message)

is the code for the command

unkempt magnet
#

it just doesnt do the command

ruby lion
#

how to get voice verified?

boreal ravine
#

3rd party libs hurt my eyes

unkempt magnet
copper gulch
#
@client.event
async def on_ready():


    db2 = sqlite3.connect("accessbeta.db")
    cursor = db2.cursor()
    cursor.execute(
        """CREATE TABLE IF NOT EXISTS accessbeta(
        guild_id TEXT
        )
        """
    )

    print("TESTING")
@client.command()
async def grantbetaaccess(ctx):
    if ctx.author.id == 466528033638055936:
        db2 = sqlite3.connect("accessbeta.db")
        cursor = db2.cursor()
        cursor.execute("SELECT guild_id FROM accessbeta")
        result = cursor.fetchone()
        if result == None:
            sql = ("INSERT INTO accessbeta(guild_id) VALUES(?)")
            val = (ctx.guild.id)
            cursor.execute(sql,val)
            db2.commit()
            cursor.close()
            print("successful")

Im so lost xd

#

I need help with sqlite3

#
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type```
boreal ravine
#

show full tb

copper gulch
#

table:

#

and editted the code

slate swan
copper gulch
boreal ravine
#

i gave you one

#

you ignored me

copper gulch
#

I thought you meant table xd

#

oh wait

#

was that message for me 😂

boreal ravine
#

aka full error

boreal ravine
copper gulch
# boreal ravine aka full error
Ignoring exception in command grantbetaaccess:
Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/LENOVO/Desktop/Coding -Winson/Python/NotaroBotBackupCode/testing discord bot/BotTesting.py", line 52, in grantbetaaccess
    cursor.execute(sql,val)
ValueError: parameters are of unsupported type

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

Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type

boreal ravine
#

Since it's SQL relatd

copper gulch
#

ok ok

vague sundial
#

Hey is events as powerful as using commands or should I prefer commands?

boreal ravine
copper gulch
boreal ravine
#

lmao

vague sundial
boreal ravine
#

custom checks, cooldowns, unlimited arguments

boreal ravine
#

👌

copper gulch
#

annndddd one problem takes it to another xd

#
@client.event
async def on_ready():
    db2 = sqlite3.connect("accessbeta.db")
    cursor = db2.cursor()
    cursor.execute(
        """CREATE TABLE IF NOT EXISTS accessbeta(
        guild_id TEXT
        )
        """
    )

    print("TESTING")

@client.command()
async def grantbetaaccess(ctx):
    if ctx.author.id == 466528033638055936:
        db2 = sqlite3.connect("accessbeta.db")
        cursor = db2.cursor()
        cursor.execute("SELECT guild_id FROM accessbeta")
        result = cursor.fetchone()
        if result == None:
            sql = ("INSERT INTO accessbeta(guild_id) VALUES(?)")
            val = (ctx.guild.id, )
            cursor.execute(sql,val)
            db2.commit()
            cursor.close()
            print("successful")

@client.command()
async def checkifbeta(ctx):
    db2 = sqlite3.connect ("accessbeta.db")
    cursor = db2.cursor()
    cursor.execute("SELECT guild_id FROM accessbeta")
    result = cursor.fetchall()
    print(result)
    if ctx.guild.id in result:
        print("Server is in Beta")
    elif ctx.guild.id not in result:
        print("Server aint in beta")
    db2.commit()
    cursor.close()

and this aint working as I thought xd, I dont get any errors
and when I run it I get this:

[('850356901232771082',)]
Server aint in beta

table:

#

wherein it should suppose to say "server in beta" since I did the command in that discord_server
so the problem is just gonna be at the command checkifbeta

slate swan
#

!e py result = [ ("id1" , ) , ('id2',)] first_element = [ e[0] for e in result] print(first_element)

unkempt canyonBOT
#

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

['id1', 'id2']
slate swan
#

and , compare it with str(ctx.guild.id) , since its a string type data

copper gulch
slate swan
#

nah , you cant check if the guild id is in the tuple directly

#

!e py if 1234 in [(1234,)]: print('works') else: print('doesnt work')

unkempt canyonBOT
#

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

doesnt work
copper gulch
# slate swan !e ```py if 1234 in [(1234,)]: print('works') else: print('doesnt work')```

@client.command()
async def grantbetaaccess(ctx):
    if ctx.author.id == 466528033638055936:
        db2 = sqlite3.connect("accessbeta.db")
        cursor = db2.cursor()
        cursor.execute("SELECT guild_id FROM accessbeta")
        sql = ("INSERT INTO accessbeta(guild_id) VALUES(?)")
        val = (ctx.guild.id, )
        cursor.execute(sql,val)
        db2.commit()
        cursor.close()
        print("successful")

@client.command()
async def checkifbeta(ctx):
    db2 = sqlite3.connect ("accessbeta.db")
    cursor = db2.cursor()
    cursor.execute("SELECT guild_id FROM accessbeta")
    result = cursor.fetchall()
    first_element = [e[0] for e in result]
    print(first_element)
    if ctx.guild.id in first_element:
        print("Server is in Beta")
    elif ctx.guild.id not in first_element:
        print("Server aint in beta")
    db2.commit()
    cursor.close()

like this?
cause output is still
['850356901232771082', '837906907863580735']
Server aint in beta

#

wherein I messaged it in the server with that guild_id

#

table:

#

this is sqlite3 btw

slate swan
#

for both the if and elif statements

#

also , since you're just reading the database db2.commit() is not required there

copper gulch
copper gulch
slate swan
slate swan
copper gulch
#

hmmmm, ok ok THANKKK YOUUU SO MUCHHH

slate swan
#

a small sidenote , sqlite3 is blocking so it may block your script at times you perform writing or reading operations , you can use the async version of sqlite3 instead

copper gulch
slate swan
copper gulch
#

the module is still sqlite3?

slate swan
#

yeah

#

just asynchronus

copper gulch
#

no need to import anything else

slate swan
#

notice the awaits

slate swan
#

everything else remains same

copper gulch
#

omg my brainnnn

#

xd

copper gulch
# slate swan yea exactly

wait sarthak

db2 = sqlite3.connect("accessbeta.db")
    cursor = db2.cursor()
    cursor.execute(
        """CREATE TABLE IF NOT EXISTS accessbeta(
        guild_id TEXT
        )
        """
    )
``` this is at the on_ready part, hmm this without ``db2.commit()`` and ``cursor.close`` good?
#

cause the yt channel that I watched didnt really explained it well

slate swan
#

can i send a message to a user when they leave ?

maiden fable
quick gust
#

depends on their settings, and if there's still a mutual server with the bot and the user

tacit horizon
#

on_message() missing 1 required positional argument: 'message'

slate swan
tacit horizon
#
async def on_message(ctx,message):
``` this is right ?
maiden fable
#

No

#

Remove the ctx

tacit horizon
maiden fable
#

U can instead do ctx = await bot.get_context(message) inside the on_message

#

But why would u need one? Since discord,Message had most (if not all) the attrs and methods commands.Context has

manic wing
#

nah man

#

there are so many more attrs in ctx

maiden fable
#

Like?

manic wing
#

lemme count brb

tacit horizon
maiden fable
#

Don't go on the count, just tell a single attr which can't be accessed with message but can be done with ctx @manic wing

maiden fable
manic wing
maiden fable
manic wing
maiden fable
maiden fable
maiden fable
manic wing
#

what if you want to compare shit

#

idk man it can be very useful

maiden fable
manic wing
#

mate i cba to continue this convo, apologies

maiden fable
#

Well I just wanted to know your PoV, that's it pithink

vague sundial
#

Could someone explain me the usage of intents?

maiden fable
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

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

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate nymph
#
@commands.command()
    @commands.is_owner()
    async def remove_money(self,ctx,user:discord.Member,args):
        try:
            args = int(args) or "all"
            if args == "all":
                amount = await int(current_balance(ctx.author))
            else:
                amount = int(args)
        except ValueError:
            await ctx.send("The value is not an integer")
        await remove_bal(user,amount=amount)
        await ctx.send(f"Successfully removed {amount} :coin: from {user.mention}.")```
maiden fable
#

U should do args: int = "all" BTW

slate nymph
#

ohhh

cloud dawn
#

user:discord.Member lemon_pensive

slate nymph
maiden fable
maiden fable
slate nymph
# maiden fable Wym
    @commands.command()
    @commands.is_owner()
    async def remove_money(self,ctx,user:discord.Member,args:int="all"):
        try:
            if args == "all":
                amount = await int(current_balance(ctx.author))
        except ValueError:
            return await ctx.send("The value is not an integer")
        await remove_bal(user,amount=amount)
        await ctx.send(f"Successfully removed {amount} :coin: from {user.mention}.")```
#

like this?

maiden fable
#

Yea

slate nymph
#

k

slate nymph
#

prolly because it isnt an integer

#

its "all"

cloud dawn
#

Well you can't await an int

slate nymph
#

the function is async

#

i have to await the function

maiden fable
#

But u did it wrong

cloud dawn
#

Yeah but await int(current_balance(ctx.author)) this is not the right syntax.

slate nymph
#

oh-

maiden fable
#

int(await function())

cloud dawn
#
amount = int((await current_balance(ctx.author)))
slate nymph
#

ic

cloud dawn
slate nymph
#

is it a set?

cloud dawn
slate nymph
#

i get the invalid input

cloud dawn
slate nymph
#

my error handler

#

eats away the tb

cloud dawn
#

Could you print the async function and see what it returns?

slate nymph
#

print?

#

lemme remove the error handler

#

better

#

@cloud dawn


  File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 590, in transform
    return await run_converters(ctx, converter, argument, param)  # type: ignore
  File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\converter.py", line 1183, in run_converters
    return await _actual_conversion(ctx, converter, argument, param)
  File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\converter.py", line 1095, in _actual_conversion
    raise BadArgument(f'Converting to "{name}" failed for parameter "{param.name}".') from exc
discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "args".
#

here

#

(self,ctx,user:discord.Member,args:int="all")

#

is this the ryt way?

manic wing
#

you want args to be int yet you make it str

slate nymph
#

ik

#

what should i do in this case

cloud dawn
#

Make it a union

slate nymph
#

i want "all" too

#

Ok

cloud dawn
#

Are you using python 3.10?

slate nymph
#

nope

#

whats so new in 3.10?

cloud dawn
cloud dawn
slate nymph
#

i ll download 3.10

manic wing
#

you dont need to

#

it just gives access to |

slate nymph
#

whats that

cloud dawn
#

Union but faster.

slate nymph
#

oh

#

how does that work

manic wing
#

cough i knew that

cloud dawn
#

Well now it can be either a int or str.

slate nymph
#

yeah the union thing works

#

thx

#

so i installed 3.10, instead of Union what should i use and how?

cloud dawn
slate nymph
#

ohh

#

ok thanks

proven osprey
#

guys how to set an user limit in voice channel?

manic wing
#

!d discord.VoiceChannel.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 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
manic wing
#

user_limit=...

proven osprey
#

thanks

proven osprey
#

could anybody suggest me whats wrong here?

quick gust
#

indent?

proven osprey
#

yes

quick gust
proven osprey
#

didn't understand

quick gust
#

is there an error?

#

when u run the bot?

proven osprey
#

i didn't run it because i see that response is not definited

quick gust
#

un indent the lines

proven osprey
#

fixed it, thank you

slate swan
#

??

boreal ravine
#

eq typing 👀

slate swan
#

and why am Iogged into this account on mobile

#

who's eq

mental kraken
#

Timezones if the main contributors are somewhere in between UTC+2 and UTC+4 maybe that's the reason

boreal ravine
#

disnake owner

slate swan
#

😳

mental kraken
#

Oh hi there

slate swan
#

eq what's the cog's version of bot.user_command

mental kraken
#

Didn't know someone would recognize me

boreal ravine
#

commands.user_command

slate swan
#

hm

mental kraken
stray swallow
#

Does this server have any other bots other than the python bot?

slate swan
#

and it registers it but says it doesn't exist when I use it

slate swan
#

why's that🙁

mental kraken
slate swan
#

hm

#

Imma come back to bother you when I have more information about my own problem bruhkitty

#

Equenos is here?

#

Thats nice

maiden fable
#

EQ bombarded with complains

upbeat otter
#

!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.

mild raft
#

???

upbeat otter
maiden fable
#

!paste will be better than pasting here, thanks

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.

tawdry perch
#

ye, what's the error

#

yes

mild raft
#

it's don't writing in json file

#

it's from the tutorial

vague sundial
#

I am getting an attribute error when I use channel.send(). Is it not used anymore?

tawdry perch
#

channel.send is used if you got the channel obj

tawdry perch
mild raft
vague sundial
tawdry perch
#

mind to share the exact error?

slate swan
#

Send the code

slate swan
tawdry perch
#

I'm talking of the traceback it should give

vague sundial
# slate swan Send the code

@client.event
async def on_message_edit(before, after):
channel = client.get_channel(id)
await channel.send("Something changed!")

slate swan
#

You can send a msg with .send since your getting a channel obj

#
await client.get_channel(id).send("msg")
vague sundial
tawdry perch
#

wrong channel ID

maiden fable
#

the ID is wrong

slate swan
#

The channel is none

#

🕴️

boreal ravine
#

timeouts are now live

tawdry perch
#

hm?

vague sundial
#

thx everyone....it was a silly mistake

manic wing
boreal ravine
tawdry perch
#

ooh those!

#

how to get them tho?

boreal ravine
#

they should be global

maiden fable
#

Wym how to get them?

boreal ravine
#

try updating ur discord

maiden fable
#

Just click on the user and Timeout

boreal ravine
#

lmao

tawdry perch
#

how can I update discord smh

slate swan
#

Yo i got it lol

maiden fable
slate swan
#

Thats pretty cool

#

Up to a week

boreal ravine
tawdry perch
boreal ravine
#

update on ur app store

maiden fable
tawdry perch
vague sundial
maiden fable
tawdry perch
maiden fable
#

right side of search bar

#

BTW @tawdry perch have u ever used pymongo?

boreal ravine
#

i hav2

maiden fable
#

I had some doubts

tawdry perch
maiden fable
#

so first I make a client with MongoClient and if I have to upload multiple JSON's, then I can just do client[db].get_collection(...).insert_many()? @boreal ravine

tawdry perch
maiden fable
#

or I gotta commit or smth too?

maiden fable
#

it shows a green sorta button

tawdry perch
#

mind to help me out in ot, I'm dumb (pong on the channe you choice)

boreal ravine
maiden fable
maiden fable
tawdry perch
#

ends to red line

maiden fable
boreal ravine
maiden fable
#

ah

#

and after that, just insert_many?

tawdry perch
#

I don't think I have the time out here

maiden fable
#

Then could be it is rolling out slowly @tawdry perch

To prevent burden on their servers

tawdry perch
#

btw, does disnake have the endpoint for it yet

boreal ravine
maiden fable
boreal ravine
#

go on api docs maybe

tawdry perch
#

I searched the docs and no I don't think it is there. I thought it came like day ago or smth

lunar quail
#

Hey!
can I get some example use of discord.Emoji ?
Doing something like this returns an error :

    @commands.command()
    async def remove_(self, ctx, *entered_emotes):
        for i in entered_emotes:
            i = discord.Emoji(i)
            await i.delete()

something like this works btw :

    @commands.command()
    async def remove_(self, ctx, entered_emotes : discord.Emoji):
            await entered_emotes.delete()
maiden fable
#

what is the error

honest vessel
#

well one error is this

torn sail
slate swan
prisma spoke
honest vessel
#

nvrm

dire folio
#

does anyone know how to make reaction roles cause everything i try doesn't work. i get no errors too

prisma spoke
#

Can refer u the docs if u want

dire folio
#

i've tried at least 5 tutorials

#

if u want i can get the githubs for them too

prisma spoke
#

Smh why did u follow tutorials

prisma spoke
dire folio
#

i don't think all of them had but

honest vessel
#

@dire foliou want roles by clicking on emojis posted on a message?

honest vessel
#

i can give u my code

dire folio
prisma spoke
dire folio
#

i like being spoon fed

prisma spoke
prisma spoke
#

Imma be Outta this

#

Its not a thing to like upon

dire folio
prisma spoke
#

Yes u need to type hint partial emoji as well

prisma spoke
honest vessel
#

@dire folio```py
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload):
if payload.message_id == 123162581266:
if discord_helper.emoji_roles[payload.emoji.id]:
guild_id = 123456788
guild = self.bot.get_guild(guild_id)
member = payload.member
await member.add_roles(discord.utils.get(guild.roles, name=discord_helper.emoji_roles[payload.emoji.id]))

@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload):
    if payload.message_id == 123162581266:
        if discord_helper.emoji_roles[payload.emoji.id]:
            guild_id = 12345678789
            guild = self.bot.get_guild(guild_id)
            member = guild.get_member(payload.user_id)
            await member.remove_roles(discord.utils.get(guild.roles, name=discord_helper.emoji_roles[payload.emoji.id]))
slate swan
#

LOL

prisma spoke
#

Alright spoonfeeding going on here

#

Imma be Outta this

coral harness
#

hello i have a question, how can i make this?

maiden fable
#

Anyone knows this error? (PyMongo)

prisma spoke
dire folio
prisma spoke
lunar quail
slate swan
maiden fable
honest vessel
#

@coral harnesshttps://discord.com/developers/docs/interactions/message-components
https://github.com/discord/discord-interactions-python

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

GitHub

Useful tools for building interactions in Python. Contribute to discord/discord-interactions-python development by creating an account on GitHub.

prisma spoke
maiden fable
#

Sure

coral harness
#

ok thanks

maiden fable
#

Wait... It worked!

tawdry perch
#

now I have timeouts

coral harness
honest vessel
#

@dire foliou will ened to edit that code a lil bit to fit your stuff

slate swan
coral harness
#

like this

coral harness
#

not the Buttons and drop down menus

honest vessel
coral harness
#

ouh ok thanks

slate swan
#

Are you using disnake?

lunar quail
#

typehint partial emoji as well? say I firstly wanted to see if an emoji is default or not so I want to use to partialemoji and then take actions (like remove) in the guild. So I wanted to get the arguments first before typehinting and pass it onto the discord.Emoji and discord.Partialemoji
I even tried something like this lol :

    @commands.command()
    async def remove_(self, ctx, entered_emotes):
        for i in entered_emotes:
            i : discord.Emoji = i
            ...

But like before doesn't work

slate swan
#

Disnake has examples

honest vessel
prisma spoke
#

In short u need to retrace ur environment variable @maiden fable

maiden fable
#

Huh?

prisma spoke
lunar quail
#

Still does not work

slate swan
#

how do i make my bot reply something in response to a msg,
like if it sees 'Hello' in chat i want it to reply 'World!' to it.?

prisma spoke
# maiden fable Huh?

Getting [SSL: CERTIFICATE_VERIFY_FAILED] on Python 3 on MacOS?
Navigate to your Applications/Python 3.X/ folder and double click Install Certificates.command

maiden fable
#

Don't worry I found the problem and fixed it (:

lunar quail
prisma spoke
prisma spoke
slate swan
#

thanks

lunar quail
slate swan
#

oh, thanks again 🫂

lunar quail
prisma spoke
#

Ahh basically what do u wanna do? @lunar quail

lunar quail
#

Oh so

#

parse the contents of the message

#

I've already done that

prisma spoke
#

And ?

lunar quail
#

I was just in search of an easier method

#

this is what I done earlier :

def get_emote(emote):
    """Returns True if emote is animated, returns False if not animated
    Secondly returns the ID of the emote"""
    # Animated emotes : <a:name:id>
    # :foo:
    # non-animated emotes : <:name:id>
    # :bar:
    try:
        if emote[1] == "a":
            is_animated = True
        else:
            is_animated = False

        emote_id = regex.findall(r":[0-9]{1,}>", emote)
        emote_id = int(emote_id[0][1:-1])
        
        name = regex.findall(r":[a-zA-z0-9_]{2,}:", emote)
        name = name[0][1:-1]

        return is_animated, name, emote_id
    except:
        return None
#

It looked like alot of unnecessary work

#

When i looked at the docs I saw methods like name, id and is_animated available at ease

prisma spoke
#

Can't help I don't know much bout discord.Emoji rn have to refer to the docs and can't from phone atm

tacit horizon
#
if message.content == "EGGY":
        await message.add_reaction("🇪")
        await message.add_reaction("🇬")
        await message.add_reaction("🇬")
        await message.add_reaction("🇾")
```is there any 1 line way
prisma spoke
tacit horizon
prisma spoke
#

Or maybe did u Google?

lunar quail
maiden fable
#

Lxghtning do be helping

prisma spoke
prisma spoke
#

It wud give an error

#

As no emoji found

cold sonnet
maiden fable
# prisma spoke Uh?

Haha I just meant that u started helping others even when u used to ask help from others till a few days ago.. Good to hear!

prisma spoke
lunar quail
#

It looked like letters to me

late wigeon
#

does anyone know why I might be getting this error?
"await interaction.respond(content="Check dms for signup process")"): can't start new thread
do I need to do something with interaction after I respond? is it causing a unfinished thread?

tacit horizon
late wigeon
#

I'm using buttons

lunar quail
prisma spoke
prisma spoke
late wigeon
# maiden fable which lib

after a while the bot will crash cause It can't start any more threads, but I'm only using asyncio and on_events to start a sequence of interactions

maiden fable
tacit horizon
maiden fable
late wigeon
prisma spoke
late wigeon
#

that use buttons

cloud dawn
prisma spoke
tacit horizon
late wigeon
prisma spoke
#

Eevee is missing@maiden fable

maiden fable
#

Haha thanks
Soooo?

prisma spoke
#

I wanted to save that emojis gif that she sends

#

Anyways gn

maiden fable
#

Gn

lunar quail
#

Finally

#

I am back w the solution

lunar quail
# tacit horizon bru 🇪 not = e
to_letter_emoji = {
    letter : emoji for (letter, emoji) in zip(
        [chr(n) for n in range(ord("a"), ord("z") + 1)],
        [f":regional_indicator_{chr(n)}:" for n in range(ord("a"), ord("z") + 1)]
    )
}
quick gust
#

!paste dont mind, this is for me

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.

lunar quail
#

Took a bit long because I forgot dict comprehension

tacit horizon
maiden fable
quick gust
#

my problem ^

cloud dawn
#

I would also do it like this.

livid fractal
#

ok so my friend made an token grabber

#

idk where to go

#

to get help

cloud dawn
#

Well not here.

livid fractal
#

then where

quick gust
#

discord tickets

maiden fable
#

what u need help with tho @livid fractal

cloud dawn
maiden fable
lunar quail
# tacit horizon OMG why so complicated ;-;

@maiden fabledogekek
This is how you use it tho :
!e

to_letter_emoji = {
    letter : emoji for (letter, emoji) in zip(
        [chr(n) for n in range(ord("a"), ord("z") + 1)],
        [f":regional_indicator_{chr(n)}:" for n in range(ord("a"), ord("z") + 1)]
    )
}
trigger = "achxy"
for i in trigger:
    print(to_letter_emoji[i])
quick gust
maiden fable
#

I didn't see it, sorry. Lemme see @quick gust

quick gust
#

stop it

maiden fable
#

Delete it plz

quick gust
livid fractal
#

so idk im scred man

maiden fable
quick gust
#

ooh

maiden fable
#

await ctx.reply(embed=embed, view=PingRef(ctx.bot))

quick gust
#

wait, LMAO

maiden fable
#

try this (:

quick gust
#

alr

maiden fable
#

Was a simple Python Mistake haha

lunar quail
# tacit horizon BRO BROOOOOOOOOO

Heres your exact solution :

to_letter_emoji = {
    letter : emoji for (letter, emoji) in zip(
        [chr(n) for n in range(ord("a"), ord("z") + 1)],
        [f":regional_indicator_{chr(n)}:" for n in range(ord("a"), ord("z") + 1)]
    )
}
trigger = "eggy"
if message.content == trigger:
    for i in trigger:
        print(to_letter_emoji[i])
maiden fable
#

imagine spoonfeeding

quick gust
cold sonnet
#

🥣

maiden fable
maiden fable
lunar quail
torn sail
lunar quail
#

since it's a default emoji

lunar quail
torn sail
#

Oh ok

cloud dawn
#

🇱 🇴 🇱

cold sonnet
#

okay so does anybody know command ideas for a voicechannel bot

tacit horizon
cloud dawn
lunar quail
cloud dawn
#

hm

tacit horizon
#
if message.content == "e":
        to_letter_emoji = {
                            letter : emoji for (letter, emoji) in zip(
                            [chr(n) for n in range(ord("a"), ord("z") + 1)],
                            [f":regional_indicator_{chr(n)}:" for n in range(ord("a"), ord("z") + 1)])
                            }
        trigger = "eggy"
        if message.content == trigger:
            for i in trigger:
                await message.add_reaction(to_letter_emoji[i])
cold sonnet
#

indentation

tacit horizon
#
await message.add_reaction(":regional_indicator_a:")

discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
😣 😣 😣 😣 😣

tacit horizon
#

say something ;-;

proven osprey
#

what's wrong there? will be very grateful for help

cloud dawn
#

!charinfo 🇦

unkempt canyonBOT
honest vessel
#

holy shit

tacit horizon
lunar quail
#

lemme dump this onto discord and get the unicode thing myself

#

btw fyi you can add an backslash to an default discord emoji and get it's "your version"

#

idk how to explain that but

honest vessel
#

dosnt just letter add on regional_indicator_<letter_here> work?

lunar quail
#

it apparently does not work for reactions

#

so here's my solution :

#
regional_emojis = """\🇦
\🇧
\🇨
\🇩
\🇪
\🇫
\🇬
\🇭
\🇮
\🇯
\🇰
\🇱
\🇲
\🇳
\🇴
\🇵
\🇶
\🇷
\🇸
\🇹
\🇺
\🇻
\🇼
\🇽
\🇾
\🇿"""

letter_to_block = {
    letter : emoji for (letter, emoji) in zip(
        [chr(n for n in range(ord("a"), ord("z") + 1))],
        [n[1] for n in regional_emojis.splitlines()]
    )
}
honest vessel
#

oh wow that looks so overdone with zip and all 😄

quick gust
#

🥣

honest vessel
#

so cant you juse do \letter then?

lunar quail
honest vessel
#

why?

lunar quail
#

we can automate a 10 min task in 10 hrs ya know

honest vessel
#

emo = "<:regional_indicator_{}:>".format(letter.lower())

lunar quail
honest vessel
#

yeah i dont know either

#

\🇦

#

the emoji code is :regional_indicator_a:

slate swan
#
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Temporary failure in name resolution]
#

why

honest vessel
#

ur banned - nah jk i donno never had issue with discord.com ssl

#

@slate swanare u using Pythonganywhere?

slate swan
#

no

#

im just using basic discord api

tacit horizon
lunar quail
#

@tacit horizon looks like we are done

tacit horizon
lunar quail
#
def get_block(letter_input : str):
    empt_str = ""
    regional_emojis = """\🇦
\🇧
\🇨
\🇩
\🇪
\🇫
\🇬
\🇭
\🇮
\🇯
\🇰
\🇱
\🇲
\🇳
\🇴
\🇵
\🇶
\🇷
\🇸
\🇹
\🇺
\🇻
\🇼
\🇽
\🇾
\🇿"""

    letter_to_block = {
        letter : emoji for (letter, emoji) in zip(
            [chr(n) for n in range(ord("a"), ord("z") + 1)],
            [n[1] for n in regional_emojis.splitlines()]
        )
    }

    for n in letter_input:
        empt_str += letter_to_block[n]
    
    return empt_str
#

The problem is that...

#

this isn't clean

#

I will fix that tmrw

#

stopid today

tacit horizon
#

ur r OP

lunar quail
proven osprey
#

what's wrong there?

tacit horizon
#

;-;

cloud dawn
#

Functions are op trust me

lunar quail
# tacit horizon can u make it on_message pls
from discord.ext import commands

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

def get_block(letter_input : str):
    empt_str = ""
    regional_emojis = """\🇦
\🇧
\🇨
\🇩
\🇪
\🇫
\🇬
\🇭
\🇮
\🇯
\🇰
\🇱
\🇲
\🇳
\🇴
\🇵
\🇶
\🇷
\🇸
\🇹
\🇺
\🇻
\🇼
\🇽
\🇾
\🇿"""

    letter_to_block = {
        letter : emoji for (letter, emoji) in zip(
            [chr(n) for n in range(ord("a"), ord("z") + 1)],
            [n[1] for n in regional_emojis.splitlines()]
        )
    }

    for n in letter_input:
        empt_str += letter_to_block[n]
    
    return empt_str

@bot.event
async def on_ready():
    print(f"Sucessfully logged in as {bot.user}")

@bot.event
async def on_message(msg):
    trigger = "eggy"
    if msg.content == trigger:
        emoji_block = get_block(trigger)
        for each_emoji in emoji_block:
            await msg.add_reaction(each_emoji)

bot.run("TOKEN")
#

you can change eggy to any lowercase eng letter

#

even repeating ones are fine

#

like ababca

outer violet
#

Do you guys help with discord-ext-menus?

slate swan
#

just make a dictionary

lunar quail
#

with keys a,b,c,d

#

I have no idea how it'll get any simpler than that

cloud dawn
# lunar quail ```py from discord.ext import commands bot = commands.Bot(command_prefix="..") ...
def get_block(letter_input: str) -> str:
    reg_emojis = "\🇦|\🇧|\🇨|\🇩|\🇪|\🇫|\🇬|\🇭|\🇮|\🇯|\🇰|\🇱|\🇲|\🇳|\🇴|\🇵|\🇶|\🇷|\🇸|\🇹|\🇺|\🇻|\🇼|\🇽|\🇾|\🇿"

    letter_to_block = {
        letter: emoji for (letter, emoji) in zip(
            [chr(n) for n in range(ord("a"), ord("z") + 1)],
            [n[1] for n in reg_emojis.split('|')]
        )
    }
    letter_to_block[' '] = ' '
    
    return "".join([letter_to_block[n] for n in letter_input])
``` shorten function and added space so it doesn't crash.
slate swan
#
regionals = {
    'a': '🇦', 'b': '🇧',  # etc
}

# Somewhere in ur command
for letter in message.content:
    emoji = regionals.get(letter)
    if emoji is not None:
        await message.add_reaction(emoji)
lunar quail
slate swan
#

why are y'all using so many functions and methods and stuff yert

lunar quail
slate swan
#

you literally typed all the english alphabet already 💀

lunar quail
#

i didn't

slate swan
#

¯_(ツ)_/¯

lunar quail
#

It was generated with another code

lunar quail
unkempt canyonBOT
cloud dawn
#

Maby a generator with the unicode?

lunar quail
cloud dawn
lunar quail
#

I have no idea how to "get the next value" of a unicode char tho but it seemingly does have a pattern

#

(it does obv)

cloud dawn
slate swan
# lunar quail It was generated with another code
regionals = {
    'a': '🇦', 'b': '🇧', 'c': '🇨',
    'd': '🇩', 'e': '🇪', 'f': '🇫',
    'g': '🇬', 'h': '🇭', 'i': '🇮',
    'j': '🇯', 'k': '🇰', 'l': '🇱',
    'm': '🇲', 'n': '🇳', 'o': '🇴',
    'p': '🇵', 'q': '🇶', 'r': '🇷',
    's': '🇸', 't': '🇹', 'u': '🇺',
    'v': '🇻', 'w': '🇼', 'x': '🇽',
    'y': '🇾', 'z': '🇿'
}

# Somewhere in ur command
for letter in message.content:
    emoji = regionals.get(letter.lower())
    if emoji is not None:
        await message.add_reaction(emoji)
lunar quail
slate swan
#

there u go 😌

cloud dawn
lunar quail
slate swan
cloud dawn
slate swan
lunar quail
cloud dawn
lunar quail
slate swan
#

think about it, a function call takes time, the more function calls u have, the more it'll take

cloud dawn
#

Functions are just as fast, it just looks cleaner and it destroys repetitive code.

slate swan
cloud dawn
#

It's async code..??

lunar quail
slate swan
#

the function itself isn't sus

lime trench
#

hey, so im making a trace back feature, everything works fine besides when it tries inputing the key it goes as a '' string not a no '' int.

        server = ctx.guild
        letters = string.ascii_letters + string.digits
        trace_code = ''.join(random.choice(letters) for i in range(30))

        BotCache.errors[trace_code] = {'server': server.id, 'error': error}```
#

anyone know a fix?

slate swan
tacit horizon
slate swan
#

you can't concatenate a string to an int

lime trench
#

i tried taking it out but it gives an error

#

how can i fix?

slate swan
#

str(random.choice(letters))

cloud dawn
lime trench
#

hm ok lt me try

tacit horizon
lunar quail
#

Have to agree on the complexity

cloud dawn
#

i could one-line it

slate swan
#

you really don't have to go out of your way to make a simple regional emoji lookup look that complex

slate swan
#

then again, no point in making it complex or bothering with it too much

slate swan
#

?

#

if i really have to spoonfeed you that much then i'm not gonna help u any further 💀 🖐️

upbeat otter
slate swan
lime trench
#
        BotCache.errors[tc] = {'server': server.id, 'error': error}```
slate swan
lime trench
#

why coant i have the for i

#

in it

upbeat otter
slate swan
tacit horizon
lunar quail
#

your bot logs into discord with it'

tacit horizon
lunar quail
#

you can find it under discord dev portal -> bots

tacit horizon
#

i was joking

lime trench
slate swan
lunar quail
#

uh

slate swan
#

can't disagree

cloud dawn
#

I mean your name is java lol

tacit horizon
lunar quail
#

also some rare cases it doesn't like that

#

and you have to do await bot.load_command()

lime trench
#

i need it without that, sorry for being annoying

lunar quail
#

or you can avoid all that headache and use a listener

slate swan
#

can u really not even copy paste

upbeat otter
# slate swan send me the code for bot like shitmee6
import discord as disnake
import disnake as nextcord
import nextcord as discord

bot = discord.ext.commands.Bot(command_prefix="shit")

@bot.cmd;
With def as async:
    function("ping"): respond_with("shitmee6 ping is 00")
disnake.run(bot("ieidhhoao2937739r8y37736372jdhdkskw"))
tacit horizon
lime trench
#

both not working

slate swan
#

actually, i'm not gonna say anything any further, don't want any mods muting me or sum shit, and i'm not gonna help u anymore with this basic thing

slate swan
cloud dawn
lunar quail
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

01234567891011121314151617181920212223242526272829
upbeat otter
lunar quail
#

it's an cooler on_message which you don't need to load

slate swan
#

......................................................................................;

cloud dawn
#

Could we also code sexy code, cool code is pretty standard these days.

lunar quail
lime trench
#

!e print(''.join([str(random.choice(letters)) for i in range(30)]))

#

ikik

slate swan
#

do any of y'all have any good ideas for some command which can earn my members some coins? i have a game where u can collect characters that have different hp/dmg, but currently the only source of income are the daily and the fights they can do with each other with their characters, and i basically need more sus

lunar quail
unkempt canyonBOT
#

@lunar quail :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 |   File "<string>", line 2, in <listcomp>
004 | NameError: name 'letters' is not defined
lime trench
#

outside thats shyhe

cloud dawn
slate swan
cloud dawn
#

lol

slate swan
#

ig i did wrong to ask y'all then 💔

lunar quail
lime trench
#

!e

import random
letters = string.ascii_letters + string.digits
tc = ''.join([str(random.choice(letters)) for i in range(30)])
print(tc)
unkempt canyonBOT
#

@lime trench :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | NameError: name 'string' is not defined
lime trench
#

and not go in the dict as a string aka ''

slate swan
unkempt canyonBOT
#

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

03zt6sNJ4hGNSAH9d3J5OPBXg15R6I
lime trench
slate swan
slate swan
# cloud dawn What do you got so far?

only the daily command which has streaks, and from fights, although i've already said this in the message which you'd know... if... yk... you would've read it all PensiveBread

cloud dawn
#

Could you please calm down on the gifs?

slate swan
#

stop

#

<@&831776746206265384> we got a troll in here that keeps posting random gifs sus

cloud dawn
tall dust
#

!mute 718052323909173279

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1640030351:f> (59 minutes and 59 seconds).

slate swan
#

ty 😌

slate swan
tall dust
#

!ban 718052323909173279 joined just to spam

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @brazen garden permanently.

slate swan
slate swan
#

😌

lunar quail
#

also heres the code

#
import random

def random_string(char_length : int):
    empt_list = []
    stuff = [chr(n) for n in range(ord("a"), ord("z") + 1)]
    stuff += list(map(lambda x: x.upper(), stuff))
    stuff += [str(n) for n in range(0, 10)]
    for _ in range(char_length):
        empt_list.append(random.choice(stuff))
    return "".join(empt_list)

print(random_string(30))
#

!e

import random

def random_string(char_length : int):
    empt_list = []
    stuff = [chr(n) for n in range(ord("a"), ord("z") + 1)]
    stuff += list(map(lambda x: x.upper(), stuff))
    stuff += [str(n) for n in range(0, 10)]
    for _ in range(char_length):
        empt_list.append(random.choice(stuff))
    return "".join(empt_list)

print(random_string(30))
unkempt canyonBOT
#

@lunar quail :white_check_mark: Your eval job has completed with return code 0.

vQD6cl6IKuonwFEddcCheUAUOg6e2A
lunar quail
#

Also don't make secret tokens with this

#

or for anything sensitive

#

just use secrets module for anything sensitive

#

tad bit shorter :

def random_string(char_length : int):
    stuff = [chr(n) for n in range(ord("a"), ord("z") + 1)]
    stuff += list(map(lambda x: x.upper(), stuff))
    stuff += [str(n) for n in range(0, 10)]
    return "".join([random.choice(stuff) for _ in range(char_length)])
#

same thing

slate swan
#

here's even a shorter method

lunar quail
#

w strings module right?

#

yea I saw that

slate swan
#

!e ```py
import secrets

char_lenght = 18
print(secrets.token_urlsafe(char_lenght))

unkempt canyonBOT
#

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

-1qzgDfky4Ki-1uGEzH5eDSQ
fiery scarab
#

How do I use asyncio.Event to create a custom event and handle the event using on_custom_event method?

slate swan
#

how do i make it so that only a role can make a command

#

anyone

tawdry perch
#

Use @commands.has_role(roleid)

#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
tawdry perch
unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
wicked comet
#

i can't invite any bots to my server ||is this the wrong place for this kinda question?||

quaint epoch
#

This is exactly the place

quaint epoch
vale wing
#

Discord has released timeouts but I don't see the docs on it on the developer portal, are they not there yet or they won't even be supported for bots?

quaint epoch
vale wing
#

Like seems there's no timeouts

cloud dawn
unkempt canyonBOT
#

exception asyncio.TimeoutError```
The operation has exceeded the given deadline.

Important

This exception is different from the builtin [`TimeoutError`](https://docs.python.org/3/library/exceptions.html#TimeoutError "TimeoutError") exception.
vale wing
#

New discord feature

#

Won't be supported by main library as they ceased development but I could do them with API

opal skiff
#
@client.event
async def on_member_join(member):
    if member.dm_channel == None:
        await member.create_dm
    await member.dm_channel.send(embed=nextcord.Embed(description="Willkommen auf "+member.guild+"!").set_image(member.guild.icon.url))``` i dont know why the event doesnt trigger. i use nextcord
#

ok can i fix it with nextcord?

#

ok

#

ty

#

ok

#

unfortunally it still doesnt work

#

no

opal skiff
#

yes

sage otter
#

are you sure..? The only time that event wouldn’t get fired and a someone genuinely joins a server would be if they don’t have member intents.

cloud dawn
#

Disnake :)

sage otter
#

You get them enabled in your code?

opal skiff
#

wdym?

cloud dawn
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

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

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

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

opal skiff
#

ok

opal skiff
craggy cloak
#
@client.event
async def on_message(message):
  channels = client.get_channel(922437371130179584)
  await channels.add_reaction('✅')
  await channels.add_reaction('❌')

I want to make sure that when someone sends a message in channels that the bot adds a reaction but it doesn't work?

manic wing
#

you can't add a reaction to an instance of discord.TextChannel...do you mean py @client.event async def on_message(message): channel = client.get_channel(922437371130179584) if message.channel.id == channel.id: await message.add_reaction('✅') await message.add_reaction('❌')

craggy cloak
#

When i do that the bot is adding to every message that i send an reaction

manic wing
#

what messages are you trying to react to?

craggy cloak
opal skiff
#

how do i get the icon of a guild with nextcord?

cloud dawn
#

nextcord has docs right?

opal skiff
#

ik but it doesnt work

manic wing
#

ew nice docs NEXTCORD

#

wow nextcord is whack

#

yeah i aint doing that crap

opal skiff
#

i want to get the icon url in an on_member_join event thats my problem

manic wing
#

member.guild.icon_url?

#

member.guild.icon.url? who knows, nextcord is irrelevant

thin kelp
#

When I do
await (client.get_user(321675286108307456)).send("hello!")
It is saying AttributeError: 'NoneType' object has no attribute 'send'

#

Even though it is a valid user id and the bot is sharing a server with the user

manic wing
#

*dislash

thin kelp
#

had to use fetch_user

#

but why would get_user not work?

slate swan
#
    if bot.sup_role in member.roles or bot.team_role in member.roles or bot.admin_role in member.roles:
AttributeError: 'User' object has no attribute 'roles'```
#

How does this happen?

brave vessel
#

User is an object that represents the user itself, and isn't specific to a server. A discord user itself doesn't have any roles, you only attain roles in a server

#

so it's likely that member isn't an actual Member in a server, but a User in discord instead

solemn citrus
#

how do i add kick command ?

#

can anyone helpp

#
@commands.command()

@commands.has_permissions(kick_members=True)

async def kick(ctx, member: discord.Member, *, reason=None):

    await client.kick(member)

    await ctx.send(f'User {member} has been kick')```
#

does this work

wanton veldt
#

Hi i have a question I make a command and it doesn't work I get the error AttributeError: 'Member' object has no attribute 'timeout'

@client.command()
@commands.has_permissions(ban_members = True)
async def timeout(ctx, member : discord.Member, *, reason = None):
    await member.timeout(reason = reason)
``` i tryed the new timeout thing
snow flare
#

Is it possible to send ephemeral messages together with views and buttons?

north pollen
frozen jolt
#

u tryin to ban people?

wanton veldt
#

is a new thing on discord @north pollen

#

ok

#

ty

north pollen
wanton veldt
#

can you join my server for 5 m?

north pollen
#

cool, didn't knew when it was added

final iron
#

The new timeout feature is essentially a mute command

#

It also will kick people from stages/vc's and stop them from joining but most servers will usually have their muted role set up like that

#

It seems like Discord is trying to move away having people rely on bots to have a functioning server

carmine pilot
#

bc some ppl cant code basically ^

final iron
#

You'll need to use a fork if you want to use the new timeout feature

wanton veldt
#

whats a fork?

vague grove
#

how can i detect a nickname change?

junior terrace
#

fai una ricerca

vague grove
#

!d discord.on_member_update

unkempt canyonBOT
#

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

This is called when one or more of the following things change:

• nickname

• roles

• pending...
vague grove
#

mmm ty

junior terrace
#

i have an issue with this command ```py
for message in messages:
embedmsg = discord.Embed(description=f'-「{message.author.mention}」:\n {message.content}')

        await channel.send(embed=embedmsg)```
#

it is a clear command and the log of the command is this:

vague grove
#

like purge?

junior terrace
#

is there any way to make it compact in a big embed

junior terrace
vague grove
#

limit = how many messages

junior terrace
#

thats not the point of my question tho :(

vague grove
#

o

junior terrace
#

i need to know how to make the log, compact in a single embed

junior terrace
vague grove
#

well if you want to have another field you can do embedmsg.add_field(name="name", value="info", inline=True)

junior terrace
#

yeah i know that

vague grove
#

to make embed big

junior terrace
#

i guess you dont know the answer to my question

#

thanks for the help tho

vague grove
#

no, im sorry

#

np

dapper cobalt
#

Create the embed first, then start the for loop.

junior terrace
velvet tinsel
#

ok im gonna sleep night

dapper cobalt
#

For clarification, it should be like that.

embedmsg = discord.Embed()
for message in messages:
  embedmsg.add_field(name=message.author, value=message.content, inline=False)

await ctx.send(embed=embedmsg)
vague grove
#

since discord.py is degrading, are there any simular or identical alternate librarys that operate in the same way?

dapper cobalt
#

!pypi disnake

unkempt canyonBOT
vague grove
dapper cobalt
#

That's a fork of discord.py, means that it's the exact same.

junior terrace
#

now i understand loops better

#

ty

dapper cobalt
#

However, it's a maintained fork.

#

All you need to do is use disnake instead of discord.

vague grove
#

gotchaa, so when i switch my import nothing will be broken

dapper cobalt
#

E.g. disnake.Embed() and not discord.Embed().

dapper cobalt
vague grove
#

or import disnake as discord ?

dapper cobalt
#

Yes, that should work as well.

vague grove
#

cool, thanks!

dapper cobalt
velvet tinsel
dapper cobalt
#

That I love disnake.

#

I love it because its developer also created dislash, which saved me in some cases.

velvet tinsel
#

fair enough

dapper cobalt
unkempt canyonBOT
junior terrace
#

@slate swan this help channel is occupied

#

please delete these messages and open a new channel

#

oh bruh

#

i am wrong lol

dapper cobalt
junior terrace
#

ahahahah sry im bit distracted

dapper cobalt
#

!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.

torn sail
#

Should be embed=em

#

Not em=embed

dapper cobalt
#

Yes, you pass an embed kwarg.

torn sail
#

No . after keep_alive

#

You showed ur token. Regenerate it now

pliant gulch
#

Very nice, just implemented timeout to my wrapper

coral harness
#

how can i make this pattern?

modest plover
#

What do you mean?

#

Like the one where it's do it or the one above?

modest plover
#
**__do it__**
coral harness
#

ouhh

modest plover
#

Yeah

coral harness
#

ok thanks

modest plover
modest plover
#

No problem

spark wigeon
#

whats the easiest way to send an image to a discord webhook ?

sage otter
#

Through a webhook?

#

!d discord.Webhook.send

unkempt canyonBOT
#

await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.
spark wigeon
#

thank you

pliant gulch
spark wigeon
#
  data = {
            "username": f"from: {datetime}",
            "avatar_url": "url but its too long",
            "embeds": [{
                "title": f"{source}",
                "file": f"a real file location dont worry its just long"
            }]
        }```
slate swan
#

hi, i need some help to make my bot

spark wigeon
#

<@&831776746206265384>

blissful lagoon
#

!ban 900031515587645451 nazi shit

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @candid jasper permanently.

hybrid fjord
#

any libraries for the new timeout feature yet?

heavy folio
heavy folio
heavy folio
pliant gulch
#

Ah thanks for pointing that out forgot I modified my client

heavy folio
#

oh

pliant gulch
#

I need to uninstall that

heavy folio
#

ye

#

i assume this?

#

is this for the timeout feature

pliant gulch
#

Mhm just added that to my API wrapper

heavy folio
#

was it difficult

pliant gulch
#

Nope lol, super easy

heavy folio
#

if not i'll just modify dpy files

#

hmm

heavy folio
#

cool

#

only problem now is i cant find the python libs directory disintegrate

pliant gulch
heavy folio
#

oh

heavy folio
#

i might screw up stuff so better not to risk

pliant gulch
#

To explain it more, you edit it the same way you edit nicknames of a member

#

E.g requesting PATCH to the endpoint guild/guild_id/members/member_id

#

Then you just pass an isoformat timestamp inside of the data

heavy folio
#

hmm

heavy folio
pliant gulch
heavy folio
#

oh

cobalt jacinth
#

can i run fasapi and my discord bot simulatneously on my server

thick sigil
#

you cant mention in field name

brave flint
#

oh so i only can shown the winner name?

thick sigil
#

ye

brave flint
#

okie tq

thick sigil
#

You can do the same but in description instead

#

Mention will work

brave flint
#

can i send embed on dms?

#

i think yes

vague sentinel
#

what platform should I download to make a music bot

#

and what other things will I need

manic wing
brave flint
willow sorrel
#

yo
i’m making a pack opening bot
like, you open a pack and get a character
i have the packs down
all i want to do now is make the bot save what a person gets from the pack into like a database sorta thing, where if you look in your inv it’s there
does anyone know how to do that?

waxen monolith
#

You can use something like ```py
vc.play(discord.FFmpegPCMAudio(executable='C:/ffmpeg/bin/ffmpeg.exe', source='your_file.mp3'), after=lambda e: print('done', e))

to pipe audio into a voice channel defined by `vc`, but it's pretty complex @vague sentinel
slate swan
#

hello i have a problem with my bot, i try to change the prefix but dont change and have the default prefix

shadow wraith
#

after you change the prefix

slate swan
#

i tryed

shadow wraith
#

then start the bot again

waxen monolith
#

I was about to say, are you restarting your bot?

slate swan
#

yes

waxen monolith
#

interesting

shadow wraith
#

🧢

slate swan
#

same thing

slate swan
shadow wraith
#

how are you restarting the bot

slate swan
waxen monolith
#

you have to save and restart it after every change you want to apply

slate swan
slate swan
shadow wraith
slate swan
#

how i can do this

shadow wraith
#

it should be working what the fuck is happening right now

slate swan
# slate swan how i can do this

You either didnt save and restarted the bot, or you are creating multiple instances of the bot in different occasions, its up to you to fix it since u dont provide enough info for us to see the actual issue

#

bruh bruh bruh now the 2 prefixs works

#

brUUUH

shadow wraith
#

try doing commands.when_mentioned_or('#')

slate swan
#

fun

slate swan
#

… multiple instances, i was right.

shadow wraith
#

!d discord.ext.commands.when_mentioned_or

unkempt canyonBOT
#

discord.ext.commands.when_mentioned_or(*prefixes)```
A callable that implements when mentioned or other prefixes provided.

These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.

Example

```py
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
```...
slate swan