#discord-bots

1 messages · Page 902 of 1

cold sonnet
#

now I'm starting not to understand yert

rocky trench
#

God

cold sonnet
#

so what bothers me is

slate swan
cold sonnet
#

you can't put 8 buttons in a row

#

right?

hushed galleon
#

mhm, the maximum is 5x5

cold sonnet
#

so you have to find another solution to make a chess bot

#

can't make 64 buttons

rocky trench
#

Jesus Christ

cold sonnet
hushed galleon
#

personally i use a select menu for the user to input coordinates

slate swan
#

godbless my mind

rocky trench
#

Or you make an embed with black and white squares and buttons to move something

#

But that's gonna take hours to select ur pion, and move it

cold sonnet
#

what buttons

rocky trench
hushed galleon
#

its a bit of a cumbersome design though, especially on mobile

cold sonnet
#

wth is in that select menu

rocky trench
#

@slate swan is ur issue fixed?

hushed galleon
#

maybe modal with text input would help in this?

hushed galleon
cold sonnet
#

a1 all the way to o10

hushed galleon
#

when there's >25 cells its broken up to two inputs, X then Y

sick birch
#

Doesn't discord have a chess activity you can play in VCs

hushed galleon
#

they do

cold sonnet
#

uncool

hushed galleon
#

you should make 5D chess

cold sonnet
#

so what can you make in a bot

cold sonnet
cold sonnet
#

moving time, sound, gravity and dunno shit in chess cuz fun

flat solstice
#

How do I tie a guild object to a Group?py Failed to Load Extension cogs.users ExtensionFailed: Extension 'cogs.users' raised an error: AttributeError: 'Group' object has no attribute 'guilds'in this code```py
class user(commands.Cog):
def init(self, bot):
self.bot = bot

User = app_commands.Group(name="users", description="Check User stuff.")

@User.command()
@User.guilds(guild=discord.Object(id=default_guild))
@User.describe(user="The discord user to get information for.")

def setup(bot):
bot.add_cog(user(bot))```

cold sonnet
#

what

#

what do you want to do

hushed galleon
#

i believe those two decorators should come from app_commands. i.e. @app_commands.guilds(123, 456)

flat solstice
#

okay thanks, might take another look at dannys gist

slate swan
slender perch
#

im more currious if this would work as a hypothetical, but would it be possible to make a discord bot that controls over discord bots?
i was thinking of a music bot that will control several other music bots for multi use

#

ik it would be easier to just have multiple music bots work separately, but i think the idea sounds intresting

slate swan
#

Most bots don’t respond to other bots

slender perch
#

i was thinking of a backend thing tho, like if i use a command on a bot the bought would use the token of another bot to do smth

slate swan
#

bro what

hardy yoke
#

That sounds overly complex but probably doable

slender perch
#

me wonder if idea possible cuz brain randomly think of

slate swan
#

which the admin is a bot?

slim ibex
#

it is possible most likely, but requires a large server. seems like a botnet

slender perch
slate swan
slate swan
slender perch
#

a botnet is a server controlling several infected computers
this is a discord bot that would control other discord bots via the code

slim ibex
#

generally a botnet is a malicious concept used in DDoS attacks

slender perch
#

those are nothing alike 💀

slate swan
slim ibex
#

yes it is.

#

it is a network of bots, but just not used for malicious purposes

slate swan
#

im pretty sure discord bots fall in bots

slim ibex
#

^

slender perch
#

yea, a network of infected computers used to control them via a backdoor
im saying a discord bot that uses more then 1 token to control other bots

#

the only way those are simular is the use of "bots"

slim ibex
#

it doesn't have to be malicious intent

#

that is just what they are generally used for

slender perch
#

its not a botnet, if it doesnt use other computers 💀

slate swan
slim ibex
#

bro im losing braincells rn 💀

slender perch
#

one computer that runs a script using multiple tokens is what im talking about

#

a botnet is a computer that uses several different computers to preform a task

#

not the same

slim ibex
#

that essentially means you are asking bot devs to give you their token? that will never happen..

slender perch
slim ibex
#

no shit

slate swan
slim ibex
#

but if you intend for this to reach across discord, taht would be the case

#

unless its just for your own bots.

slender perch
#

then where tf do you get the idea of asking other devs for their tokens from?

i make 1 bot that is the main one, and like 3 other bots that would be used by the main ones

slim ibex
#

and also

#

!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)
slate swan
slender perch
slim ibex
#

we said it was earlier

slate swan
slender perch
slender perch
slim ibex
#

was just tryna understand what you wanted. and I wasn't the first to bring botnet up

slim ibex
slender perch
#

and i was replying to the other guy in that topic

slender perch
slim ibex
#

!ytdl - be carefult with music bots

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)
alpine furnace
#

And then create a front end with your main bot, or something 🤷‍♂️

slim ibex
#

name the main bot Orchestrator

alpine furnace
#

It's a bit complex if you haven't any devops experience, but it's interesting

alpine furnace
slender perch
#

yea my idea for it is, it would check if each token is in a call or not, if not then it would use that bot for the command, the way to control the bot is dependent on who is in what vc with what bot and so on so on

#

its hard to explain in text, i would be better off making some sort of diagram explaining the proccess

alpine furnace
#

Yeah, I'd like to see that

slim ibex
#

^

slender perch
#

also another thing, ive been thinking about making a discord bot that changes the nickname of anyone who'se name starts with a "!" into
"poop eater"

#

idk how im gonna do that but i think it would be funny

slim ibex
#

thats like a simple command tbh

#

check if name starts with !

#

i believe there is an attribute for member name

#

if there is a function to change it, boom everyone is now poop eater

somber sky
#

im trying to make it where it says "2 weeks" i want it to be a custom message just like the reason, but if i were to do {message} twice it would put the same message

#

i want 2 different messages in 1 embed

#

idk how to explain it well

#

oo i figures out how

left crater
#

i am trying to send a list but this is what it sends

somber sky
#

nvm yall

slate swan
polar lodge
#

can I see the code please?

left crater
#

it shows up normally in the txt file

#

but when i send it does that

slate swan
left crater
# polar lodge can I see the code please?
async def polls(ctx, *, question : str = None):
    if question == None:
        return await ctx.send("What would you like to ask the people")
    else:
        with open("checkmars.txt", "r") as f:
            a = f.readlines()
        with open("xsss.txt", "r") as r:
            b = r.readlines()
        a.clear()
        quest = discord.Embed(title=None)
        quest.add_field(name=question, value=f'Asked by {ctx.author.mention}')
        a = await ctx.send(embed=quest)
        await a.add_reaction("✅")
        await a.add_reaction("❌")
        await ctx.send(a)
        await ctx.send(b)```
polar lodge
#

it looks like you have overwritten the a variable with the value of await ctx.send(embed=quest)

left crater
#

oh

#

have i used the same variable too much

#

it works

#

i used the same variable too much

modest plover
#

How do I unload and reload all extensions with Disnake?

#

I can load all of them but not reload all of them

final iron
#

Just loop through the list and DM them

#
async def your_command(..., *members: tuple[discord.Member]):
    #loop through the list
#

Not sure if it will work

modest plover
#

Water do you know if I can unload and reload all my commands with Disnake without a huge overcomplicated loop?

final iron
#

Pretty sure you have to do a loop

#

Just use a list comp and it will only be 1 line

modest plover
#

I can load all them with load_extensions but idk how to with a loop

modest plover
final iron
modest plover
#

I haven't had to use the loops to load commands tho

#

Like, idk what to loop

#

@final iron what is the loop? I don't know what to actually put into the loop

#

Also how do I make it so the only person who can see and call the command is me / the bot owner

flat solstice
#

d.py 2.0 giving me this errorpy Failed to Load Extension cogs.users ExtensionFailed: Extension 'cogs.users' raised an error: TypeError: CommandTree.add_command() missing 1 required positional argument: 'command'on this code```py
@app_commands.context_menu(name="User Info")
async def userinfo(interaction: Interaction, member: Member):
await self.userinfo(interaction, member)

def setup(bot):
bot.add_cog(user(bot))
app_commands.CommandTree.add_command(userinfo)```

slate swan
#

why my database not setup ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection showing this error

buoyant igloo
#

guys how do I trigger the CommandNotFound Error, I did sum Error handling, then the error just never happens again

slate swan
slate swan
# slate swan no

youll just pass one kwarg with a list which needs to be a list type it must be *members

#

so it will be an unknown amount of positional arguments

slate swan
buoyant igloo
sage otter
slate swan
modest plover
#

Have you got raise error in your code?

modest plover
#

Because without it, it'll silence all other errors

#

@buoyant igloo

buoyant igloo
modest plover
#

Have you got, in your code, raise error anywhere?

buoyant igloo
#

no

modest plover
#

Put that in

slim ibex
#

raise just raises an error

modest plover
#

Yeah, and it's possible that there's another error

slim ibex
#

it then stops the execution of the program

buoyant igloo
#

ye I did sum other error handling

sage otter
#

wait what

#

no it doesnt. the hell

modest plover
#

The error itself stops the command...

sage otter
#

he said program

modest plover
#

An error doesn't crash a program

slim ibex
#

it would stop the control flow

slate swan
#

if u use on_command_error it dunno stop consol

sage otter
#

Are you trying to say it’s blocking?

buoyant igloo
#

Bro now my IDE doesn’t load

#

Wait where do I put the raise error

slim ibex
sage otter
#

You said program Bruh

modest plover
#

An error in general stops the execution of the command

buoyant igloo
#

Cuz I only know how to raise Exception

slim ibex
#

!e

raise TypeError('wrong type')
unkempt canyonBOT
#

@slim ibex :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: wrong type
slim ibex
final iron
sage otter
#

not as a list

#

it will as a one string

ionic ledge
#

the token is correct and even i changed it though it is saying improper token has been passed

slate swan
#

why my database dunno connect with my codes

modest plover
#

How do I make commands not exist to anyone other than me?

hushed galleon
modest plover
#

How do I do that?

slim ibex
#

!d discord.ext.commands.is_owner

unkempt canyonBOT
#

@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.

This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").

This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
modest plover
#

Ah ok, th

final iron
modest plover
#

Ty
Does that make the command just not exist to anyone else?

buoyant igloo
slim ibex
#

you can raise the NotOwner exception if someone that isn't the bot owner tries to invoke the command

final iron
slim ibex
#

!d discord.ext.commands.NotOwner

unkempt canyonBOT
#

exception discord.ext.commands.NotOwner(message=None, *args)```
Exception raised when the message author is not the owner of the bot.

This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
sage otter
# final iron So the converter wouldn't work?

no the converter does work. The consume rest behavior isn’t normal for the asterisk operator. It converts everything after the argument before it into a single string that will be fed into the argument after it.

final iron
#

Ah

tacit glade
#

HEY

slim ibex
#

okimii

slate swan
tacit glade
#

How can I host my bot 24/7 for free

slim ibex
#

but not for freee

tacit glade
#

FREE?

slate swan
# slate swan no

youre waiting for multiple arguments which you expect all of them being tuples?

tacit glade
#

uhhh

slim ibex
#

its extremely cheap though

tacit glade
#

So how can i?

slim ibex
#

you wont get reliable free hosting

modest plover
tacit glade
slate swan
slim ibex
#

that works but you gotta take into account internet bandwidth, etc'

modest plover
#

If you have an old phone lying around, you can host a bot from that

modest plover
modest plover
#

Ok, use a pc

slim ibex
#

and you need memory and storage to host it

modest plover
#

Run the file in the background

final iron
sage otter
#

No it doesn’t

tacit glade
modest plover
#

Yeah, like moai said, there's no real free reliable hosts

sage otter
#

It hints *members as a tuple of discord.Member

slate swan
#

thats kinda weird tho

sage otter
#

tuple[tuple[discord.Member]] is what you were thinking of

slate swan
#

yeah oops

tacit glade
slate swan
#

so yeah @final iron you were correct that was my faultrooSnap

modest plover
#

They're not all too reliable

sage otter
#

@final iron either way there’s no point to having the type hint there unless you just want it. Dpy has no conversions for built-in iterables in its signature parsing.

#

Unless commands.Greedy does that

slate swan
#

yeah

final iron
sage otter
#

If you want arguments to be consumed into an iterable. Using *args is what you need. It will give you a tuple of whatever.

hushed galleon
#

doing this might get your bot caught in discord's anti-spam filter, from what ive heard
if you can, you should prefer pinging them over mass dming

slim ibex
#

or **kwargs if you want a dict/named args

slate swan
#
    for role_id in teamss:
        for member in ctx.guild.members:
            if ctx.guild.get_role(role_id) in member.roles and FO in member.roles:
                people.append(f"{member.mention} - {ctx.guild.get_role(role_id).mention}")
                lst.append(role_id)

        

    for roles in ctx.guild.roles:
        if roles in team:
            if roles.id not in lst:
                checked.append(roles.mention)
            

        

    embed2=discord.Embed(title="Unclaimed Franchises", description="\n".join(checked) or "None", color=0x2f3136)
``` why does this always input None on the embed
sage otter
unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
sage otter
#

Would it return the arguments into the values or keys

#

And how would it name them

slate swan
#

ok

slate swan
sage otter
#

I don’t think that’s meant to be used for command arguments

slim ibex
#

well generally people do things like reason as a kwarg

slate swan
slate swan
slim ibex
sage otter
#

But but but

slate swan
#

buts!

sage otter
#

How are people gonna do that tho

#

are they gonna be like

ban Jim reason="haha"

slim ibex
#

no

#

idk hopw it works

sage otter
#

then there’s no actual purpose then for **kwargs in any command arguments

slim ibex
#

but i always see like:

async def ban(member: discord.Member, *, reason=None):
  await member.ban(reason=reason)

i worded what I said above really bad sorry. it isn't really **kwargs

sage otter
#

that triggers dpys consume rest behavior for the asterisk

slim ibex
#

mhmm

sage otter
#

I’m honestly so confused.

slim ibex
#

same

slate swan
slim ibex
#

ye

slate swan
#

like a positional argument

buoyant igloo
#

For the MissingRequiredArguments error, how do I make it trigger when a command has two required arguments?

Example:

If you have a command called train with two arguments: amount and what. The MissingRequiredArgument error will be triggered if only the amount argument is not specified, but won’t if the what argument is not specified

slate swan
buoyant igloo
slate swan
boreal ravine
buoyant igloo
#

Mb my explanation was rlly bad, I meant how do I make it trigger if the first argument is not specified, but the second one is

boreal ravine
#

it already triggers though

buoyant igloo
#

I tested it, it doesn’t for me at least

slate swan
#

I would like to make a bot in which I can speak through my microphone and a Discord bot plays it in vc. I'm not too sure how to get started, any help?

desert cosmos
slate swan
desert cosmos
#

ic, then maybe something like speachrecognition to lavalink to bot would help

#

¯_(ツ)_/¯

#

i can say its not going to be easy

slate swan
desert cosmos
slate swan
#

thanks for the help

desert cosmos
#

@slate swan if you want it to play the same audio then maybe you can ditch speech recognition part

slate swan
#

its live time, so i would speak through my microphone then it sends it somewhere for the discord bot to play the audio

desert cosmos
#

yes if you don't want it to play in a computer like sound you can skip speechrecognition part

#

instead of that you should look for how to record and create opus source for audio

#

that's not how it works ig

#

a second

supple thorn
#

Just put the ids in a list and loop through them

#

Put the id in a list

#

And loop through them

desert cosmos
#
@client.command()
async def test(user: discord.User):
  for id in ("id","id","id"):
    user = client.get_user(id)
    msg = "GOSHA STAFF, the server releasing 3/18/2022, be on alert for nukes"
    await user.send(msg)
supple thorn
desert cosmos
alpine tree
#

is there a way to read embeds from bots?

slate swan
desert cosmos
#

ic

supple thorn
final iron
unkempt canyonBOT
alpine tree
final iron
#

Returns a list of discord.Embed objects

left crater
#
async def on_raw_reaction_add(payload):
    if str(payload.emoji) == "\U00002705":
        with open("checkmars.txt", "w") as b:
            b.write(str(payload.member) + "\n")
    if str(payload.emoji) == "\U0000274c":
        with open("xsss.txt", "w") as f:
            f.write(str(payload.member) + "\n")



@bot.command(name="poll")
async def polls(ctx, *, question : str = None):
    if question == None:
        return await ctx.send("What would you like to ask the people")
    else:
        with open("checkmars.txt", "r") as f:
            p = f.readlines()
        with open("xsss.txt", "r") as r:
            b = r.readlines()
        quest = discord.Embed(title=None)
        quest.add_field(name=question, value=f'Asked by {ctx.author.mention}')
        a = await ctx.send(embed=quest)
        await a.add_reaction("✅")
        await a.add_reaction("❌")
        await asyncio.sleep(10)
        await ctx.send(p)
        await ctx.send(b)```how can i make it so that it adds the user on a new line
supple thorn
final iron
#

user is None

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.

left crater
supple thorn
#

One of the ids is maybe wrong

final iron
left crater
supple thorn
#

Not

alpine tree
#
@bot.event
async def on_message(message):

    # Main Trigger
    if message.content == f'{prefix}gib':

        # Get User's nick -> styc#9662 (styc)
        caster = message.author.name

        await message.channel.send('Please give your inv list')

        # Get embed
        embeds = message.embeds
        
        # Double check for user reply
        def check(m):
            return message.author == m.author

        user_reply = await bot.wait_for('message', timeout=15.0, check=check)

        if '.inv' not in user_reply.content or '.inventory' in user_reply.content:
            embeds = message.embeds
            for embed in embeds:
                print(embed.to_dict())```
supple thorn
#

Do you have member intents on

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.

supple thorn
#

Yes

final iron
#

Also don't create commands like that

#

You should be using the commands extension

maiden fable
#

👀

left crater
#
@bot.event
async def on_raw_reaction_add(payload):
    if str(payload.emoji) == "\U00002705":
        with open("checkmars.txt", "w") as b:
            b.write(str(payload.member) + "\n")
    if str(payload.emoji) == "\U0000274c":
        with open("xsss.txt", "w") as f:
            f.write(str(payload.member) + "\n")



@bot.command(name="poll")
async def polls(ctx, *, question : str = None):
    if question == None:
        return await ctx.send("What would you like to ask the people")
    else:
        with open("checkmars.txt", "r") as f:
            p = f.readlines()
        with open("xsss.txt", "r") as r:
            b = r.readlines()
        quest = discord.Embed(title=None)
        quest.add_field(name=question, value=f'Asked by {ctx.author.mention}')
        a = await ctx.send(embed=quest)
        await a.add_reaction("✅")
        await a.add_reaction("❌")
        await asyncio.sleep(10)
        await ctx.send(p)
        await ctx.send(b)```now can someone help?
slate swan
# desert cosmos ic
message = "very uwu message"
c = [client.get_user(id).send(message) for id in [id1, id2, id3]]```
should work ig
maiden fable
#

Won't work

slate swan
#

nvm

maiden fable
#

get_user not member

slate swan
#

oh wait my bad

supple thorn
#

Lmao

#

I like how when hunter said that ashley said damn

maiden fable
desert cosmos
supple thorn
#

Can you give me the ids

slate swan
maiden fable
desert cosmos
#

yeah

maiden fable
#

Idk, either im sleepy or I forgot how to use list comps

#

Also, u didn't await it

slate swan
#

huh

maiden fable
#

Uhhh, I'mma just go away

maiden fable
slate swan
desert cosmos
#

both get_user and send need await ?

slate swan
#

only send

desert cosmos
#

then wouldn't that be a problem

slate swan
#

since any get method doesnt make any api call

desert cosmos
#

no please wait you don't have to put it in that they are both different

slate swan
#

noo, its alright user what you have rn

maiden fable
#

Just use a simple for loop at this point of confusion lemon_pensive

supple thorn
#

It is

#

It just cant find the user with the ids you gave

desert cosmos
maiden fable
#

Intents

#

Members?

slate swan
maiden fable
#

IDs. Are. Int.

#

Remove. The. Quotes.

slate swan
#

....

maiden fable
#

Me do be sleepy lemon_pensive

maiden fable
#

Tbh the thing I hate about dpy is that, discord returns the IDs in the form of strings, so why they don't allow strings lemon_pensive

maiden fable
slate swan
#

i intgers*

#

integers*

maiden fable
#

The API does accept strings too

slate swan
#

rip, everybody's in their own world nowadays

slate swan
maiden fable
#
{
  "id": "80351110224678912",
  "username": "Nelly",
  "discriminator": "1337",
  "avatar": "8342729096ea3675442027381ff50dfe",
  "verified": true,
  "email": "nelly@discord.com",
  "flags": 64,
  "banner": "06c16474723fe537c283b8efa61a30c8",
  "accent_color": 16711680,
  "premium_type": 1,
  "public_flags": 64
}
#

Discord API Payload. The ID is a str

maiden fable
#

Reacts with a different emoji when eval fails

desert cosmos
left crater
#

i put \n

maiden fable
native wedge
#

how would I make an eval command?

slate swan
maiden fable
maiden fable
unkempt canyonBOT
#

exec(object[, globals[, locals]])```
This function supports dynamic execution of Python code. *object* must be either a string or a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). [1](https://docs.python.org/3/library/functions.html#id2) If it is a code object, it is simply executed. In all cases, the code that’s executed is expected to be valid as file input (see the section [File input](https://docs.python.org/3/reference/toplevel_components.html#file-input) in the Reference Manual). Be aware that the [`nonlocal`](https://docs.python.org/3/reference/simple_stmts.html#nonlocal), [`yield`](https://docs.python.org/3/reference/simple_stmts.html#yield), and [`return`](https://docs.python.org/3/reference/simple_stmts.html#return) statements may not be used outside of function definitions even within the context of code passed to the [`exec()`](https://docs.python.org/3/library/functions.html#exec "exec") function. The return value is `None`.
supple thorn
maiden fable
#

!d eval can also be used

unkempt canyonBOT
#

eval(expression[, globals[, locals]])```
The arguments are a string and optional globals and locals. If provided, *globals* must be a dictionary. If provided, *locals* can be any mapping object.
maiden fable
#

But everyone tends to use jsk

desert cosmos
alpine tree
#

anyone has an idea on how to read bot embeds after executing a command?

desert cosmos
#

wonder if discord will throw something like too many calls

maiden fable
#

It will

slate swan
left crater
desert cosmos
left crater
#

i just want it to write it on a new line

#

how is that going to help

slate swan
#

txt files as a db hapy

slate swan
left crater
#

i am

slate swan
#

and?

left crater
#

not working

desert cosmos
#

new = [e+"\n" for e in p]
await ctx.send(new)

desert cosmos
left crater
#

ok

slate swan
maiden fable
#

Told u a solution but cool

left crater
desert cosmos
slate swan
slate swan
#

hash*

maiden fable
#

Hash*

#

You do know the word isn't funny anymore right?

#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

maiden fable
#

Smh

sage otter
maiden fable
sage otter
#

because like that premium_type thing shouldn’t exist anymore. Discord stopped giving that information about long.

#

Idk then.

maiden fable
#

Most probably the docs ain't updated

sage otter
odd prawn
boreal ravine
boreal ravine
#

you can always block people dehd

maiden fable
boreal ravine
#

🗿 right

maiden fable
slate swan
latent anchor
#

will the bot still works if i go bot.command and bot.event in the same code?

maiden fable
#

Yea

latent anchor
#

but mine dont work rn?

maiden fable
#

Lemme guess

#

U got an on_message with bot.event deco

latent anchor
#

yes

maiden fable
#

Change the deco to bot.listen()

sick birch
latent anchor
#

not bot.event?

maiden fable
#

Nope

latent anchor
#

oh ok

maiden fable
latent anchor
#

tysm

maiden fable
#

Is fine

latent anchor
#

now the bot.listen dont work

maiden fable
latent anchor
#

uh

maiden fable
latent anchor
#

oh wow

#

u know everything

sick birch
maiden fable
sick birch
#

and also client = commands.Bot(...)

#

and json-as-a-db

#

many things in regard to discord bots make me mad

maiden fable
#

I wish tutorials stop using bot.event and instead use bot.listen

#

I can bet half the tutorials don't even know what bot.event deco does lmaoo

sick birch
#

more like all of them

maiden fable
#

Indeed

#

Well what I have learnt. Seeing others help or helping others, help clear your doubts more, than just reading the docs or seeing tutorials

sick birch
#

Unfortunately these youtube tutorials point beginners in the wrong direction

maiden fable
#

Indeed

slate swan
#

I didn't found a good discord.py related tutorial yet, Carberra got some decent ones but not easy to understand for someone who just started with python

spring flax
#

anyone mind explaining what channel.overwrites_for returns?

slate swan
spring flax
#

I don't know what it's called lol

slate swan
brazen raft
spring flax
#

i thought it was overrides my bad

brazen raft
#

So you can set permissions for roles, right? You can also specify per channel exceptions for these permissions, and also specify exceptions for members in a channel

slate swan
#

yeah

swift monolith
#

for bot prefix how to add multiple

#

bot = commands.Bot(command_prefix= "mp." and "Mp." and "mP." and "MP.")

is it like this cuz this is not working

slate swan
#

add a list iirc it can accept a list

swift monolith
#

bot = commands.Bot(command_prefix= ["mp." ,"Mp." ,"mP." ,"MP."])
like this

slate swan
#

yes

maiden fable
slate swan
maiden fable
#

It do be down for maintenance the last time i used (had to use the read only version)

placid geode
#

hello there!

import discord
from discord.ext import commands

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

@bot.event
async def on_ready():
    print('Bot is online')

@bot.command(name='poopy')
async def ping(ctx):
    await ctx.send('droopy')

bot.run('urmom')```
Is anything wrong in the code cuz the bot's isn't responding
slate swan
#

the command should be invoked as .poopy

maiden fable
jolly basalt
#

Im trying to list all available commands. This works but it shows commands in an odd way

#

I want it to be like

1. viewblacklist
2. changeprefix
3. examplecommand

etc

slate swan
#

Use the join statement

#

"\n".join(commands)

oblique cobalt
slate swan
#

ah , you want the number too

placid geode
slate swan
oblique cobalt
#

yes i did

slate swan
#

fields won't work there.

oblique cobalt
#

it will work lmao

jolly basalt
slate swan
#

Huh?

oblique cobalt
#

just inline off, add dot to name thing

#

and you got what he needs

slate swan
#

it will show up as ```
1
command1

2
command 2

oblique cobalt
#

well yeah join then ig

inner epoch
#

Hey guys how do I know if my bot was tagged in the message and retrieve message content

slate swan
#

!e ```py
list_cmds= ["ping", "pong"]
var = ""
index = 1
for cmd in range(len(list_cmds)-1):
var+= f"{index}. {cmd}"
index+=1
print(var)

maiden fable
unkempt canyonBOT
slate swan
#

Um

jolly basalt
#

How to know who clicked a reaction generated by a bot

slate swan
#

Oh wait

maiden fable
#

if bot.user.mentioned_in(message):
. . .

jolly basalt
#

like how does the python bot know when I click that 🗑️ icon

oblique cobalt
#

range is gonna do the work

inner epoch
maiden fable
slate swan
#

!e ```py
list_cmds= ["ping", "pong"]
var = ""
index = 1
for cmd in range(len(list_cmds)):
var+= f"{index}. {list_cmds[cmd]}\n"
index+=1
print(var)

oblique cobalt
#

why just not enumerate ? 🤔

inner epoch
#

I just want it like when the bot is tagged and a word is said it sends back something

slate swan
#

Like this

slate swan
#

with "reaction_add" as the event

jolly basalt
inner epoch
#

How do I use async def on_message(message) to know if my bot was tagged and if it was then retrieve its message

#

Can some1 explain with an example

slate swan
#
if Bot.user in Message.mentions```
jolly basalt
inner epoch
#

Aye let me try that

jolly basalt
#

can you please send an example

slate swan
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
inner epoch
hot sparrow
#

how do i keep a bot up all the time?

sick birch
inner epoch
sick birch
#

No please don't

inner epoch
sick birch
#

Replit and heroku are amongst the worst

inner epoch
#

I dont use it now as I have vps but peeps can atleast start from there

sick birch
#

See here for more info: #discord-bots message
tl;dr, replit was meant for running quick test apps or code snippets, not for extended applications that need to be on 24/7

inner epoch
sick birch
inner epoch
# sick birch What do you mean?

Well see every1 on here is not old enough to have cc to verify for aws and other free trials so they can use heroku or replit till then

sick birch
#

I suppose you could but it's honestly terrible

inner epoch
drifting arrow
#

Whats max amount of characters in a discord embed?

sick birch
#

2000

drifting arrow
#

Does that include the title and all that?

inner epoch
drifting arrow
#

Ty @sick birch 🙂

sick birch
#

discord.Embed objects have a __len__ function to check the size to make sure it's sendable

#
e = discord.Embed(...)
if len(e) < 2000:
  # send embed
else:
  # oops, too big 
sick birch
jolly basalt
#

How do I get unicode of emojis like this

inner epoch
supple thorn
inner epoch
supple thorn
slate swan
#

how would a server be free seems fishy

inner epoch
sick birch
inner epoch
supple thorn
#

It's not a long time way to have a vps

sick birch
#

Services such as AWS, google cloud hosting, and microsoft azure are all industry standard and provide high quality services to use

supple thorn
#

They offer it so they can get more known

sick birch
inner epoch
inner epoch
inner epoch
sick birch
#

Many popular and demanding services use them, so obviously they need to be high standards

supple thorn
#

They are pretty generous to the vps specs they give

sick birch
#

I'm assuming it's a startup?

supple thorn
sick birch
#

Yeah

supple thorn
#

I don't think so i just found them recently but i got told it's been operating for years

sick birch
#

Looks like they're just trying to advertise themselves

inner epoch
sick birch
#

Understandable, to each their own

inner epoch
supple thorn
sick birch
inner epoch
#

Oracle free tier offers like 24gb ram,4core cpu and 48 gb storage I have been using it for a while and havent faced any issues

inner epoch
#

I dont use it for hosting my major sites or script but its handy

sick birch
#

Meh I'm satisfied with the aws suite of services

inner epoch
#

For hosting main sites always prefer paid ones

inner epoch
sick birch
#

I need a domain and to host a site for a project I'm working on so it's nicer to keep everything in once place

green bluff
#

why cant i open my bot database file

inner epoch
green bluff
#
Traceback (most recent call last):
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 384, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1168, in on_message
    await self.process_commands(message)
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1164, in process_commands
    ctx = await self.get_context(message)
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1071, in get_context
    prefix = await self.get_prefix(message)
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 991, in get_prefix
    ret = await discord.utils.maybe_coroutine(prefix, self, message)
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\utils.py", line 602, in maybe_coroutine
    value = f(*args, **kwargs)
  File "c:\Users\notvi\OneDrive\Desktop\Opal [TESTER]\main.py", line 13, in get_prefix
    conn = db.connect("opal.db")
sqlite3.OperationalError: unable to open database file
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\notvi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 384, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\notvi\OneDrive\Desktop\Opal [TESTER]\main.py", line 60, in example21
    conn = db.connect("opal.db")
sqlite3.OperationalError: unable to open database file
swift monolith
#
async def test(ctx):
    message = await ctx.send("ONLINE!")```
#

how do i add aliases to accept "test" with anything caps

#

without just doing all possible combinations

inner epoch
#

By bot works perfectly thanks @sick birch @maiden fable for all the help may god bless you with all the wealth, health and success destined for you!!

slate swan
#

kind human bean

maiden fable
#

Nice

maiden fable
slate swan
#

yup

slate swan
maiden fable
swift monolith
#

how about something with .lower()

desert heart
#

Actually, that may only work for command groups.

swift monolith
#

i would like that for all commands anyway

desert heart
#

Ah good

#

You can pass that to your Bot object when you create it

swift monolith
#

oh thanks

#

so i can remove the aliases in all commands

#

ok it works tysm

exotic kite
#

!d
pip install discord

slate swan
#

No need to do that for all cmds

#

Hello, I develop a bot discord in python and I have a problem with the clear command

honest shoal
#

what's clear command?

slate swan
#

To delete messages in a room with +clear

honest shoal
#

you mean purge?

slate swan
#

yes

#

excuse me for my language, me speack french

honest shoal
#

oh, alright

#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
hazy oxide
#

what is Scheme "none" is not supported error?

slate swan
#

I have this for the moment
@bot.command() @commands.has_permissions(manage_messages = True) async def clear(ctx, nombre : int): messages = await ctx.channel.history(limit = nombre + 1).flatten() for message in messages: await message.delete()

honest shoal
honest shoal
slate swan
#

I don't care about the rate

#

I just wish it would delete all at once and not little by little and send a success message at the end that stays 3 seconds and then deletes itself

inner epoch
honest shoal
#

that's actually made for bulk deleting messages

slate swan
#

Where do I put it?

honest shoal
#

you can purge on ctx.channel

#

which will be a text channel

slate swan
#

@bot.command() @commands.has_permissions(manage_messages = True) async def clear(ctx, nombre : int): messages = await ctx.channel(limit = nombre + 1).flatten() for message in messages: await message.delete()
Like this?

honest shoal
#

no this is not purge function

slate swan
#

I don't understand in this case

torn sail
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
slate swan
#

I put where the code in my code ?

honest shoal
slate swan
#

ohh excuse me 😭

honest shoal
#

and the limit parameter is also inside purge, so it will be too easy to use it instead of deleting one by one

slate swan
#

Like this ?
@bot.command() @commands.has_permissions(manage_messages = True) async def clear(ctx, nombre : int): messages = await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None) for message in messages: await message.delete()

honest shoal
#

well no.

slate swan
#

Bruhhh

honest shoal
#

you don't even need a for loop

whole shoal
#

await ctx.channel.purge

slate swan
#

Like this ?
@bot.command() @commands.has_permissions(manage_messages = True) async def clear(ctx, nombre : int): messages = await ctx.channel.purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None) for message in messages: await message.delete()

honest shoal
hazy oxide
#

Can someone help? I got this error

nextcord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.embeds0.thumbnail.url: Scheme "none" is not supported. Scheme must be one of ('http', 'https'). 
whole shoal
hazy oxide
#

im getting that error when i run my serverinfo command

honest shoal
#

🥄

honest shoal
torn sail
hazy oxide
#

wait

#
@client.command(aliases=["serverinfo"])
@commands.cooldown(1, 5, commands.BucketType.user)
async def si(ctx):
  role_count = len(ctx.guild.roles)
  list_of_bots = [bot.mention for bot in ctx.guild.members if bot.bot]

  siEm = nextcord.Embed(timestamp=ctx.message.created_at, color=ctx.author.color)
  siEm.set_thumbnail(url=ctx.guild.icon)
  siEm.add_field(name="Server Name", value=f"{ctx.guild.name}", inline=False)
  siEm.add_field(name="Member Count", value=ctx.guild.member_count, inline=False)
  siEm.add_field(name="Verification Level", value=str(ctx.guild.verification_level), inline=False)
  siEm.add_field(name="Highest Role", value=ctx.guild.roles[-2], inline=False)
  siEm.add_field(name="Total Roles", value=str(role_count), inline=False)
  siEm.add_field(name="Bots", value=", ".join(list_of_bots), inline=False)
  siEm.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar.url)

  await ctx.send(embed=siEm)
torn sail
#

ctx.guild.icon.url not ctx.guild.icon

hazy oxide
#

oww okay lemme try

slate swan
#

I have 2 errors in the red lines

honest shoal
#

you are just copy pasting, remove that

hazy oxide
whole shoal
#

_url

hazy oxide
#

ow underscore

slate swan
hazy oxide
whole shoal
#

Uhm one sec

honest shoal
honest shoal
slate swan
#

no

hazy oxide
honest shoal
#

so why there's a reason arg.
it should be just limit=nombre in you case

slate swan
#

ohhh ok

whole shoal
#

Isn't it supposed to be
icon_url=ctx.author.avatar_url
@hazy oxide

honest shoal
#

its display in 2.0 I think

whole shoal
#

oh

honest shoal
#

so ctx.author.display_avatar.url

slate swan
honest shoal
slate swan
#

@bot.command() @commands.has_permissions(manage_messages = True) async def clear(ctx, nombre : int): await ctx.channel.purge( limit=nombre, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)

somber sky
#

anyone know how to make a createrole command

whole shoal
#

Limit should be int right?

#

Oh nvm nombre is variable

hazy oxide
#

aren't that shows user avatar? i want the embed thumbnail shows the guild avatar

hazy oxide
#

so i just have to change author to guild?

honest shoal
whole shoal
#

check should be a check function not . . . xd

slate swan
#

How is that?

honest shoal
#

@hazy oxide which version of dpy are you using?

hazy oxide
#

im using nextcord 2.9

#

2.0.9a

honest shoal
#

nvm, try with display. I'm not familiar with nextcord

hazy oxide
#

i think im just gonna remove the guild avatar as the embed thumbnail

honest shoal
#

why don't you print them for testing instead?

slate swan
#

I have to delete nombre : int ?

whole shoal
#

No

honest shoal
#

no just the last line should be await ctx.channel.purge(limit=nombre)

slate swan
#

Thank you very much.
How can I get him to send a message saying that it has been deleted and then he deletes his message 3 seconds later?

honest shoal
#

send a message and make it a variable. sleep for 3 seconds and delete the message

slate swan
#

asyncio ?

honest shoal
#

yes

turbid prawn
#

Any help in this discord for slack bots?

slate swan
#

What is the command sleep 3 seconds so that it deletes after?

honest shoal
turbid prawn
#

its like a discount discord for companies

honest shoal
slate swan
#

thanks go testing

honest shoal
turbid prawn
honest shoal
#

hmmm

slate swan
#

It does not find the message to delete

honest shoal
empty quest
#

where can you host a discord bot made in python for free? 24/7

honest shoal
#

^

slate swan
honest shoal
#

message variable will be the message you are sending...

empty quest
honest shoal
#

pay

supple thorn
#

You can just leave it on 24/7

empty quest
#

what about heroku?

honest shoal
#

read this message then ^

slate swan
#

I can't find

honest shoal
slate swan
#

I can't find the variable to put.
I'm a beginner in python

honest shoal
#

you don't have to find it, you have to make it

#

okay, tell me how do you send a message?

slate swan
#

await ctx.send(f"{nombre} messages ont été supprimés")

dim vapor
#

why wont discord send archived threads when the bot connects? or is there a work around for this?

honest shoal
empty quest
#

if you put your pc to sleep will a bot being hosted on the pc go offline?

honest shoal
empty quest
#

i am new to web servers

#

if you make a webserver then will the bot stay online all the time?

honest shoal
#

if your pc is on, yes

empty quest
#

if on sleep mode?

honest shoal
#

also hosting is not related to this channel...

#

this is a python server

#

!ot for that

unkempt canyonBOT
slate swan
honest shoal
#

how are you invoking the command?

slate swan
#

+clear

honest shoal
#

and?

somber sky
#

im trying to make a command that automatic makes roles

slate swan
#

+clear 5

honest shoal
honest shoal
somber sky
slate swan
#

It's ok, I just need to adjust asyncio

#

thanks

somber sky
#

do you know how to make it have the display other then members on?

#

@honest shoal

honest shoal
unkempt canyonBOT
#

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

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

All fields are optional.

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

Changed in version 1.6: Can now pass `int` to `colour` keyword-only parameter.

New in version 2.0: The `display_icon` keyword-only parameter was added...
pliant ocean
#

can anyone help me how to use praw in replit

supple thorn
pliant ocean
slate swan
#

Do I have to do the moderation commands in another .py file or can I leave everything in the same file as now ?

supple thorn
pliant ocean
slate swan
#

won't it create a collision ?

supple thorn
#

Why would you use regular praw

pliant ocean
supple thorn
#

That would be blocking

honest shoal
supple thorn
somber sky
slate swan
#

The different commands in the same file

honest shoal
supple thorn
#

Then just learn how to use asyncpraw by reading their docs

honest shoal
somber sky
# honest shoal wdym?

im trying to make it where when the role is created it automatically has the "display role name sepretely then online" but idk how to do that

pliant ocean
honest shoal
slate swan
#

I'll leave it in the same file so I don't have to search everywhere in case there is an error later on

honest shoal
supple thorn
somber sky
#

oo alr

honest shoal
slate swan
#

I will come back to you if I have any more questions.

honest shoal
slate swan
sonic lintel
#

Does anyone have a good reference to make roleplay commands? e.g hug, cry e.t.c

slate swan
sonic lintel
honest shoal
#

list of gifs
use an API instead

sonic lintel
#

nono I mean reference code for when the user tags another user

maiden fable
#

Do i see cringe commands again? 👀

sonic lintel
#

Ill try it thanks!

#

I am using cogs so I will have to change it a bit

maiden fable
#

Doesn't it use the discord namespace?

honest shoal
#

on your pc

maiden fable
#

U got a cc? @slate swan

honest shoal
#

or check here ^

honest shoal
maiden fable
#

I'mma just go away lemon_pensive

honest shoal
#

hosting is not related to this channel...

maiden fable
honest shoal
maiden fable
slate swan
maiden fable
#

And I don't have a credit card

#

I, uhhh, ain't on the best terms with my dad, sooooo I better not to anything like that 😂

buoyant quail
#

Send your card number to receive a reward

maiden fable
buoyant quail
#

And 3 useless number on the back side

slate swan
manic wing
#

!ot

unkempt canyonBOT
maiden fable
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

buoyant quail
#

annoying guys with their rules :

maiden fable
#

?

#

Ah wsgi

#

Hmm, don't use replit please @slate swan

#

U using replit?

#

Ah okay mb

alpine furnace
#

Replit mf

#

Someone make a kubernetes operator that spins up replit instances

#

And deploys your discord bots on them

maiden fable
#

😔

#

Might as well get that Oracle VPS and host everyone's bots on it

alpine furnace
#

The free tier one right

#

What’s the resource steal like on that one

maiden fable
#

Idk 4 vCores or smth

#

Or it was 6 🤷

heavy folio
#

i got this error when trying to start up the bot:

AttributeError: '_MissingSentinel' object has no attribute 'create_task'
```api issue? (discord.py 2.0)
tacit token
#

I want to use custom emojis to my buttons,but now work. If i use basic emojis its work but i need custom emojis.

    @commands.command()
    async def meme(self,ctx):
        myemoji=":ufo:"
        await ctx.send("The buttons on the fucos")
        await ctx.send(components=[[
            Button(style=ButtonStyle.blue, label="Next", custom_id="button_m_n",emoji=f"{myemoji}"),
            Button(style=ButtonStyle.red, label="Stop", custom_id="button_m_s",emoji="\U0001F6D1")
        ]])

Error:discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.emoji.name: Invalid emoji

manic wing
#

did you pass a loop that wasnt an AbstractEventLoop

fervent surge
#

for some reason, this does not work: python c.execute(f"INSERT INTO features (message_id) VALUES({message.id})") c.commit() literally nothing happens, fyi message.id is not null

#

im pretty sure it works for some reason(until the bot is closed) if I remove c.commit()

heavy folio
manic wing
alpine furnace
heavy folio
alpine furnace
#

You’re not really getting 6 cores

heavy folio
#

on my host it installs the latest commits and it worked a few hours ago

manic wing
#

what loop are you passing

alpine furnace
#

You’re 60% of those 6 cores, or something like that if they claim vcpus

heavy folio
#

and i havent changed anything in that file

alpine furnace
#

Might be worth a stress test to check

manic wing
#

maybe it never actually worked

maiden fable
alpine furnace
#

The shitty providers will shut you down straight away if you burst to 100% for over 5 minutes

#

Yes, I know the specs

heavy folio
maiden fable
alpine furnace
#

Hmm

manic wing
#

can you just tell me what loop you're passing?

slate swan
#

You need a Docker file to run your bot 24/24 on replit right?

maiden fable
#

Nope

modest plover
#

Running a bot 24/7 on replit is a bad idea

#

It'll get ratelimited very easily

slate swan
supple thorn
slate swan
supple thorn
alpine furnace
alpine furnace
supple thorn
#

👀

alpine furnace
heavy folio
#

bot loads now

alpine furnace
#

@slate swan

supple thorn
#

Iceatea this is your only chance

#

Jump on it

slate swan
#

yes ?

alpine furnace
#

Not sure how I’d handle your image updates, cause I don’t have watchtower installed

supple thorn
heavy folio
slate swan
#

I do not have access to the link

heavy folio
#

dpy server

manic wing
#

i told you it needed abstracteventloop

slate swan
heavy folio
supple thorn
velvet tinsel
alpine furnace
#

Pretty cringe for bots to make their own event loop

kindred drum
#

how do I create a dynamic time?

#

eg. about 1hour

#

like the discord times

manic wing
heavy folio
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
heavy folio
#

is it this -> <t:694206969:R>

kindred drum
heavy folio
#

that was an example

kindred drum
#

how would I make this: 2022-03-13 10:38:54.450255 into that format

heavy folio
kindred drum
#

'discord.utils' has no attribute 'format_d

manic wing
#

its format_dt

kindred drum
#

ye

#

thats the error, i cut it off

heavy folio
#

are you on 2.0?

kindred drum
#

2.0?

heavy folio
#

dpy v2

lone hare
heavy folio
#

hi, do i know you?

lone hare
#

i am learning python but not sure what is wrong because shitty syntax

    teams = []
    # TODO: Read teams into memory from file
    reader = csv.DictReader(sys.argv[2])```
#

not able to read csv file

supple thorn
heavy folio
#

heh

supple thorn
#

In discord bots channel

heavy folio
lone hare
#

for saving price data

kindred drum
#

I did it

supple thorn
kindred drum
#

:)"<t:"+str(round(e.timestamp()))+":R>"

supple thorn
#

Cause it's more python than discord bot

kindred drum
#

How do I make a muted role work? like so it can't send messages etc

supple thorn
kindred drum
#

I do

#

but it just gets over ridden by other things

supple thorn
#

Can't really help with that cause i don't know shit how to fix hierachy shit

kindred drum
#

I found it, you gotta set all the other roles to neutral in sending messages

#

then have that one not be able to send them

slate swan
#

So i want a command, that if you type ?add @slate swan 10
It gets stored in a database (json) like this:

{
"guildId": {"userId": 10}
}

#

Ive just opened vsc and its saying most of my imports are undefined, yet they worked yesterday and all the other days before that??

maiden fable
#

Wrong python version

slate swan
#

whats the latest python version?

humble granite
#

Hello! Is there a way to get the overwrites attr from (eg. a textchannel => see below) in this format (=> eg. ["Role",id,permission-value])?
{<Role id=671340010649157642 name='@everyone'>: <discord.permissions.PermissionOverwrite object at 0x7fb655bb28e0>, <Member id=611418916995989534 name='Siuuupa Idol' discriminator='8671' bot=False nick=None guild=<Guild id=671340010649157642 name='Python 》Testserver' shard_id=None chunked=True member_count=16>>: <discord.permissions.PermissionOverwrite object at 0x7fb655bb27c0>, <Role id=712658906727448618 name='gelb'>: <discord.permissions.PermissionOverwrite object at 0x7fb655bb25e0>}

junior verge
#

How is this possible when I only have 1 on_ready in all my code

supple thorn
#

I suggest learning how to use a real database

slate swan
#

i tried learning sql but couldnt find good tutorials

alpine furnace
stone beacon
alpine furnace
#

Sql is fundamental and used everywhere, of course there would be phenomenal tutorials and courses for it

slate swan
stone beacon
slate swan
#

im using pycord

junior verge
stone beacon
supple thorn
junior verge
#
import discord
import os
from discord.ext import commands
import json
from discord_slash import SlashCommand

client = commands.Bot(command_prefix = ".")
slash = SlashCommand(client, sync_commands=True)

with open("config.json", "r") as f:
  config = json.load(f)

@client.command()
async def load(ctx, extension):
    client.load_extension(f'cogs.{extension}')

@client.command()
async def unload(ctx, extension):
    client.unload_extension(f'cogs.{extension}')

for filename in os.listdir('./cogs/'):
    if filename.endswith('.py'):
            client.load_extension(f'cogs.{filename[:-3]}')

    
    @client.event()
    async def on_ready():
        print('Daxbot is ready!')

        servers = len(client.guilds)
        members = 0
        for guild in client.guilds:
            members += guild.member_count - 1

        await client.change_presence(activity = discord.Activity(
            type = discord.ActivityType.watching,
            name = f'{servers} servers and {members} members'
        ))

client.run(config["bot_token"])

``` Should it be @client.event or @client.command I am confused rn
stone beacon
#

de-indent that on_ready()

supple thorn
#

Why is your on_ready indented

stone beacon
#

That for-loop is registering on_ready() on every iteration which throws the error

junior verge
#

Oh yeah my bad

#

Still same error