#discord-bots

1 messages · Page 30 of 1

slate swan
#

Docs link for guild?

placid skiff
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
stable mulch
#
if isinstance(error, commands.CommandOnCooldown):
        if error.retry_after < 60:
            message = await ctx.send(f"{ctx.author.mention} This command is on cooldown! You can use it again {round(error.retry_after, 2)} seconds.")
            await asyncio.sleep(5)
            await ctx.message.delete()
            await message.delete()

        elif error.retry_after > 60 and error.retry_after < 3600:
            mins_decimals = error.retry_after/60 - math.floor(error.retry_after/60)
            mins = math.floor(error.retry_after/60)
            secs = round(mins_decimals*60, 2)
            cooldown = f'{mins} minutes and {secs} seconds'
            message = await ctx.send(f"{ctx.author.mention} This command is on cooldown! You can use it again {cooldown}.")
            await asyncio.sleep(5)
            await ctx.message.delete()
            await message.delete()

        elif error.retry_after > 3600:
            hrs_decimals = error.retry_after/3600 - math.floor(error.retry_after/3600)
            hrs = math.floor(error.retry_after/3600)
            mins_decimals = (error.retry_after/60) - math.floor(error.retry_after/60)
            mins = math.floor(hrs_decimals * 3600/60)
            secs = round(mins_decimals * 60, 2)
            cooldown = f'{hrs} hours, {mins} minutes, and {secs} seconds.'
            message = await ctx.send(f"{ctx.author.mention} This command is on cooldown! You can use it again {cooldown}.")

    if isinstance(error, commands.MissingRequiredArgument):
        message = await ctx.send(f"Missing required argument/s. Use $description [command] to view the required arguments.")
    
    if isinstance(error, commands.MissingPermissions):
        message = await ctx.send(f"Missing required permisions, please check that you have the permission/s to perform this command.")

wait, where?

silk fulcrum
#

if if if 😭

placid skiff
stable mulch
#

😂 sorry, I coded this section when I was just beginning to program

placid skiff
#

well it's not like that is not right in that way, but using elif is better because an error can't be an instance of two different objects

stable mulch
#

oh ok

placid skiff
#

and using elif you will need to type this else statement only once

stable mulch
placid skiff
#

good, now check the console

#

you will have the exception there

silk fulcrum
#

bruh I just looked at my old on_command_error 😭 😭 😭

stable mulch
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
stable mulch
silk fulcrum
stable mulch
silk fulcrum
stable mulch
#
user = ctx.message.author
channel = user.voice.channel
placid skiff
#

so the problem is that channel actually is none, that is because a member object hasn't an attribute channel which refers to the channel where the user is, so try this:

channel = ctx.author.voice.channel

stable mulch
#

ah okay

#

Oh okay

#

thank you

placid skiff
#

you're welcome

silk fulcrum
#

wait I just noticed wth is user = ctx.message.author, using it in channel var and then using ctx.author in other vars

stable mulch
#

Wait... wouldn't the same error occur?

placid skiff
#

yeah to get the author of the command just use ctx.author

silk fulcrum
stable mulch
#

it gave the same error, i just tested

silk fulcrum
#

You just need to put this line channel = user.voice.channel here

placid skiff
#

yup

stable mulch
#

Thank you so much guys

silk fulcrum
#

im not sure, is doing this good? or better to do smth like >=1,<2, cus im just lazy to seacrh what versions would be compatable

placid skiff
#

it's normal when you're new to d.py
make sure to check the docs when you're not sure of something, it helps a lot

stable mulch
#

yep, thank you

placid skiff
silk fulcrum
#

oh wait i guess that's new to python at all :lmao: not just to dpy

placid skiff
#

yeah but not entirely at beginner level lmao

silk fulcrum
#

lol some middle dumbass

stable mulch
#

I'm at beginner level for Python as well as Discord.py😂

silk fulcrum
stable mulch
#

I still need to figure out how to use classes and stuff. I guess I should look at some Python tutorials. I just realised how much of the fundamentals I'm lacking.

placid skiff
#

i started with C and then learnt assembly so nothing scares me anymore D_D

stable mulch
#

Wow.

silk fulcrum
placid skiff
#

js it's not scary, it's stupid D_D
Why did they put that S if not so?

stable mulch
#

Assembly code as in the 4 letter code?

silk fulcrum
placid skiff
#

well py-script is in alpha testing so, we will say bye bye to js soon

stable mulch
placid skiff
#

Well it's not like the instructions can't have more than N letter but yeah, asm is mnemonics

silk fulcrum
placid skiff
#

like BTFSZ is asm "if"

stable mulch
#

Really? Is there a good way to memorise that?

silk fulcrum
#

omg, just looked at my old on_message, I won't send even part of it, you'll die from cringe

placid skiff
#

They're all acronyms, that means Bit Test File Skip If Zero

stable mulch
silk fulcrum
#

at least I knew about this...

mental hollow
#

How do I get the guild ID when using on_member_join?

stable mulch
placid skiff
mental hollow
#

ty

silk fulcrum
stable mulch
#

oh ok

#

you can use f string or format as well can't you?

silk fulcrum
stable mulch
#

?

silk fulcrum
#

that's what users with nicks '; DROP TABLE users; expect

#

so like if I used f string query would be this INSERT INTO users (nick) VALUES ('haha, bye'; DROP TABLE users;')

stable mulch
#

oh okay

slate swan
silk fulcrum
#

I can't handle it anymore... Creating DB tables in __init__ of Bot subclass...

slate swan
limber bison
#

x = await random.randint(1, 2)

x = random.randint(1, 2)

like 1st enhance my code ?

limber bison
#

or unaffected ?

slate swan
#

How can I find messages sent by a user in the past 100 messages

silk fulcrum
cold sonnet
#

use asyncpg

slate swan
silk fulcrum
mental hollow
#
await gws.send(f"{member.mention}, welcome to **{member.guild.name}**", delete_in=5)
TypeError: send() got an unexpected keyword argument 'delete_in'

Why’s this happening?

slate swan
silk fulcrum
mental hollow
slate swan
#
async for message in ctx.channel.history(limit=100):
slate swan
#

use*

#

oh

#

How 💀

cold sonnet
#

check = lambda x: x.author == samandra

slate swan
#
[message async for message in channel.history(limit=100, check= lambda msg: msg.author.id == user_to_check.id)]```
silk fulcrum
# cold sonnet use asyncpg

I would've used it now if I knew about that, now I wrote too much using on MySQL (not even async) and idk to switch or not, cus im layzy

stable mulch
#

You can do messages = await ctx.history(limit = [number])

slate swan
silk fulcrum
slate swan
slate swan
slate swan
#

wait

lone lichen
#

!d discord.ext.commands.Bot.wait_for

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/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
safe socket
#

which library should I use?

#

I have used pure discord.py for a year. now everything have changed. My Bot gives me some weird erros

silk fulcrum
#

no

vocal snow
heavy folio
#

it has major changes

vocal snow
#

If you're getting errors please send them

safe socket
#

client.loop is not working anymore sad

heavy folio
#

yeah it has changed
are you on the master branch or 1.7.x?

#

and also show your full code because that doesnt tell us much

#

regenerate your token man

slate swan
heavy folio
#

client.loop.create_task now has to be used in an ASYNC context
use asyncio.run or override Bot.setup_hook

slate swan
#

nice token

safe socket
heavy folio
#

yeah do it in Bot.setup_hook

safe socket
heavy folio
safe socket
#

yeah I think I need to rewrite bot 😅 interesting

shut mist
#

what is the class for buttons in d.py?

heavy folio
#

ofc, bumping versions = major and breaking changes

heavy folio
unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
zealous jay
#

Re writing is a good opportunity to learn py_strong

shut mist
#

oh thank you!

slate swan
safe socket
#

btw there was a Discord.py big server in discord. Now I cant find it. only discord.js is there

slate swan
safe socket
#

oo

#

its not appear in discovery

safe socket
slate swan
#

I got ignored again :AScry:

vocal snow
#

Lol

slate swan
#

nice

rugged shadow
#

but it's good to know someone goes outside often :p

slate swan
#

How can I make the bot reply multiple times when the max_values = 7 on select menu?

slate swan
#

no?

#

ok?

rugged shadow
shrewd apex
#

!d discord.ui.Select

unkempt canyonBOT
#

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

This is usually represented as a drop down menu.

In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").

New in version 2.0.
shrewd apex
#

what's max_values got to do with reply

slate swan
#

thats i was going to ask

gilded gust
#

Hey, I was just looking through some bots and noticed that some bots have a 'supports slash commands' badge and i was wondering how i could get that on my bot?

slate swan
#

Why do i have to add tasks loop ?

slate swan
shrewd apex
gilded gust
slate swan
shrewd apex
gilded gust
#

i have slash commands that work

#

not sure what you mean by register

shrewd apex
#

global?

#

is it a global slash command?

slate swan
gilded gust
#

no

#

the tutorial i followed said not to do so

slate swan
shrewd apex
#

u need global

gilded gust
#

oh

#

so just remove the guild_ids

shrewd apex
#

also btw the badge dosent show on phone atleast for me

slate swan
#

yeah

slate swan
#

@shrewd apex do you have any ideas how to make this?

slate swan
#

i think if interactionl.reponse.is_done() will work somehow

shrewd apex
#

i haven't even got the idea how max_values or reply is related but if u could use a if statement for checking max_values and for loop to reply

slate swan
#

but i have need to have two if statements

slate swan
#

And how the for loop will work if i select one option?

shrewd apex
slate swan
#

!d discord.ui.Select.values

unkempt canyonBOT
slate swan
shrewd apex
#

hmm i mean for interaction

slate swan
shrewd apex
#

👌

slate swan
limber bison
#

there is anythink like dynamic bot token ?

sick birch
south steppe
#

Does anyone know how to make a discord bot react to certain messages?

For example somebody types "L"

And the bot reacts with the L emoji

slate swan
#
        for c in self.values[0]:
            if role1 not in interaction.user.roles:
                await interaction.user.add_roles(role1)
                await interaction.response.send_message(content=f"**✅ You got {role1}**", ephemeral=True)
            else:
                await interaction.user.remove_roles(role1)
                await interaction.response.send_message(content=f"**✅ You were removed from {role1}**", ephemeral=True)```
#

discord.errors.InteractionResponded: This interaction has already been responded to before

silk fulcrum
#

leomao

slate swan
limber bison
sick birch
#

Right, but I fail to see how that’s “dynamic”

slate swan
limber bison
#

best hosting configration for a single server bot ?

rugged shadow
sick birch
slate swan
#

or replit-

rugged shadow
slate swan
slate swan
# slate swan hm

should i replace interaction.edit_original_response with both interaction.response.send_message?

slate swan
#

dude what does "hm" suppose to mean?

hushed galleon
#

what about deferring + sending one message with all role changes? its a lot easier to read than 7 messages at once

silk fulcrum
#

hm

rugged shadow
#

hm 🤔

limber bison
sick birch
limber bison
#

my bot will be used by 500-1k ppl at once !

#

will t2 able to hendal it ?

sick birch
#

Then go for more than a t2 micro

#

Maybe a t3 instance

limber bison
#

ohhh k

#

2 cpus right ?

#

t3 micro , i think this hv 2 cpus and 1 gb rab

#

is it ok ?

#

or should inc ram ?

vocal snow
#

If you don't need presence intents it should be fine

#

I would increase just to be safe

hushed galleon
limber bison
#

right ?/

vocal snow
#

No

#

It means accessing status and activity of users

slate swan
limber bison
vocal snow
limber bison
#

lul

vocal snow
#

Well you'll need to use default() and then enable members and message_content

limber bison
#

what are defult Intents ?

#

any link so i can read all

south steppe
# hushed galleon what code do you have so far? and what library are you using for your bot?
client = discord.Client()

@client.event
async def on_ready():
    print("We have logged in as {0.user}" .format(client))

@client.event
async def on_message(message):
    username = str(message.author).split("#")[0]
    user_message = str(message.content)
    channel = str(message.channel.name)
    print(f"{username}: {user_message} ({channel})")



    if message.author == client.user:
        return

if message.channel.name == ':speech_balloon:│general' or ':robot:│bot-spam':
        if user_message.lower() == "hello":
            await message.channel.send(f'Hello {username}!')
            return
        elif user_message.lower() == 'hi':
            await message.channel.send(f'Hi {username}!')
            return
        elif user_message.lower() == 'bye':
            await message.channel.send(f'See you later {username}!')
            return
        elif user_message.lower() == 'yo':
            await message.channel.send(f'Yo {username}!')
            return
        elif user_message.lower() == 'cya':
            await message.channel.send(f'Cya {username}!')
            return
        elif user_message.lower() == '!random':
            response = f'This is your random number: {random.randrange(1000000)}'
            await message.channel.send(response)
            return
fallow girder
#

Hello, I have a problem with the cogs, the commands I put in the cogs do not work, the bot tells me that the commands do not exist

slate swan
#

please use a pasting service to send your code

fallow girder
#

me ?

silk fulcrum
#

yes

slate swan
#

yes

fresh notch
#

how do i convert binary from a request into an image and then send it on discord

hushed galleon
# south steppe ``` client = discord.Client() @client.event async def on_ready(): print("We...

i would suggest using a dictionary to map alphabet characters to the corresponding unicode (i.e. standard) emoji, then check if their message is in the dictionary and if so, react to it
e.g. py letters = { 'L': '\N{REGIONAL INDICATOR SYMBOL LETTER L}' # there's also several other ways to represent unicode characters } ... if content in letters: emoji = letters[content] await message.add_reaction(emoji) a page of other 🇱 emojis: https://www.fileformat.info/info/unicode/char/search.htm?q=regional+indicator&preview=entity
documentation for add_reaction: https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.add_reaction

fallow girder
#
async def load():
    for file in os.listdir("./cogs"):
        if file.endswith(".py"):
            await bot.load_extension(f"cogs.{file[:-3]}")
#

I have a problem with the cogs, the commands I put in the cogs do not work, the bot tells me that the commands do not exist

south steppe
#

could somebody help me with this I don't usually code so I am clueless

hushed galleon
rugged shadow
#

So whatever that might be, message or msg or whatever

light goblet
#

is it possible for a bot to send slash commands?

south steppe
# rugged shadow I think you should call `add_reaction` on the class instance, not the class itse...
 if message.author == client.user:
        return

    if message.channel.name == ':speech_balloon:│general' or ':robot:│bot-spam':
        if user_message.lower() == "hello":
            await message.channel.send(f'Hello {username}!')
            return
        elif user_message.lower() == 'hi':
            await message.channel.send(f'Hi {username}!')
            return
        elif user_message.lower() == 'bye':
            await message.channel.send(f'See you later {username}!')
            return
        elif user_message.lower() == 'yo':
            await message.channel.send(f'Yo {username}!')
            return
        elif user_message.lower() == 'cya':
            await message.channel.send(f'Cya {username}!')
            return
        elif user_message.lower() == '!random':
            response = f'This is your random number: {random.randrange(1000000)}'
            await message.channel.send(response)
            return
        elif user_message.lower() == 'L':
            discord.Message.add_reaction(':regional_indicator_:')
            return
#

what do I change

#

the bit I need help with is the bottom part

rugged shadow
#

Seems like your Message instance is named message, so call add_reaction on that instead

hushed galleon
rugged shadow
#

Or to put it simply, replace discord.Message with message :p

slate swan
light goblet
#

invoke

rugged shadow
light goblet
#

other bots command

rugged shadow
#

No.

slate swan
#

too slow 😔

rugged shadow
#

You'd be... botting a bot using a bot

light goblet
#

so there's now way?

slate swan
fresh notch
rugged shadow
#

No way. But if there was a way, the bot (or Discord) would probably not allow it

slate swan
#

there isn't a way and it's hard to think of one

hushed galleon
fresh notch
#

thanks

south steppe
slate swan
south steppe
#

I changed it to this but what did I do wrong

rugged shadow
#

And change :regional_indicator_l: to the actual unicode character

south steppe
#

is that what you meant or no

rugged shadow
slate swan
golden tapir
#

multiple instances of my bot are running how could i fix this if i am on replit

south steppe
south steppe
golden tapir
#

ok

fresh notch
#

U+1F1F1 this is the unicode btw

rugged shadow
#

Replace :regional_indicator_l: with 🇱

slate swan
#

imagine making a conditional for every emoji AScry

south steppe
rugged shadow
#

did the :regional_indicator_l: work, though?

south steppe
#

nope

rugged shadow
#

Is there any error message?

south steppe
#

thats all it does

sick birch
#

You can copy it off emojipedia if you’d like

south steppe
#

ok

sick birch
#

Many OSes also come with a native emoji picker

rugged shadow
#

Windows has Win + .

#

Try that :p

south steppe
#

The L at the beginning?

sick birch
#

Right

fresh notch
slate swan
sick birch
#

There should also be a copy button on screen

sick birch
slate swan
#

os variations then

maiden fable
#

L

fresh notch
#

@south steppe u could use the unicode for L U+1F1F1

south steppe
# sick birch Right

none of this is working sadly, should I send the full code again to show what I have done?

sick birch
south steppe
sick birch
#

You’re checking if a lowercase letter is equal to an upper case letter

#

Which is never true

south steppe
#

thank you so much!

#

it works!

sick birch
#

Awesome

south steppe
#

thank you everyone that helped me 🙂

slate swan
#

robin supremacydogepray

south steppe
#

haha

slate swan
#

Please read #rules before posting any message

sick birch
#

I can’t ping mods dammit

hushed galleon
sick birch
#

<@&831776746206265384> here it is

maiden fable
#

Someone wanna see smth cursed? 👀

south steppe
#

I have one more question

slate swan
south steppe
#

Is it possible to keep the bot logged on without having the script open all the time?

south steppe
#

oh damn ok

maiden fable
south steppe
#

how are bots always online for example mee6

slate swan
slate swan
maiden fable
slate swan
south steppe
#

oh ok

maiden fable
south steppe
#

thanks for helping me understand, I thought it would be hosting but I was making sure 🙂

rugged shadow
#

Plot twist: MEE6 is hosted on 1GB RAM Windows XP

maiden fable
sick birch
slate swan
rugged shadow
#

Wish I could just... DIY MEE6

#

Also when will this stupid leaf icon disappear

slate swan
#

and oracle hosting kek

slate swan
slate swan
#

chat became dead!!!!!!!!

#

omg

rugged shadow
#

Didn't know everyone hated MEE6

slate swan
#

it is hatable so can't prevent honest feelings

rugged shadow
#

How is this thing "hatable"?!
https://www.youtube.com/watch?v=l5wvqKcqL7c

I’m a compilation of all the best Mr. Meeseeks moments, look at me! Stream seasons 1-5 now on HBO Max: http://bit.ly/3hRw9rU

#AdultSwim #RickAndMorty

SUBSCRIBE: https://youtube.com/adultswim1?sub_confirmation=1

What to watch next: more Rick and Morty clips!
https://youtube.com/playlist?list=PLQl8zBB7bPvI_iYCe4LT8HHfjonOog4u3

Watch the Adul...

▶ Play video
slate swan
#

it's @bot.event

#

any error?

#

what...

#

well then guild is None prolly

#

doesnt matter if the guild isnt in the cache then it'll return None either ways

edgy maple
limber bison
#

math.ceil(error.retry_after) vs int(error.retry_after) // any diff ?

#

like int was more op for mr

#

me*

silk fulcrum
limber bison
#

!e

v = math.ceil(5.34)
u = math.ceil(5.74)
w = int(5.34)
x = int(5.75)
print(v,u,w,x)```
silk fulcrum
#

import math also

#

remove indents

unkempt canyonBOT
#

@limber bison :x: Your 3.10 eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     u = math.ceil(5.74)
003 | IndentationError: unexpected indent
limber bison
#

!e

v = math.ceil(5.34)
u = math.ceil(5.74)
w = int(5.34)
x = int(5.75)
print(v,u,w,x)```
unkempt canyonBOT
#

@limber bison :white_check_mark: Your 3.11 eval job has completed with return code 0.

6 6 5 5
limber bison
#

ohh k k \

#

got it int will be best for me , i dont need to import something

silk fulcrum
limber bison
shrewd apex
slate swan
shrewd apex
#

not happening unless i am 18

silk fulcrum
slate swan
slate swan
shrewd apex
#

how do you work without a cc company pays in cash?👀

slate swan
shrewd apex
#

f autocorrect

slate swan
#

debit cards exist

silk fulcrum
shrewd apex
#

take your time👍

silk fulcrum
slate swan
#

only 5

shrewd apex
#

passes by in a flash

lone lichen
#

U can make paypal acc

slate swan
#

go play on the streets by that time dogepray

shrewd apex
#

eh try to avoid qr code payment methods

silk fulcrum
slate swan
silk fulcrum
slate swan
lone lichen
silk fulcrum
shrewd apex
slate swan
shrewd apex
#

...

lone lichen
silk fulcrum
#

@shrewd apex lets play somegames

silk fulcrum
shrewd apex
#

bring ashley along too three much more fun than two

lone lichen
slate swan
silk fulcrum
#

@slate swan @shrewd apex lets play somegames

lone lichen
slate swan
#

dont give bad advice

#

friends aren't something to be made fun of

#

especially when you dont have any

silk fulcrum
#

wtf( why this started playin

lone lichen
silk fulcrum
shrewd apex
slate swan
#

how can i get my bot online 24/7?

vocal snow
limber bison
#

can i reload a single command in an extension ?

#

cogs ?

silk fulcrum
#

no

slate swan
limber bison
#

why v2 dont support diff extention for a single cog 🥲

#

whyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

limber bison
#

fix it bisi

silk fulcrum
#

you can reload extension

#

what is wrong with that

limber bison
#

i mean like i make a class xx in with my commands , i cant use the same class in another file again in discord,py v2

silk fulcrum
#

didn't get ya

#

if you mean multiple cogs in one extension

limber bison
fallow girder
#

you still haven't finished solving the problems?

silk fulcrum
#

why not put command1 and command2 in one file

limber bison
silk fulcrum
#

and what?

limber bison
#

and asyncio.sleep disturb

silk fulcrum
#

scheduling 😎

limber bison
#

shit ?

#

or any other method ?

silk fulcrum
slate swan
#

I need a command idea cuz I'm bored 😔

silk fulcrum
slate swan
shrewd apex
#

does anyone even play Minesweeper in first place

silk fulcrum
slate swan
#

90s ancient adults dogepray

#

,

silk fulcrum
shrewd apex
slate swan
shrewd apex
slate swan
shrewd apex
#

make candy crush command

slate swan
#

...

shrewd apex
#

¯\_(ツ)_/¯

slate swan
#

that's just like minesweeper but not minesweeper

shrewd apex
#

altho it's prolly gonna be a chore to make

slate swan
shrewd apex
#

well just make so fun facts or interests stuff calculator commands ig

slate swan
#

calculator dogepray ok

sick birch
#

Calculators are good projects to practice making a lexer on

vocal snow
slate swan
vocal snow
slate swan
#

doesnt seem so trustable, I'll be fine UniSips

vocal snow
#

I broke youtube terms of service

#

Only slightly tho

loud shard
#

Hey have any of you tried to run a discord bot on an android smartphone? Im wondering if it would still work, im thinking about using pydroid

vocal snow
#

It would but probably would be quite limiting

loud shard
#

How so?

vocal snow
#

CI would be a pain

loud shard
#

Whats CI?

vocal snow
#

continuous integration

loud shard
#

Like working on it and updating it?

vocal snow
#

That's one aspect of it

#

Also for databases, you'll need to host those elsewhere

#

Or use a file based one

#

Which would be a bottleneck if you have a lot of data

loud shard
#

Right, im not at that stage yet but i can see how that would be an issue for a bigger bot with many users n servers

cerulean folio
#

discord bot developping pain:
When the bot is being used by people and you're making edits with another bot on another server, and you gotta push your edits without the test server and bot configs and pull them on the working bot feels like UGHHHHH XD

#

raise your hand if you're also annoyed by this XD

pliant gulch
#

If it's really that big of a problem just setup some CI workflow that runs after test cases pass

fallow girder
#

Hello, I have commands in cogs, I know that the files are supported in main.py but the commands do not work

fallow girder
#

I think it's not that

#
for file in os.listdir("./cogs"):
    if file.endswith(".py"):
        bot.load_extension(f"cogs.{file[:-3]}")
#

I have do that for the cogs

#

But the commands do not work

silk fulcrum
#

why would you name FILE Embed.py and CLASS embed

#

that's completely reversed

fallow girder
#

This is the problem ?

silk fulcrum
#

i dont think so, but that's unlogical

fallow girder
fallow girder
slate swan
fallow girder
#

@silk fulcrum It is probably the indentations

#

no ?

silk fulcrum
#

you named class and function the same (embed), that looks sus

#

(class embed, async def embed)

wise lark
#

when i click this little arrow it doesnt say 3.10 only 3.11

#

can someone help?

tawdry perch
#

Do you have 3.10 installed?

shrewd apex
#

install 3.10 first then

wise lark
#

it only says Python 3.11 (Dxbs) C:\Users\Owner\Script\python.exe

maiden fable
#

U have installed only 3.11 then

wise lark
wise lark
shrewd apex
#

then search for it using browse then select python.exe in 3.10 directory

wise lark
#

just deleted 3.11

shrewd apex
#

go to settings

wise lark
silk fulcrum
#

bbruh

shrewd apex
#

click cntrl alt s

wise lark
#

ok

shrewd apex
#

will pop up settings

#

then go to project

wise lark
#

k

shrewd apex
#

add python interpreter

wise lark
shrewd apex
#

and then browse to 3.10 directory

shrewd apex
wise lark
#

k

shrewd apex
#

and select python.exe

wise lark
#

this right?

shrewd apex
wise lark
#

thats hwat pops up

shrewd apex
#

yes

wise lark
#

what*

shrewd apex
#

click apply then ok

wise lark
silk fulcrum
wise lark
#

it popped up and said
Failed to create a virtual environment

#

right as I clicked apply

shrewd apex
#

u already have a venv then 👀

wise lark
#

bro im so frustrated

wise lark
#

it still says this

#

like BRO this is getting on my nerve

shrewd apex
#

u just deleted 3.11

#

it normally creates venv with default python path

#

¯\_(ツ)_/¯

wise lark
shrewd apex
#

and 3.11 should've prolly been ur latest

#

u can just delete the project and create a new one

wise lark
#

if i deleted 3.11 then why is it still popping up as a interpreter

wise lark
shrewd apex
#

it would show invalid next to the interpreter tho

shrewd apex
wise lark
#

ok so it looks like this

#

where it says base interpreter

#

theres option that says 3.11 and 310

#

I click 310 correct? @shrewd apex

#

im sorry im confusing you im just frustrated

shrewd apex
wise lark
#

click create?

shrewd apex
#

yep

wise lark
#

k

#

OMG ITS SAYING THIS AGAIN

shrewd apex
#

show a ss

#

of what it's saying

wise lark
#

when i clicked create this is what it said

shrewd apex
#

hmm give me a few secs

wise lark
shrewd apex
#

pip install virtualenv

wise lark
shrewd apex
#

run this in your terminal

wise lark
#

k

shrewd apex
#

yes

wise lark
#

ok it says

#
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\Owner\PycharmProjects\pythonProject2> 
``` is this good or bad?
shrewd apex
#

yeah no big deal in short term

#

install done?

wise lark
#

yea

shrewd apex
#

ok try again now

wise lark
#

k

wise lark
shrewd apex
#

choose a interpreter🗿

#

from settings

wise lark
#

il re check again

shrewd apex
#

just do it again

wise lark
shrewd apex
#

just add one manually

#

and it seems u have 3.11 installed in two different places or u didn't delete it first time

wise lark
shrewd apex
#

most probably yeah

wise lark
shrewd apex
#

no ;-;

#

just select 3.11 there if u cannot find 3.10

wise lark
#

click ok then apply?

wise lark
vocal snow
#

damn pycharm seems like ass

shrewd apex
wise lark
#

ok

shrewd apex
wise lark
#

1 thing after another -_-

shrewd apex
#

face of pycharm users gone

glossy flame
#
@bot.event
async def on_cooldown(ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.channel.send("This command is still on cooldown!")```
limber bison
#
    @commands.command()
    async def sm1(self , ctx):

        tst = ["a" , "b"]
        first = random.choice(tst)
        second = random.choice(tst)
        third = random.choice(tst)

        mag = await ctx.send(f"🎰 | :owosloth:")
        await asyncio.sleep(1)
        await mag.edit(content = f"🎰 | {str(first) } | :owosloth:")
        await asyncio.sleep(1)
        await mag.edit(content = f"🎰 | {str(first) } | {str(second)} | :owosloth:")
        await asyncio.sleep(1)
        await mag.edit(content = f"🎰 | {str(first) } | {str(second)} | {str(third)}")

        if first == second == third:
            await message.channel.send("You win!")```
wise lark
#

uh...

shrewd apex
wise lark
#

ok

shrewd apex
#

yeah

vocal snow
glossy flame
#

why does the name of the function matter in if the code works or not??

wise lark
limber bison
vocal snow
#

unless you specify the event name in the deco which you aren't

vocal snow
wise lark
#

i just feel so slow when it comes to this it just feels like i cant keep up bro

vocal snow
shrewd apex
limber bison
vocal snow
#

and did you run the command

limber bison
#

this one

wise lark
vocal snow
#

and did you test the command

wise lark
#

:/

limber bison
limber bison
vocal snow
#

26th character

zealous jay
#

So... I was testing the @commands.is_owner() and the command still works for anyone

#

🛌

#

I have already defined owner_id

vocal snow
zealous jay
#

yes

sick birch
#

That might be why

vocal snow
#

well it's meant for text commands not app commands

sick birch
#

That decorator is for text commands I believe

zealous jay
#

oh

vocal snow
#

!d discord.app_commands.check

unkempt canyonBOT
#

@discord.app_commands.check(predicate)```
A decorator that adds a check to an application command.

These checks should be predicates that take in a single parameter taking a [`Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction "discord.Interaction"). If the check returns a `False`-like value then during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CheckFailure "discord.app_commands.CheckFailure") exception is raised and sent to the appropriate error handlers.

These checks can be either a coroutine or not.

Examples

Creating a basic check to see if the command invoker is you...
zealous jay
#

I guess I'll have to do it myself

cold sonnet
#

owner_id?

#

I thought it checks the owner of the bot in the dev portal

zealous jay
#

oh yeah it looks like it will check in dev portal if the owner_id is not defined

#

but I did it to check if maybe it would work

austere vale
#
  @commands.Cog.listener()
  async def on_member_join(self,member:nextcord.Member):
      role = member.guild.get_role(933983900609441812) 
      await member.add_roles(role)

how can i make it so that it adds new members the role after 10 minutes of joining?

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example of coroutine displaying the current date every second for 5 seconds:
austere vale
#

thank you, trying it now

#
  @commands.Cog.listener()
  async def on_member_join(self,member:nextcord.Member):
      role = member.guild.get_role(933983900609441812) 
      await asyncio.sleep(600)
      await member.add_roles(role)

is it like this?

slate swan
vocal snow
#

doesn't matter

slate swan
#

what if the bot stops

vocal snow
#

why would it do that

cold sonnet
silk fulcrum
#

alright, so I have half of an hour to finish switching to asyncpg, or i'll leave it like it is right now and finish tomorrow, but tomorrow is a busy day so im gonna die

cursive barn
# austere vale thank you, trying it now

so possibly another approach to your problem (im not entirely sure it will work, but am testing it now) would be to set your server moderation setting to High and then once the 10 minute safety period is up the permissions for that member should update automatically to allow them to send messages. You can watch for the permission change through on_member_update

again, not entirely sure if this approach will work, but I can let you know for certain in about 8 minutes. It beats having to asyncio.sleep for 10 minutes I can tell you that.

cold sonnet
#

on start:

for member in guild.members:
    if role not in member.roles:
        if member.joined_at > 10 minutes:
            give role
        else:
            await asyncio.sleep(10mins-(now-member.joined_at))
#

and then gib role

#

except it should make tasks about the last else

cursive barn
#

that would only update everytime the bot restarted

#

making it not even close to what he wants to happen

cold sonnet
#

he can keep the listener bru

cursive barn
#

if he keeps the listener there is no need for that code

cold sonnet
#

yes incase the bot once shuts down

#

it's a fix to a possible problem

#

making the system more stable

cursive barn
#

and cluttered

cold sonnet
#

I'll go translate that

cursive barn
#

and you will be iterating through every single member in a guild, and each one of their roles. causing a huge processing time

cold sonnet
cursive barn
#

its not an efficient solution

cold sonnet
#

what about looping through
list(set(guild.members) - set(role.members))

cursive barn
#

what if the guild has 100K members, and each member has 5 roles?
you are looking at 500,000 iterations to catch what, a maximum of 2-3 members that joined during shutoff?

cold sonnet
#

that sucks

cold sonnet
#

then you don't even need the first if statement

#

is it still too much

#

at that point everything's too much

silk fulcrum
#

and now I have to create postgres database(

paper sluice
#

Nice

cursive barn
# cold sonnet is it still too much

so i set up a set_a and set_b by using the following: py set_a = set(i for i in range(100000)) set_b = set(i for i in range(99998)) and then used the timeit library to compare the operation times for ```py
list(set_a - set_b)

just statistically, if one iteration takes 0.16 seconds and I did 10000, I should expect to see around a 26 minute completion time.
paper sluice
#

You can do set(range(...)) btw

cursive barn
cold sonnet
#

one iteration 0,16sec?

cursive barn
#

yep

cold sonnet
#

that's a lot

cursive barn
#

I think for the proposed use case of 2 users, it seems like a bit much. I know 0.16 seconds is a relatively small amount of time but if you can cut processing time, you should.

cursive barn
cold sonnet
#

ok that's not worth it

limber bison
#

excepts hosting / database anything else need for bot ?

#

which take money ?

silk fulcrum
#

no? also why would db take money?

limber bison
silk fulcrum
#

lmao

#

db limits

limber bison
#

🤔

sick birch
silk fulcrum
# limber bison which one you use ?

I used PostgreSQL (not async), then switched to MySQL (not async) and right now switching to PostgreSQL (async). All of them did not take any money to store certain amount of data, and I don't think mongodb would, ig that's cause of host

limber bison
silk fulcrum
sick birch
#

If you’re going with a good database host they won’t limit your database sizes

slate swan
silk fulcrum
#

i guess he meant Postgres

limber bison
glad cradle
cold sonnet
#

I've returned cuz I think I just got it

silk fulcrum
#

also, hi @slate swan ✌️

slate swan
cold sonnet
slate swan
silk fulcrum
limber bison
#

or come with hosting ?

silk fulcrum
indigo pilot
#

Anyone know if its possible to put buttons on a webhook

glad cradle
silk fulcrum
#

installing minecraft

glad cradle
silk fulcrum
#

uhm... alright gotta remember how to check that

#

omg I forgot how to login there 😳

#

I lost access to host?

indigo pilot
#

not sure what yall are talking about but if your looking for a host just for a bot, and you dont want a vps just find a host with a game panel (ptero), that comes with a mysql database for most hosts then you can upload your files for your bot

silk fulcrum
#

bruh now Hokker will run forever

slate swan
silk fulcrum
#

on old version

silk fulcrum
glad cradle
slate swan
silk fulcrum
glad cradle
#

i don't think it's a VM

slate swan
#

i doubt they would give you a full on VM tho

silk fulcrum
#

i dont even know who they, ya know im 13, so that's my dad's host lmao

silk fulcrum
glad cradle
slate swan
#

the copy paste tho lmao

glad cradle
#

?

#

not a copypaste

slate swan
#

you sure mr

glad cradle
slate swan
#

i guess they use virtualization software and give you ubuntu to access the database server ig

cold sonnet
#

what does that even mean

slate swan
#

🗿

cold sonnet
#

in theory they use a virtualization software that create partitions and install the os, then they assign resources to it and limit some destructive actions

#

I'm gonna send that to everyone so I seem smart

slate swan
#

youre the opposite of smart

cold sonnet
slate swan
cold sonnet
silk fulcrum
#

i remembered that I used a ssh command to log into the host, but I don't remember what goes after it:(

pliant gulch
#

Literally just another word for sandboxed VM

glad cradle
#

bruh

slate swan
#

remembering a command in linux is a skill

silk fulcrum
#

skill issue(

glad cradle
silk fulcrum
#

or was it ssh? now im not even sure(

cold sonnet
#

was I even wrong with just the word space

slate swan
silk fulcrum
#

gonna ask my dad when he comes home

pliant gulch
#
ssh <hostname>@<ip>
cold sonnet
pliant gulch
#

Except I don't know why you would allow root ssh like that for security reasons

silk fulcrum
cold sonnet
slate swan
#

im just here with windows 11lemon_sentimental

silk fulcrum
#

omg i somehow remembered that it's ssh dads_site_url

#

but now I forgot my password AHHHH

slate swan
silk fulcrum
#

because everytime it logged in automatically without asking it

slate swan
#

guess im fatherless

silk fulcrum
#

and now it is

slate swan
#

😔

glad cradle
silk fulcrum
slate swan
#

isnt rm remove?

silk fulcrum
#

yes it is

slate swan
#

i know it cuz of docker 🧠

silk fulcrum
#

niceee my keepass is never bad

#

oh wait I just revealed my dad's site

#

but who cares anyway, it's empty

slate swan
glad cradle
#

.ru are you Russian?

frozen ruin
#

.ru seems sus

silk fulcrum
slate swan
#

random question does it have HTTPS

silk fulcrum
slate swan
glad cradle
#

Good 😈

silk fulcrum
#

😳

slate swan
#

TLS certificates do be pricy

silk fulcrum
#

this is what happens here with my bot...

slate swan
#

skill issue

silk fulcrum
#

issue skill

pliant gulch
silk fulcrum
slate swan
pliant gulch
slate swan
#

ill bing itlemon_imp

pliant gulch
#

Okay

silk fulcrum
# silk fulcrum

dad said when memory ends it uses Swp mem and when it ends it just kills my app. Spoiler: ||my Swp is already full, so when mem ends bot will die||

#

sed

slate swan
frozen ruin
#

Do you know any good hosting site for a bot?

glad cradle
slate swan
limber bison
#

how can bot know wather some some role have or not /

sick birch
limber bison
#

AWS >>>>>>>>>>>>>>>>>>>>>>>>

slate swan
sick birch
glad cradle
sick birch
#

Heroku is decent for that

glad cradle
sick birch
#

Better than using it for a regular websocket based discord bots at least

limber bison
#

how can i find a user have some role or not ?

#

?????????????????????????????????????

slate swan
limber bison
glad cradle
sick birch
slate swan
#

i can show you my esoteric code base

#

😎

glad cradle
slate swan
glad cradle
slate swan
frozen ruin
#

Noooo I have to 'power up' a replit account to use my private repository

glad cradle
limber bison
slate swan
glad cradle
glad cradle
slate swan
#

running on that system64😳

glad cradle
slate swan
#

nope im running on that system69 lemon_imp

frozen ruin
#

Is heroku a decent site to host a bot?

sick birch
#

Not really

glad cradle
sick birch
#

Unless you have an interaction only bot over HTTP

slate swan
glad cradle
slate swan
sick birch
slate swan
#

😎

sick birch
sick birch
sick birch
slate swan
glad cradle
#

then you're a real robozo

slate swan
#

me and robin, were the Robozos

glad cradle
#

robozos team

slate swan
#

im the better robozo tho

#

i got better examples trust😳

glad cradle
#

you're at index 0

slate swan
#
del robozo[1]

bye, bye robin

glad cradle
#

it's robozos

slate swan
#

robozo is an alias for robozos its just not their

#

🧠

limber bison
#

i have user id of a user how can i know he have some role or not !!!!!!!!!!!!!!!!!!!!!!!!!!!

slate swan
#
if role_object in Member.roles:
    ...
limber bison
#

or user a member object

sick birch
limber bison
#

got ittt

slate swan
#

Robin make a pr that adds a new method that returns boolean if a member has a certain role

Member.has_role()
glad cradle
#

btw a user id could be only of a user lmao😕

slate swan
#

I just gave Robin an idea that can make him a high level contributor in dpy

glad cradle
#
Member.is_bozo()

would also be really useful

slate swan
#

im going to go, see ya guys👋

glad cradle
#

bye

slate swan
sick birch
#

Also ambiguous

frozen ruin
#

cya

slate swan
sick birch
#

Rather let the user decide how they want to do it

slate swan
sick birch
glad cradle
slate swan
indigo pilot
slate swan
sick birch
#

No quotes or anything

glad cradle
indigo pilot
slate swan
sick birch
#

You can still store that

indigo pilot
sick birch
#

color = 0xFF0000

indigo pilot
#

does json allow that?

sick birch
#

And pass it in

indigo pilot
#

as im getting it from a json file

sick birch
#

Oh, JSON? No

#

!d hex

unkempt canyonBOT
#
hex

hex(x)```
Convert an integer number to a lowercase hexadecimal string prefixed with “0x”. If *x* is not a Python [`int`](https://docs.python.org/3/library/functions.html#int "int") object, it has to define an `__index__()` method that returns an integer. Some examples:

```py
>>> hex(255)
'0xff'
>>> hex(-42)
'-0x2a'
```  If you want to convert an integer number to an uppercase or lower hexadecimal string with prefix or not, you can use either of the following ways...
indigo pilot
#

yea so how can i convert "0xFF0000" to 0xFF0000

indigo pilot
limber bison
#

AttributeError: 'Member' object has no attribute 'has_role' ???????????????/

glad cradle
#

!d discord.Colour.from_rgb

unkempt canyonBOT
#

classmethod from_rgb(r, g, b)```
Constructs a [`Colour`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour "discord.Colour") from an RGB tuple.
glad cradle
#

!d discord.Colour.from_str

unkempt canyonBOT
#

classmethod from_str(value)```
Constructs a [`Colour`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour "discord.Colour") from a string.

The following formats are accepted...
glad cradle
sick birch
limber bison
#

f

#

but its in check right ?

indigo pilot
sick birch
#

Which is why I said it was redundant

indigo pilot
pliant gulch
#

I spent like 20 some odd minutes writing up a monkey-patched discord.py weakref cache to lower memory footprint then I just scrapped it all

mossy jacinth
#

why cant i add reactions in slash commands?

buoyant quartz
#

By chance someone can enlighten me on how I can force send a message using pycord?

Basically today I send my self some notifications to an email, and after that I want to use pycord to send a message into a discord channel as well, but pycord seems to be very "trigger based", how can I simply just send a message without the need of some user interaction?

glossy flame
#
@bot.event
async def on_message_edit(before, after):
  muted_role = discord.utils.get(after.guild.roles, id = 901514773785636905)
  keywords = ["slay", "sllay", "slllaayy", "slaay", "sslay", "sl@y", "slayed", "sl@ys", "sl🅰️yed", "sllays", "sl🅰️y", "sl🇦yed", "sl🇦y", "siay", "slaaaaaaaaaaaaaaaaaaay", "sláy", "slãy"]
  if after.author.bot:
    return
  content = str(after.content.lower())
  for i in keywords:
    if i in content.replace(" ", ""):
      print(i)
      await after.channel.send(after.author.mention + " Slay? Slay what? Can you slay this mute?")
      await after.author.add_roles(muted_role)
      await after.channel.send(str(after.author)+ " has been muted for 30 minutes.")
      await asyncio.sleep(1800)
      await after.author.remove_roles(muted_role)
      await after.channel.send(str(after.author) + "'s 30 minutes is over.")```
#

on a normal bot.listen it works but on an on_message_edit it apparently has no attribute??

silk fulcrum
silk fulcrum
glossy flame
silk fulcrum
crystal glen
#

How do I find on_something docs

silk fulcrum
#

type on_something there

crystal glen
#

Funny

silk fulcrum
#

what did you search for

crystal glen
#

I want to see all the events

silk fulcrum
#

ohh