#discord-bots

1 messages Β· Page 666 of 1

covert igloo
#

indent looks screwed

ebon island
#

you could probably have it async.sleep(10) or something lol

full valley
ebon island
#

most likely, yeah, but an idea all the same :p

upbeat otter
#

i dont really know how your json file looks like.....

covert igloo
#

its refering to the json file named data.json and in it is {"rev-num":0}

upbeat otter
#

you're dumping the results back tho?

covert igloo
#

Well what I basically wanna do is for example if i send 1 in to the channel

#

i want it to store it

#

and the next time lets say i send 2

#

it would have 3 stored in that json

upbeat otter
#

oh

#

I see

upbeat otter
halcyon folio
#

dont use json as a db πŸ™„

upbeat otter
covert igloo
#

The data stored in the json? Yeah

upbeat otter
#

opening json every message is also not a good idea

covert igloo
#

But it wouldnt be a list it would just be a number

#

How would you recommend I do it

upbeat otter
#

Says a person whose whole bot is based on json

upbeat otter
halcyon folio
#

i recommend you use a database

covert igloo
halcyon folio
#

like sqlite or postgres

covert igloo
#

how simple are they to use

#

cause what i need it for doesnt need it to be complicated

halcyon folio
#

very easy

covert igloo
#

You fine if i hit u up if i got any qs regarding em

small igloo
#

how to make my bot detect multiple reaction and react differently based on the reaction the user reacted?

halcyon folio
#

sure

covert igloo
#

ty ty

halcyon folio
#

i mean you can ask in the databases channel if im not wrong

#

also make sure to use an async lib

covert igloo
#

imma add u up, ill try it out

sullen shoal
#

!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.9)"). 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.9)") 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.9)") 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**...
sullen shoal
#

@small igloo

full valley
#

Who can help me?

Im wanting to add a timer for a command, in the sense that when a command is used, a countdown is set for 30 minutes, if x conditions arent met within the 30 minutes, something happens, else something else happens

slate swan
#
@tasks.loop(seconds=10)
async def messageInterval(ctx, message):
  await ctx.send(message)

@bot.command()
async def taskstart(ctx):
    messageInterval(ctx, "Your message").start()
    await ctx.send("Task ready!")
``` ?
full valley
slate swan
#

πŸ€”

#

use bot.wait_for(check=check())

full valley
#

basically if a user does a command, and requirement x isnt met within 30 minutes, function x will run on the author of the message for the command

slate swan
#
from discord.ext.commands import Bot
from discord.ext.commands.context import Context
from discord.ext import tasks
from asyncio import sleep

bot = Bot("?")

@tasks.loop(minutes=31)
async def checkk(ctx):
    await sleep(60*30)
    raise Exception("Timed out")

@bot.command()
async def tests(ctx : Context):
    def check(message, user):
        return message.author == ctx.message.author
    try:
        checkk.start()
        try:
            k = bot.wait_for("message", timeout=60*30, check=check)
        except TimeoutError:
            checkk.stop()
            return
        if k.content == "Message":
            await ctx.send("Message")
    except:
        checkk.stop()
        await ctx.send("Timed out")

bot.run("token")
``` ?
full valley
slate swan
#

Which event?

#

Or what

full valley
#

Ok so when a user does

!q

if len(playerqueue) == qsize within 30 minutes, then nothing happens,
if len(playerqueue) != qsize within 30 minutes, then I invoke another command for the user

slate swan
#

uhhh

#

Then it is necessary to do a variable with users

#

And then check it constantly

valid galleon
#

can i host a discord.py bot on digitalocean for free?

#

and use a sqlite database with it without the data getting wiped?

maiden fable
boreal ravine
#

use mongo 😎

slate swan
#

mongo is eh to be honest, i prefer sqlite3

boreal ravine
#

nice

slate swan
#

@boreal ravine you were helping me with my verification command the other day right?

boreal ravine
#

i don't recall

slate swan
#

i could be wrong then

#

neverminddd

cloud dawn
#

anything else < sql

boreal ravine
#

jsonc > json

small igloo
#

uh what command to remove user's reaction?

boreal ravine
unkempt canyonBOT
#

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

Remove a reaction by the member from the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.

The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
small igloo
maiden fable
#

O, imagine having bad net

boreal ravine
#

slow :)

small igloo
#

ok πŸ™‚ thanks @boreal ravine @maiden fable

small igloo
maiden fable
#

message.remove_reaction

#

U need a discord.Message object

boreal ravine
#

owo

maiden fable
#

uwu

small igloo
#

bruh momment

boreal ravine
#

!e

b = 's'
print(b.id)
unkempt canyonBOT
#

@boreal ravine :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | AttributeError: 'str' object has no attribute 'id'
boreal ravine
#

show code

small igloo
small igloo
boreal ravine
#

yes

#

what u did

small igloo
# boreal ravine what u did
      await message.remove_reaction(reaction.emoji, name)
      z = game.check_player_index()
      if z == 63:
        game.reset()```
small igloo
boreal ravine
small igloo
boreal ravine
#

!codeblock

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.

boreal ravine
#

@small igloo show full error

boreal ravine
small igloo
boreal ravine
#

weird

valid galleon
maiden fable
maiden fable
boreal ravine
#

hm

small igloo
maiden fable
#

No

small igloo
#

oh ok

#

nice, it works! thankss

cloud dawn
#

Whoa since when is Discord only 7 and 14 boosts for the next level :D

cloud dawn
maiden fable
#

Yea

heavy folio
#

how do i make a command where the bot removes a role from everyone who has it

maiden fable
#

If there are 10 people in your server, it will take 10 API Calls, but removing and making would take only 2

unkempt canyonBOT
#

@compact field, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.

compact field
#

hello guys
i want to create a new webhook with Webhook class
and send messages in text channel
what is the data positional argument ?

user_embed = Embed(title='some', description=f'some',
                           color=0x148500)
        user_embed.set_thumbnail(url='some url')
        wb = Webhook(
            'webhook_url',
        )
        wb.send(embed=user_embed)

__init__() missing 1 required positional argument: 'data'
what is wrong ?

heavy folio
maiden fable
#

!d discord.Webhook.from_url @compact field

unkempt canyonBOT
#

classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
maiden fable
unkempt canyonBOT
maiden fable
#

U gotta loop through them

heavy folio
#

how do i prevent the bot from hitting the ratelimit tho

maiden fable
heavy folio
#

do i just do await asyncio.sleep(1) in the for loop or

#

but then there's some bots which have this removeall command

#

how do they not get ratelimited

maiden fable
#

Yea u can do asyncio.sleep(1) but that's not gonna help much

maiden fable
heavy folio
#

yes

maiden fable
#

Ah. Well they request discord to increase their ratelimits

#

So they get ratelimited less

heavy folio
#

oh

tawdry perch
#

That makes sense, I never have thinked about that

maiden fable
tawdry perch
#

I never read that part of docs

maiden fable
#

Hahaha I read only that part lmao

#

BTW fun fact

#

There's a very huge chance my bot got flagged

tawdry perch
#

Flagged = ?

maiden fable
#

So yea either cz of weird servers my bot is part of or some other reason idk

#

The bigger problem is that they don't even tell if the bot is flagged, soooo

tawdry perch
#

That sucks

#

So if bot is flagged it means?

maiden fable
#

They gonna have an even closer look, meaning more chances of denial

#

And yea, it's been 21 days and 11 business days since I haven't heard from them

#

There's a difference 🀣

slate swan
#

how do I make an if statement to say weather the command is in CoolDown e.g.

@bot.command()
@commands.cooldown(1, 10,commands.BucketType.user)
async def test(ctx):
    await user.send(f'{ctx.author.id}')

and then make an if statement such as
user: !test
5 seconds later user: !test
bot: command in cooldown

maiden fable
#

CD?

#

Ah cooldown?

slate swan
maiden fable
#

!d discord.ext.commands.Command.get_cooldown_retry_after

unkempt canyonBOT
maiden fable
#

!d discord.ext.commands.Bot.get_command

unkempt canyonBOT
#

get_command(name)```
Get a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list of commands.

This could also be used as a way to get aliases.

The name could be fully qualified (e.g. `'foo bar'`) will get the subcommand `bar` of the group command `foo`. If a subcommand is not found then `None` is returned just as usual.
slate swan
maiden fable
#

!d discord.ext.commands.Command.is_on_cooldown

unkempt canyonBOT
maiden fable
#

@yeheboi#8363

brittle jay
#

Hi
I'm quite new in Dislash and I'm trying an example from https://github.com/EQUENOS/dislash.py#creating-buttons

import discord
from discord.ext import commands
from dislash import InteractionClient, ActionRow, Button, ButtonStyle

bot = commands.Bot(command_prefix="!")
inter_client = InteractionClient(bot)

@bot.command()
async def test(ctx: commands.Context):
    # Make a row of buttons
    row_of_buttons = ActionRow(
        Button(
            style=ButtonStyle.green,
            label="Green button",
            custom_id="green"
        ),
        Button(
            style=ButtonStyle.red,
            label="Red button",
            custom_id="red"
        )
    )
    # Send a message with buttons
    msg = await ctx.send(
        "This message has buttons!",
        components=[row_of_buttons]
    )
    # Wait for someone to click on them
    def check(inter):
        return inter.message.id == msg.id
    inter = await ctx.wait_for_button_click(check)
    # Send what you received
    button_text = inter.clicked_button.label
    await inter.reply(f"Button: {button_text}")

bot.run("TOKEN")
```So what I want to do is disable the row of button after a timeout. How can I do that? Thanks.
GitHub

A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...

#

And Ping me when you help

worthy moat
#

did u install dislach?

#

@brittle jay

brittle jay
#

Yes, of course

brittle jay
upbeat otter
placid skiff
#

Guys how i get the guild that user joined using the on_member_join event?

brittle jay
upbeat otter
astral cobalt
#
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.```
#

Does this meen im using to many requests?

astral cobalt
#

How?

brittle jay
brittle jay
upbeat otter
#

Sending too many requests at once results in exceeding ratelimits

brittle jay
#

too many request at a time

tiny ibex
#
PS C:\Users\phoen> & C:/Users/phoen/AppData/Local/Programs/Python/Python310/python.exe c:/Users/phoen/OneDrive/Desktop/main.py
Traceback (most recent call last):
  File "c:\Users\phoen\OneDrive\Desktop\main.py", line 3, in <module>
    from PyQt4.QtCore import *
ModuleNotFoundError: No module named 'PyQt4'```
upbeat otter
tiny ibex
#

How to solve this

brittle jay
#

Is PyQt4 related to discord bots?

astral cobalt
#

@upbeat otter How do I stop it? I only have like 4 function def that do anything

upbeat otter
astral cobalt
#

okie

tiny ibex
tiny ibex
upbeat otter
upbeat otter
#

Or maybe python 3.10 doesnt support it yet

slate swan
upbeat otter
#

Yeah

tiny ibex
stiff nexus
#

how do i get the roles name in MissingAnyRole??

upbeat otter
stiff nexus
astral cobalt
#

@cinder marsh I am hosting the bot on rept it. Is there another good place that you would reccomend hosting it thats free

tiny ibex
# upbeat otter I ran it on 3.9, it should work
C:\Users\phoen>python -m pip install PyQt4
ERROR: Could not find a version that satisfies the requirement PyQt4 (from versions: none)
ERROR: No matching distribution found for PyQt4
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\phoen\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.```
#

WOW

tiny ibex
#

It worked that time

slate swan
astral cobalt
#

23 days per month? So My bot can only be on and active 23/30 days?

slate swan
upbeat otter
slate swan
#

but that would be a pain

tiny ibex
brittle jay
upbeat otter
tiny ibex
#

Or am I

tiny ibex
slate swan
#

Guys is there a way to upload image to imgur because its api is using auth code but its anonymous for humans (without selinium)

tiny ibex
#

I thought I was using python 3.9.8

upbeat otter
upbeat otter
tiny ibex
tiny ibex
#

Why not use selenium?

slate swan
#

for replit

tiny ibex
slate swan
#

because its limited

tiny ibex
#

πŸ˜‚

slate swan
#

and imgur

#

imgbee was good but they don't accept .jpeg files

tiny ibex
slate swan
#

._.

tiny ibex
slate swan
#

I use replit for bot

tiny ibex
#

Use heroku instead

#

Or the best self host

slate swan
#

I can't keep my pc on whole day ._.

tiny ibex
slate swan
#

Student

tiny ibex
#

How does that matter

slate swan
#

Python for fun

tiny ibex
#

You can just leave your PC on and go do whatever you wish

slate swan
#

Parents will nom nom me if I keep my pc on whole day

upbeat otter
slate swan
#

get romanian vds for 1.3€ / month

#

Need a free

#

20€/year

tiny ibex
#

lol

#

I am poor

slate swan
#

4gb ram

tiny ibex
slate swan
#

.....____________________......

upbeat otter
slate swan
slate swan
#

just use a decent webserver from some host

upbeat otter
tiny ibex
upbeat otter
tiny ibex
#

alr

maiden fable
#

@tiny ibex what's the problem

tiny ibex
upbeat otter
#

@tiny ibex of course it doesnt support python 3.10

tiny ibex
#

What bout 3.9.7?

maiden fable
upbeat otter
tiny ibex
# maiden fable What's the issue
C:\Users\phoen>pip install pyqt4
ERROR: Could not find a version that satisfies the requirement pyqt4 (from versions: none)
ERROR: No matching distribution found for pyqt4
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\phoen\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.```
upbeat otter
#

btw, ask from the best programmer present here aka @maiden fable

maiden fable
#

@tiny ibex why r u even installing that 😐

tiny ibex
maiden fable
#

pip install PyQt5

Use this 🀦

slate swan
#

Guys can we upload an image to py embed.set_image()instead of using url?

maiden fable
#

PyQT4 is outdated, use QT5

unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

tiny ibex
maiden fable
upbeat otter
slate swan
#

What if I have bytes?

tiny ibex
#
C:\Users\phoen>pip install PyQt6
Collecting PyQt6
  Downloading PyQt6-6.2.2-cp36-abi3-win_amd64.whl (6.2 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6.2 MB 1.3 MB/s
Collecting PyQt6-Qt6>=6.2.2
  Downloading PyQt6_Qt6-6.2.2-py3-none-win_amd64.whl (43.9 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 43.9 MB 157 kB/s
Collecting PyQt6-sip<14,>=13.2
  Downloading PyQt6_sip-13.2.0-cp310-cp310-win_amd64.whl (78 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 78 kB 5.5 MB/s
Installing collected packages: PyQt6-sip, PyQt6-Qt6, PyQt6
Successfully installed PyQt6-6.2.2 PyQt6-Qt6-6.2.2 PyQt6-sip-13.2.0
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\phoen\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.```It worked!
maiden fable
#

U need to save them first

upbeat otter
slate swan
maiden fable
#

U can use io.BytesIO for that

maiden fable
slate swan
#

IK but which param for file in embed image

tiny ibex
#
PS C:\Users\phoen> & C:/Users/phoen/AppData/Local/Programs/Python/Python310/python.exe c:/Users/phoen/OneDrive/Desktop/main.py
Traceback (most recent call last):
  File "c:\Users\phoen\OneDrive\Desktop\main.py", line 5, in <module>
    from PyQt6.QtWebKit import *
ModuleNotFoundError: No module named 'PyQt6.QtWebKit'  ```
upbeat otter
maiden fable
#

Btw do you know this channel is for discord bots help?

tiny ibex
slate swan
#

Hey! Can anyone suggest how to make script for self replying bot?

slate swan
tiny ibex
slate swan
slate swan
maiden fable
upbeat otter
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.9)"). 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.9)") 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.9)") 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**...
maiden fable
upbeat otter
maiden fable
tiny ibex
maiden fable
maiden fable
slate swan
maiden fable
#

And that last time, was, uhhh, 3 months ago or something

tiny ibex
maiden fable
#

Okay...

tiny ibex
slate swan
#

@maiden fable How do I use image bytes in em.set_image

maiden fable
#

istg sometimes this channel is as dead as me but sometimes active as fuck

slate swan
maiden fable
slate swan
weary gale
#

why won this work

#

am i stupid

slate swan
maiden fable
#

Indent the last line

maiden fable
slate swan
#

and indent

slate swan
slate swan
maiden fable
weary gale
#

wait that matters?

#

i was just testing

shadow wraith
#

wait

slate swan
#

also what r u trying to make with the description

#

list of strings?

shadow wraith
#

why aren't you using @bot.command()

#

your using @bot.command not @bot.command()

#

oh yeah and indent

#

good notice adx

weary gale
#

ok i made it @bot.command()

slate swan
#

just add 1 tab

#

last line

tall dust
#

please don't use ableist language

weary gale
#

oh

#

u literally press tab

#
    await ctx.send(embed=embed)
    ^
IndentationError: unexpected indent```
#

error that comes up

#

idk why i cbed that

slate swan
weary gale
#

i did

slate swan
#

!indention

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
slate swan
weary gale
#

oh wait

#

got it sorry

slate swan
upbeat otter
weary gale
#

thx

astral cobalt
#

How do I run my bot locally? Instead of uploading to the server every time

#

Or should I be pushing to the server everytime I make a change and what to test it

slate swan
#

literally no difference

#

just run the .py

#

as long as u got the same token

slate swan
worthy moat
#

help
error:

C:\Users\Szymon\Desktop\MauBot\main.py:112: RuntimeWarning: coroutine 'sleep' was never awaited
  asyncio.sleep(0.5)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py:85: DeprecationWarning: logout is deprecated, use Client.close instead.
  ret = await coro(*args, **kwargs)
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000291D4B97F40>
Traceback (most recent call last):
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
    self._check_closed()
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000291D4B97F40>
Traceback (most recent call last):
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
  File "C:\Users\Szymon\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed

Szymon is my username and MauBot is my bot name

#

Code:

@client.command(name='restart', alliases=['restart'])
async def Restart(ctx):
        if ctx.author.id in teamid:
            await ctx.send(f'Bot zostanie zresetowany w przeciΔ…gu 5 sekund', delete_after=0.5)
            asyncio.sleep(0.5)
            await ctx.send('Restartowanie...', delete_after=1)
            try:
                await client.logout()
            except EnvironmentError as e:
                print(e)
                client.clear()
            await ctx.send('Bot zostaΕ‚ zresetowany pomyΕ›lnie')
        else:
            ctx.send(f'UΕΌyΕ‚eΕ› komendy ktΓ³ra jest przeznaczona tylko dla niektΓ³rych osΓ³b')
            ctx.send(f'Jeżeli sytuacja się powtórzy jeszcze kilka razy możesz dostać gbana')
visual island
#

await asyncio.sleep(...)

#

coroutine 'sleep' was never awaited the error says it all

worthy moat
#

i changed this
Error:

unkempt canyonBOT
#

Hey @worthy moat!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

slate swan
#

can someone tell me how do I know which file path is going to the user?

#
    number = random.randint(1, 99)
    wow = random.randint(100, 140)
    f_path = "./vote_rewards/reward "
    g_path = "./vote_rewards2/reward "
    f = discord.File(f_path+ str(number)+".jpeg", filename="vote_rewards.jpeg", spoiler=False)
    g = discord.File(g_path+ str(wow)+".jpeg", filename="vote_rewards2.jpeg", spoiler=False)
    embed = discord.Embed(title="Konichiwa Goushinjin-sama", description="**Arigcato Gosaimushta For Voting, Here Is Your Reward**", color=0xcf24ff)
    embed.set_image(url="attachment://vote_rewards.jpeg" or "attachment://vote_rewards2.jpeg")
    choices = [f,g]
    random.choice(choices)
    user = await bot.fetch_user(message.content)
    await user.send(files=[f, g], embed=embed)```
worthy moat
slate swan
#

i tried
print(files.fp) or
print([f,g.fp])
both arent working

worthy moat
#

@visual island

visual island
worthy moat
#

k

visual island
#

again it's shown in the error DeprecationWarning: logout is deprecated, use Client.close instead.

unkempt canyonBOT
#

Hey @worthy moat!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

β€’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

β€’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

slate swan
#

is it possible to make it send messages randomly in random servers, like " Hey Pepe_Gun "

slate swan
#

discord user?

slate swan
slate swan
worthy moat
slate swan
#

message.author.mention and remove <@> from it

astral cobalt
#

I cant get the reddit api to properly print a picture to the discord

visual island
astral cobalt
#

nothing fails but it will just not print anything

slate swan
#

or get_user() might work

upbeat otter
# slate swan how

just an example:

guilds = bot.guilds #all the guilds bot is in
for ids in guilds.channels: #iterating
  guild_ids = ids.id #storing the ids
  for guilds in guild_ids: #iterating through guilds
    guild = bot.get_guild(guilds) #fetching the guild
    #get the channels by iterating and using the .id method on it and use .send method
slate swan
visual island
slate swan
#

its just idk how to send 1 random image from any 2 folders

slate swan
#
import discord
from discord.ext import commands
from discord.ui import Button,View
class Mybutton(Button):
    def __init__(self,ctx,label):
        super().__init__(label=label,style=discord.ButtonStyle.green,emoji="πŸ‘")

        self.ctx = ctx

        async def callback(self,interaction) -> None:

            if interaction.user.id == self.ctx.author.id:

                return await interaction.response.send_message(f"hello {self.ctx.author.name}") 

            return await interaction.response.send_message(f"HEY !{interaction.user} you are not {self.ctx.author.name} why did you click the button ?!?!")

class buttons(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    @commands.command()
    async def test_button(self,ctx):
        button = Mybutton(ctx,"click me lmao")

        view = View()
        view.add_item(button)
        await ctx.send("button",view=view)
def setup(bot):
    bot.add_cog(buttons(bot))``` why does the button not reply ?
upbeat otter
slate swan
upbeat otter
#

its a really raw example, you can see the other things like fetching the channels and limiting the loop

worthy moat
slate swan
slate swan
upbeat otter
worthy moat
visual island
slate swan
#

import random
var = random.choice["filepath1", "filepath2]
file = open(var, "r")

worthy moat
#

so command work yes?

slate swan
slate swan
#

but once 3-4 hours

visual island
worthy moat
#

oh okay thx

slate swan
slate swan
maiden fable
#

No

#

asyncio.sleep works

slate swan
slate swan
maiden fable
#

Whyyy

#

It's gonna block the whole bot

slate swan
#

whole bot aPES2_Sweat

#

yeah py await asyncio.sleep(x)

#

sys.exit()

slate swan
#

always works perfectly

#

ty ty for reminding me

slate swan
#

sys.exit() ❌
os.system("sudo rm * ") βœ…

boreal ravine
#

h

slate swan
# slate swan import random var = random.choice["filepath1", "filepath2] file = open(var, "r")

like dis?

 number = random.randint(1, 99)
    wow = random.randint(100, 140)
    var = random.choice[f"./vote_rewards/reward + str{number}+'.jpeg'", f"./vote_rewards2/reward + str{wow}+.'jpeg'"]
    file = open(var, "r")
    embed = discord.Embed(title="Konichiwa Goushinjin-sama", description="**Arigcato Gosaimushta For Voting, Here Is Your Reward**", color=0xcf24ff)
    embed.set_image(url="attachment://vote_rewards.jpeg" or "attachment://vote_rewards2.jpeg")
    user = await bot.fetch_user(message.content)
    await user.send(files=var, embed=embed)
    print(var.fp)```
royal jasper
#
@fpr.command(name='registro')
async def registrar(ctx):

    member = ctx.author
    guilda = ctx.guild
    idforcheck = ctx.author.id

    randomstr = (''.join(random.choice(string.ascii_uppercase + string.digits)
        for _ in range(7)))
    randomvar = str(randomstr)

    def check(m):
        return m.author == ctx.author

    def check_random(m):
        return m.author == ctx.author and m.content == randomvar

    await member.send(f'**verify** | please, type dis code: `{randomvar}` for register.')
    codigor = await fpr.wait_for("message", check=check_random)
    await asyncio.sleep(3)
    await member.send('**registering** | wait a minute.')
    await asyncio.sleeo(10)

    player = discord.utils.get(guilda.roles, name="πŸ‘₯・Jogadores")
    await member.add_roles(player)
``` im trying to do a register command... but the bot do not recognize the penultimate lines.... can any1 help me?
astral cobalt
#
@client.command()
async def get_meme(ctx):
    print("In here")
    memes_submissions = await reddit.subreddit('memes')
    memes_submissions = await memes_submissions.hot()
    post_to_pick = random.randint(1, 10)
    for i in range(0, post_to_pick):
        submission = next(x for x in memes_submissions if not x.stickied)
    await ctx.send(submission.url)``` Anyone know why this returns ```RuntimeWarning: Enable tracemalloc to get the object allocation traceback``` Am I missing an await somewhere that im not seeing?
slate swan
visual island
maiden fable
upbeat otter
#
for channel in original_guild.channels:
        channel_id = channel.id 
        fetched_channel = await client.fetch_channel(channel_id)
        await fetched_channel.send(".....")

why does this return "CategoryChannel" object has no attribute 'send'

maiden fable
upbeat otter
#

oh lol

maiden fable
#

It's also a channel type in dpy

upbeat otter
#

smh, how do I ignore those ,-,

astral cobalt
#

@maiden fable It says that memes_submissions = await reddit.subreddit('memes').hot() is missing it

#

but its not

visual island
upbeat otter
visual island
#

!d isinstance

unkempt canyonBOT
#

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

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

I am really back with classes and stuff lmao

maiden fable
#

istg mobile sucks sometimes

upbeat otter
maiden fable
#

Don't ask how to use it now, else.... nvm

upbeat otter
maiden fable
#

Just saying

visual island
maiden fable
upper apex
#

I'm using the CodeCogs API to get a LaTeX image, but the text is black. Anyone know how to turn it into white text?

slate swan
#

how do i get input on discord.py? im trying to figure out how to do stuff like
?gennumber 0,100
then it'll do

for i in range(0,100)
 ctx send (i)
worthy moat
#

how can i change my bot status?

wanton veldt
#

@worthy moat i will send you in dm in 2 m

astral cobalt
craggy cloak
#
@client.command()
async def test(ctx):
  button = Button(label="Click me!", style=discord.ButtonStyle.green, emoji="πŸ‘")
  view = view()
  view.add_item(button)

  await ctx.send("Hi!", view=view)

What is rong here?

shadow wraith
#

hey wasn't there a case_sensitive check for discord.py i swear there was i think

#

oh yeah there was but whenever i set the value to False it breaks :c

wanton veldt
#

@worthy moat check your pm

obsidian ledge
sage otter
sage otter
small igloo
#

hi, does anyone know how to make bot search random image on google and upload it?

slate swan
#
import discord, os
from discord.ext import commands
from decouple import config
from lib import db
from time import perf_counter
import datetime

Token = "I deleted on purpose"

client.run(Token)
print("Launch successful")

Traceback (most recent call last):
File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 1, in <module>
import discord, os
ModuleNotFoundError: No module named 'discord'

sage otter
#

Install the module then?

slate swan
#

ohh

#

im an idiot

wanton veldt
#

xd

small igloo
slate swan
#

how do I make a command which picks a ranom record from sql database and sends in as an output

@bot.command()
async def test(ctx):
 player = ctx.author
 conn = sqlite3.connect('list.sql')
 c = conn.cursor()
 wala = discord.Embed(title='It Seems Goshujin-sama You Have Already Participated In The Giveaway', description='**Good Luck**', color=0xcf24ff)
 gg = c.execute(f"SELECT * FROM list WHERE ID = {player.id}")
 if c.fetchone() is not None:
  await ctx.send('Goshujin-sama You Have Already Participated In The Giveaway')
 else:
  c.execute(f"INSERT INTO list VALUES({player.id})")
  conn.commit()
  conn.close()
  await ctx.send(embed=wala)```
this is the code to enter the user.id in the sql database
slate swan
small igloo
#

E does anyone know how to make bot search random image on google and upload it?

slate swan
slate swan
small igloo
sage otter
#

Why are you using f strings in sql

#

Very bad practice

astral cobalt
#

When I make a reddit meme definition it doesent seem to work, im using asyncpraw. It wont return an actual value and print something to the user. Anyone have any tips?

small igloo
slate swan
shadow wraith
sage otter
small igloo
# slate swan think for few mins to understand

my brain processed that as:

  • dunno what's Ixml and xpath
  • random to make the bot search randomly
  • href is the hyperlink
  • separate the link and make it an uh... string?
  • also send the link after that

this?

shadow wraith
#

i dont have an issue but i made a report system with 3 lines of code :troll: (exclude the @report.error)

sage otter
#

pip install discord.py ??????

slate swan
sage otter
#

Alternatively discord.py[voice]

slate swan
shadow wraith
#

bru

#

then install discord and os seperately

sage otter
#

oogh what

shadow wraith
#

or if that doesn't work either, git clone discord.py (i thought of that πŸ’€ )

sage otter
#

os is in the standard package library.

small igloo
shadow wraith
#

and extra stuff when you git clone discord.py:

  • discord buttons
  • discord selects
slate swan
small igloo
slate swan
#

i dont spoonfeed

shadow wraith
slate swan
shadow wraith
#

i only understand from examples and my brain

small igloo
#

k, thanks btw for the answer

shadow wraith
#

because today i just learned that using bot.get_channel() you can do anything with the channel.var

slate swan
#

@small igloo tip: go to the search bar and think of a keyword that best describes what u need and see if anyone else had the same issue and got spoonfed

shadow wraith
#

tbh stack overflow awesome

slate swan
shadow wraith
#

i wanna make my report system more complicated because its just this crap:

 await ctx.send(f"report sent to the admins, {member} will be checked soon")
    reportChannel = bot.get_channel(918056493142671370)
    await reportChannel.send(f"{member} was reported for {reason}")
#

:troll:

small igloo
slate swan
#

its just that you can see other questions and get answers
but cant ask cuz i tried when i was new and everyone said just read docs and you will get it and its true

slate swan
slate swan
small igloo
slate swan
#

if you know what the problem is, its half solved

slate swan
shadow wraith
small igloo
astral cobalt
#

anyone know why asyncpraw wont let me actually get anything from reddit?

slate swan
#

@small igloo I copy paste a lot too, my tip for now is to go do something and come back in like 5 hours and ask again when there’s a new group of people in chat

small igloo
#

oh, one question, why discord component's InteractionType got removed-

slate swan
# small igloo ok, thanks

if you want examples
press f12 is chrome browser
and use the element inspect and click on anything then it wil open an element page and left click and copy full xpath and you will get xpath

shadow wraith
#

y'all really like spoonfeeding, mine is somewhat similar i just understand from examples

slate swan
#

e.g.
this is the full xpath of #discord-bots
/html/body/div[1]/div[2]/div/div[2]/div/div/div/div/div[1]/nav/div[3]/div/div[23]/div/div/a/div[2]/div

slate swan
small igloo
shadow wraith
#

or 4 because that would be 12 hours

slate swan
#

If u come back too quick there’s a chance they will spread the news that you’re trying to copy paste and you’ll have to repeat the process of waiting

small igloo
sage otter
#

Does no one PEP8

slate swan
slate swan
slate swan
small igloo
shadow wraith
#

because the only things special about the webhook is identical to a discord bot iself

slate swan
slate swan
weary gale
#
@bot.command(aliases = ['mc'])
async def membercount(ctx):
  countembed=discord.Embed
  (title = 'membercount', description = '{member.guild.member_count}')
  await ctx.send(embed=countembed)```
anybody know why this isnt working?
shadow wraith
#

wtf is member defined as

small igloo
shadow wraith
#

nothing, so define it or use ctx

slate swan
slate swan
weary gale
shadow wraith
weary gale
#

um

slate swan
slate swan
shadow wraith
#

because if you are gonna use {member} in your code

#

then it has to be defined

weary gale
#

oh

small igloo
slate swan
slate swan
slate swan
shadow wraith
weary gale
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 |     if any(word in msg for word in sad_words):
003 |                                               ^
004 | IndentationError: expected an indented block after 'if' statement on line 3
shadow wraith
#

!e

@client.event
async def on_message(msg):
    if any(word in msg for word in sad_words):
      print("bruh")
unkempt canyonBOT
#

@shadow wraith :x: Your eval job has completed with return code 1.

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

pog

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

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

@small igloo 4 hours and 50 minutes to go! yay

shadow wraith
#

dude why are you trying to run your bot's code with @unkempt canyon

weary gale
#
async def membercount(ctx):
  countembed=discord.Embed
  (title=f'membercount', description=f'{member.guild.member_count}')
  await ctx.send(embed=countembed)```
weary gale
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 3
002 |     print("tEsT")
003 |     ^
004 | IndentationError: expected an indented block after 'if' statement on line 2
sage otter
unkempt canyonBOT
#

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

[No output]
weary gale
sage otter
#

It needs to be ctx.guild.member_count

sage otter
#

Tf

#

Swap Message with msg.content

weary gale
#

what

sage otter
# weary gale what

Was talking to the guy above, not you. As far as syntax errors, that’s all you. Basic python support doesn’t go in this channel.

astral cobalt
#
top = subreddit.top(limit=200)
async for submission in top:
  all_subs.append(submission)``` Anyone know why this forloop doesent break?
dim vapor
#

how to create server invite? i tried print(channel.create_invite()) but it just prints <coroutine object GuildChannel.create_invite at 0x7f7f5dba4440>

obsidian ledge
#

how do i make a command that sends something to another channel after someone has sent the command?

#

like if the command was "~hello", the bot would send the author's username and tag to another channel

slate swan
#

Um guys am I doing something wrong??py await client.change_presence(activity = discord.Streaming(url="https://www.google.com", name=f"with {initiates+officials} PHGs"))

sage otter
dim vapor
sage otter
dim vapor
sage otter
#

await it

#

I forgot that’s a coro

dim vapor
#

okk

#

nope

#

still the same thing

velvet tinsel
#

Yes

#

It’s working why tf did you ask why it’s not working

#

πŸ’€

#

Lmao πŸ˜‚

dim vapor
# sage otter I forgot that’s a coro

i converted that to a dir and this is what i get

['await', 'class', 'del', 'delattr', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'name', 'ne', 'new', 'qualname', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'close', 'cr_await', 'cr_code', 'cr_frame', 'cr_origin', 'cr_running', 'send', 'throw']

slate swan
dim vapor
#

dont see url there

velvet tinsel
velvet tinsel
#

It says

#

Playing

slate swan
velvet tinsel
#

pithink there’s a streaming

dim vapor
# velvet tinsel What’s the problem ?

i want to generate invite link if i do print(channel.create_invite()) it says <coroutine object GuildChannel.create_invite at 0x7f7f5dba4440> tried channel.create_invite().url and channel.create_invite().link nothign worked

velvet tinsel
#

Try making a custom status

slate swan
slate swan
velvet tinsel
slate swan
#

Let me try

dim vapor
# slate swan ```py print(await channel.create_invite())```

still same thing but ['BASE', 'class', 'delattr', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'slots', 'str', 'subclasshook', '_state', 'approximate_member_count', 'approximate_presence_count', 'channel', 'code', 'created_at', 'delete', 'from_gateway', 'from_incomplete', 'guild', 'id', 'inviter', 'max_age', 'max_uses', 'revoked', 'temporary', 'url', 'uses'] if i do dir(object) i see url in that

#

nvm

#

storing it in a variable and then doing .url worked

slate swan
dim vapor
dim vapor
#
obj = await channel.create_invite(max_age = 300)
print(obj.url)

worked

#

thanks!

royal lichen
#

before it was awaited

dim vapor
royal lichen
#

Thats just them printing our the dir of the object

dim vapor
#

^

slate swan
sage otter
#

what the hell lmao oogh

cloud dawn
royal lichen
dim vapor
#

i figured it out

sage otter
dim vapor
#

ya

sage otter
#

Instead of making a one time use variable you could just do it all in one line

dim vapor
#

yep okk thanks!

slate swan
royal lichen
#

Yes they said that in that message

cloud dawn
slate swan
#

but if it is then you could dopy dir(output)['url']

royal lichen
#

No

#

Thats not how a list works

dim vapor
slate swan
slate swan
#

I have edited it, i forgot it was a list

dim vapor
#

ugg

#

its not a list

sage otter
#

I can’t tell if you're trying to code golf or just shitpost at this point m.

dim vapor
#

and i figured it out lol

slate swan
#

ok let lets drop the topic pithink

cloud dawn
#

!d discord.ext.commands.Bot.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
slate swan
cloud dawn
tiny ibex
#

Is

slate swan
tiny ibex
#

For the streaming status you need one

slate swan
tiny ibex
slate swan
#

await client.change_presence(activity = discord.Streaming(url="https://www.google.com", name=f"with {initiates+officials} PHGs"))

cloud dawn
#

Well that is the kwarg of discord.Streaming not change presence..

#

I see

tiny ibex
#

You need a twitch url

#

Any other url will give out errors

cloud dawn
#

Or youtube

slate swan
#

let me get a ss

#

wait a minute

tiny ibex
slate swan
slate swan
tiny ibex
#

What's the issue in adding a valid url?

slate swan
#

IDK I just don't want my users to redirect there

sage otter
tiny ibex
slate swan
tiny ibex
#

πŸ‘€

sage otter
#

I am

#

I literally just tested it with an eval

tiny ibex
#

I never did it so idk

slate swan
#

and..........

sage otter
#

it works

slate swan
slate swan
sage otter
#

yeah

#

so is your problem resolved yet. I can’t even tell what’s going on tbh.

tiny ibex
#

WoW I am gonna try it

slate swan
#

Maybe discord changed the way they worked

green brook
#

hi

upbeat otter
#

guys, anybody's got any idea if I can use replit's database locally?

slate swan
#

._.

upbeat otter
maiden fable
slate swan
upbeat otter
#

wdym

maiden fable
#

nvm

#

Uhhh wait I think u can

upbeat otter
#

....okay

maiden fable
#

seems like u can

upbeat otter
#

oh, thankie

maiden fable
#

(:

cloud dawn
#

Accessing a DB through ftp or sftp would be weird aswell lol

maiden fable
#

it is using a url tho

#

but I don't think u can use SFTP with replit db, can u?

small igloo
#

what is the best free hosting web 24/7?

tiny ibex
#

Or if you asking bout the best it is self hosting

small igloo
small igloo
tiny ibex
#

Simple

#

Β―_(ツ)_/Β―

small igloo
#

but not 24/7 :l

tiny ibex
#

It depends on you

#

Β―_(ツ)_/Β―

small igloo
tiny ibex
small igloo
#

burh the tab automatically reload ;-;

maiden fable
#

@tiny ibex fixed that error?

tiny ibex
maiden fable
#

ouch

tiny ibex
#

What tab are you talking bout

small igloo
tiny ibex
small igloo
tiny ibex
#

Use your own PC

#

Repl sucks

small igloo
fringe harness
#

@muted lynx ?

tiny ibex
small igloo
tiny ibex
small igloo
#

lemme try

tiny ibex
#

As a matter of fact it's better than using replit

#

replit is slow

#

And you got storage issues ofc

sage otter
#

That’s subjective. That’s also dependent on many factors.

tiny ibex
tiny ibex
small igloo
tiny ibex
sage otter
#

Some people have really shit pcs. Electron apps like vsc can be pretty heavy memory wise and effect people with those shit pcs. And if that’s the case they probably can’t even hold a respectable IDE like pycharm or something.

small igloo
sage otter
#

Replit in that case could be more performant as a DE

tiny ibex
#

Simple

tiny ibex
tiny ibex
#

Replit is no way good

small igloo
sage otter
tiny ibex
small igloo
tiny ibex
sage otter
#

Not really

small igloo
sage otter
#

That’s still pretty shit

tiny ibex
#

Repl is slow

small igloo
sage otter
#

There’s not really any good alternatives for free hosting

tiny ibex
#

Repl is not made for hosting

#

And not hosting discord bots at all

sage otter
#

And heroku isn’t meant for hosting discord bots either AMshrug

#

Like hunter said dpy tags go brr

tiny ibex
small igloo
sage otter
#

Either way it’s a lose lose situation

small igloo
tiny ibex
tiny ibex
upbeat otter
sage otter
#

Not really

#

Get a vps

tiny ibex
#

Bahhahhha I am poor

small igloo
small igloo
upbeat otter
#

ok bye

tiny ibex
small igloo
sage otter
#

I got like 16

upbeat otter
small igloo
small igloo
tiny ibex
tiny ibex
small igloo
sage otter
#

Which is money ye

tiny ibex
maiden fable
sage otter
#

Honestly you don’t really need much

tiny ibex
sage otter
#

A small to medium size discord bot doesn’t even need a gig of ram

tiny ibex
upbeat otter
tiny ibex
#

I can do that on my pc

upbeat otter
sage otter
#

Couldn’t imagine keeping my computer on 24/7

maiden fable
tiny ibex
tiny ibex
sage otter
#

well you keeping your computer up 24/7 isn’t really good for your computers health either

maiden fable
#

facts

small igloo
#

ok, what website to gain money easily

sage otter
#

Especially if you're on a laptop. You’ll burn the battery out.

small igloo
small igloo
maiden fable
tiny ibex
#

My bot only in 3 servers but takes around 0.5k gb

maiden fable
#

HunAI hardly takes 250 MB RAM

tiny ibex
maiden fable
#

lemme see the exact number

small igloo
maiden fable
#

Don't you have to study Eevee

upbeat otter
tiny ibex
upbeat otter
sage otter
#

That’s really not true

maiden fable
#

And then there is me who has an exam on Monday but studies on Sunday 😐

small igloo
sage otter
#

If you have a good pc you’ll still degrade performance keeping it constantly 24/7

maiden fable
#

anyways its ot

tiny ibex
small igloo
#

who wanna test my half-done discord bot

maiden fable
#

its taking 152.34 MB RAM and 0.16% CPU

tiny ibex
small igloo
maiden fable
#

with members intent

tiny ibex
maiden fable
tiny ibex
#

And zoom is heavier than his bot

small igloo
#

no one wanna test my bot?

tiny ibex
#

I do

#

@small igloo

small igloo
#

yayy

#

ok, wait, emme give da link

tiny ibex
#

Sure !

gaunt wedge
#

hi, sorry if this is a dum question, but does discord.py support message components like buttons yet?

slate swan
#

C:\Users\ADMIN\PycharmProject\Fluxo>python main.py
Traceback (most recent call last):
File "C:\Users\ADMIN\PycharmProjects\Fluxo\main.py", line 10, in <module>
client.run(Token)
NameError: name 'client' is not defined

import discord
import discord, os
from discord.ext import commands
from decouple import config
from time import perf_counter
import datetime

Token = "OTE4ODIyMTE2MDg0ODQyNTE3.YbM1xw"

client.run(Token)

maiden fable
#

yea

#

😐

sage otter
slate swan
gaunt wedge
# maiden fable yea

i've searched over the documentation but it doesnt lead me to anything, how do i add buttons?

maiden fable
gaunt wedge
#

ah

#

i thought the pypi one is the same as the one on github

#

so cmd pip install git+https://github.com/Rapptz/discord.py?

sage otter
#

Nope

upbeat otter
sage otter
#

The one on pypi is 1.7.somethingiforgot

upbeat otter
gaunt wedge
sage otter
#

Because Danny

#

that’s really all

upbeat otter
gaunt wedge
#

so its not official release?

upbeat otter
gaunt wedge
#

well makes sense

gaunt wedge
sage otter
#

There should be a category attr for text channels and voice channels

#

Just gotta look at docs

sage otter
gaunt wedge
#

ah

#

but once its 100% officially released itll be on pypi

upbeat otter
gaunt wedge
#

ok thx

upbeat otter
maiden fable
#

ahem ahem

upbeat otter
maiden fable
upbeat otter
gaunt wedge
#

now that i installed v2 how do i even implement it πŸ˜‚

maiden fable
#

!d discord.CategoryChannel.channels

upbeat otter
unkempt canyonBOT
#

property channels: List[GuildChannelType]```
Returns the channels that are under this category.

These are sorted by the official Discord UI, which places voice channels below the text channels.
maiden fable
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.
maiden fable
#

!d discord.ui.View

unkempt canyonBOT
#

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

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

New in version 2.0.
maiden fable
#

!d discord.TextChannel.send has a view kwarg now

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
gaunt wedge
slate swan
slate swan
sullen shoal
#

that's only one part of it

slate swan
#

Are there any coders who want to work on projects

sullen shoal
#

what kind of project

slate swan
#

Simple discord bots APIs and website

slate swan
sullen shoal
#

so discord bot with a webserver for it?

slate swan
sullen shoal
#

or two different project

slate swan
#

Different projects

boreal ravine
#

hm

sullen shoal
#

discord bot development is kinda boring for me now so that would be a no from me

slate swan
#

And website and apis

full valley
#

How can I create a private voice channel for particular members then know when they all join and then leave it?

sullen shoal
#

no for website kinda stuff but maybe api. however it depends

slate swan
#

Ok will you join my server

full valley
#

Quite stuck on this Think

gaunt wedge
#

i saw a bot sending a message that is only for me on a channel, how do i do the exact same thing?

sullen shoal
gaunt wedge
#

its just a command, when i press a button it just gives me the private message thing

slate swan
#

Yes possible

sinful pasture
#
  
....
if message.content.startswith('a'):
      await message.channel.send(insult)```

so here, the bot is supposed to send a random insult from the list but whatever it sends comes out between [], is there a way to stop this
full valley
sinful pasture
#

nope

#

only like 44 sentences of insults, all of which are separately between ' ' and with commas

gaunt wedge
full valley
#

so like ['a','b','c']

sinful pasture
#

yeah

#

happened with my dadjoke bot too :c