#discord-bots

1 messages · Page 656 of 1

manic wing
#

it just confuses the person who wants help

maiden fable
#

Well yea that's true

manic wing
#

theres no need to call it ctx, its like calling self FUCK

#

!e class x:
def init(FUCK): print(FUCK)
x()

unkempt canyonBOT
#

@manic wing :white_check_mark: Your eval job has completed with return code 0.

<__main__.x object at 0x7fbbd1ec0eb0>
manic wing
#

its not necessary

#

and confuses people

maiden fable
#

😐

plain prairie
#

@livid hinge

full valley
#

Who doesn’t use ctx KEKW

#

It’s not confusing

manic wing
unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

when people ask for help now, im going to give them the most esoteric answer.

boreal ravine
#

ok idiot ¯_(ツ)_/¯

livid hinge
#

let's use _

languid jungle
#

!mute 298043305927639041 2d You've been told to be mindful of your language and about our expectations on how members are supposed to behave. Please re-re-read our #code-of-conduct , if you haven't already.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @manic wing until <t:1638953275:f> (1 day and 23 hours).

maiden fable
languid jungle
boreal ravine
maiden fable
#

;-; why drama literally every other day here

boreal ravine
#

???

maiden fable
#

Not saying to u

#

Just a general thing

#

Nvm I better not fuel the argument here sorry everyone

languid jungle
#

!mute 656073353215344650 1D Name calling isn't appreciated here, even if you didn't start it. You should know this by now. If you have an issue with a member, DM ModMail. Re-read our #code-of-conduct .

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @boreal ravine until <t:1638867117:f> (23 hours and 59 minutes).

full valley
#

Poor Kayle

#

Helps out so much :(

maiden fable
#

Yea

verbal cairn
#

Do tasks work with slash commands

maiden fable
#

Yea ig

verbal cairn
#

Idk how to work with tasks

#

I make it then I’m lost

shadow wraith
#
@bot.command()
@commands.has_any_role('Bot Developer', 'staff')
async def warm(ctx, member: discord.Member):
    Warmed = discord.Embed(title=f"{member} has been warmed", description=f"{member} has been warmed", color=discord.Colour.yellow())
    await ctx.send(embed=Warmed)
``` for some reason when i run my bot this command won't work
#

one second ill try doing ctx: commands.Context

shadow wraith
#

true

#

but do you have a fix because i dont see anything wrong

verbal cairn
#

Prob the has_any_role part

copper gulch
#

or maybe their server roles

verbal cairn
#

Wouldn’t it be command not commands

serene lynx
#

Excuse me, I want to ask, if you want to count the number of announcements, which channel do you use?

serene lynx
#

use ctx.guild.system_channel ?

verbal cairn
visual island
#

iterate through guild.channels then use isinstance()

#

oh, number of announcement message?

serene lynx
#

number of announcements channel in pycord]

#

like this

shadow wraith
visual island
shadow wraith
#

but my other commands use commands

serene lynx
verbal cairn
shadow wraith
#

my guy broke an elbow the reason why it's commands is because of from discord.ext import commands

#

and idk wtf an api link is ¯_(ツ)_/¯

verbal cairn
#

????

#

So u don’t know what ur doing

#

Make a list of words then use it on that

#

Well not randint

#

Idk I’ve only used random once

visual island
#

!d random.choice

verbal cairn
#

Just use randint then use the number as an index

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
full valley
#

Is there a way to duplicate command, but have them do different things in different channels

#

Obviously I could put two big if statements, but yeno

slate swan
verbal cairn
full valley
verbal cairn
#

Which is

full valley
#

Theres quite a few of them

#

main two being queue and leave

sullen shoal
heavy folio
#

how do i get the guild's members listed in this format: ```py
Member#1234
Member#1234
Member#1234
Member#1234
Member#1234

sullen shoal
#

cast the member object to str

verbal cairn
#

After each member

sullen shoal
#
map(str, [...])```
#

will get you the list

#

!d map

unkempt canyonBOT
#
map

map(function, iterable, ...)```
Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterable* arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see [`itertools.starmap()`](https://docs.python.org/3/library/itertools.html#itertools.starmap "itertools.starmap").
full valley
sullen shoal
full valley
#

right

#

gotcha ty

verbal cairn
#

No one knows how to use tasks bru

sullen shoal
# full valley right

another way would be to just check ctx.channel and do the code according to that using if statements or match-case if python 3.10

full valley
#

yeah.. would just be massive commands then

sullen shoal
#

you can make them differently then just invoke them manually

full valley
#

mhm I think I'll do that, just in the other if statement just invoke the other command if its in the other channel

hoary gust
#

guys in a on_member_join event i should do member.kick() or member.guild.kick()?

maiden fable
#

First one

#

But why do u wanna do so

hoary gust
#

thanks

hoary gust
#

havent coded bots from 2 months and became rusty

faint monolith
#

I wanna setup random answering in my bot. What should i do?

faint monolith
hoary gust
#

!pypi prsaw

unkempt canyonBOT
#

PRSAW, an acronym for `Python Random Stuff API Wrapper`, is a wrapper for the Random Stuff API.

hoary gust
#

oops

#

wait a sec

prisma spoke
#
@bot.command(aliases=["regdb"])
async def registerdb(ctx):
    def check(msg):
        return msg.author == ctx.author and msg.channel == ctx.channel
    
    try:
        await ctx.reply("Enter your in-game name!")
        msg = await bot.wait_for('message', check=check, timeout=60)
        ign = msg.content
        await ctx.reply("Enter your in-game Uid!")
        msg = await bot.wait_for('message', check=check, timeout=60)
        uid = msg.content
        await bot.db.execute("INSERT OR IGNORE INTO users (user_id, uid, ign) VALUES (?,?,?)", (ctx.author.id, uid, ign))
        await ctx.send("Registered") 
    except asyncio.TimeoutError:
        await ctx.send(f"{ctx.author.mention} this process has timed out! Please use the command again if you wish to register!")```
 • I have this command that should insert the Users and the uid and ign
•  It gives no errors and i have raise error in my error handler
• it sends the message "Registered"
• After all this the issue is that it does not insert the things needed
prisma spoke
faint monolith
hoary gust
#

once one of my on_msg event was 100 lines long lol

prisma spoke
hoary gust
#

or maybe 200

hoary gust
prisma spoke
hoary gust
wheat pier
prisma spoke
maiden fable
#

U didn't do cursor,commit or whatever that is called

slate swan
#

^

prisma spoke
slate swan
#

ggs

maiden fable
#

Hahaha

tawny arrow
maiden fable
#

Damn your name tho

tawny arrow
#

help me pls

tawdry perch
#

Never heard of discord_webhooks package

maiden fable
#

Same

slate swan
#

Sounds like another shitty package

prisma spoke
#
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 124, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type
@bot.command(aliases=["unregdb"])
async def unregisterdb(ctx):

    await bot.db.execute("DELETE FROM users WHERE user_id = ?",(ctx.author.id))

    await bot.db.commit()
    await ctx.send("Unregistered")```
tawdry perch
#

@tawny arrow are you sure you want to use that current package for webhooks?

maiden fable
#

Seems like it's asking for a string but id is int

prisma spoke
#

its asking for a str but got an int?

maiden fable
#

Yea

lament mesa
#

check the type of the column

prisma spoke
prisma spoke
#

ps: m new to sqlite

lament mesa
#

send the full error

prisma spoke
# lament mesa send the full error
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 521, in unregisterdb
    await bot.db.execute("DELETE FROM users WHERE user_id 
= ?",(ctx.author.id))
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, 
parameters)
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
ValueError: parameters are of unsupported type

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 124, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type```
lament mesa
lament mesa
#

it should say the command name where the error came from, not on_command_error

#

iirc

slate swan
prisma spoke
#

bruh

maiden fable
#

Yea it should be a tuple

prisma spoke
slate swan
#

I don't really use SQL but since you have ctx.author.id within () I assume it should be a tuple

lament mesa
prisma spoke
#

is it? idk m new to sqlite

maiden fable
#

(ctx.author.id,)

#

Do this (:

prisma spoke
#

checking

slate swan
slate swan
#

👍

prisma spoke
slate swan
#

?

prisma spoke
#

how do i select 2 items from db.. using random.choice.. BUT those 2 items shudnt be repeated

#

and also how to display the number of rows.. in the db.

slate swan
prisma spoke
slate swan
#

You can select 2 random entries from your db without random.choice

slate swan
slate swan
vocal plover
prisma spoke
#

also skelmis in ur server "nextcord" alreaady told it a bit before so u late but thx

maiden fable
#

O

upbeat otter
maiden fable
#

Lol

prisma spoke
prisma spoke
maiden fable
prisma spoke
#

q in hindi means why

#

kyu = q

#

hindi

maiden fable
#

Cz this is a topical/help channel, not an off topic one (:

maiden fable
#

😐

#

I regret sending that O now

prisma spoke
#

S = yes

#

🤷

slate swan
#

i dont like the channel getting !shhh ed

maiden fable
#

Ikr

prisma spoke
maiden fable
#

DUDE

slate swan
#

strange question but how would I get around to checking if a webhook has a code that matches a if statement

prisma spoke
#

u = u r dude

maiden fable
slate swan
maiden fable
#

msg = await webhook.send()
Now msg is the discord.Message object which was sent

prisma spoke
#

this is wrong cuz..

slate swan
#

data variable is your cursor object......

prisma spoke
#

how to get the inside stuff ..

slate swan
#

data.fetchone()/data.fetchmany()

slate swan
#

depending on your need

#

externally

prisma spoke
slate swan
#

*forgot , hm

prisma spoke
#

so fetchone will return 1

slate swan
lament mesa
#

!d sqlite3.Cursor.fetchall

unkempt canyonBOT
#

fetchall()```
Fetches all (remaining) rows of a query result, returning a list. Note that the cursor’s arraysize attribute can affect the performance of this operation. An empty list is returned when no rows are available.
full valley
#
team1idlist = [860858858628055040, 218993342707400704]
team2idlist = [346219923451936770, 636493966971371530]
for count, x in enumerate(team1_ids.values()):
    expected[team1idlist[count]] = float(
        0 - (0.7 * (1 / (1 + 10 ** ((art2 - get_mmr(team1idlist[count])) / 400))) + ept1))
    pstats.update_one({"id": team1idlist[count]}, {"$inc": {'Losses': 1}})

for count, x in enumerate(team2_ids.values()):
    expected[team2idlist[count]] = float(
        1 - (0.7 * (1 / (1 + 10 ** ((art1 - get_mmr(team2idlist[count])) / 400))) + ept2))
    pstats.update_one({"id": team2idlist[count]}, {"$inc": {'Wins': 1}})

How come my expected dictionary is only doing the first index of each id list? Any ideas?

tame marsh
#

im doing a meme command and getting the a reddit submission with the random argument
and now i want to add a button which always go back to the beginning
so everytime the button gets clicked it should edit the message and get a new random post from a specific page
does someone know how to do that?

prisma spoke
earnest ferry
#

anybody pls teach me how to code a ddsicord bpt
dm me pls

slate swan
#

if I have code like this:

admin_role = guild.get_role(role_id)
        overwrites = {
        guild.default_role: discord.PermissionOverwrite(read_messages=False),
        member: discord.PermissionOverwrite(read_messages=True),
        admin_role: discord.PermissionOverwrite(read_messages=True)
    }   
        create_channel = await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)

How can I add slowmode?

#

Is there a way to read data from a webhook that is sent externally?

vocal plover
#

You mean a message sent by that web hook?

slate swan
unkempt canyonBOT
#

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

Edits the channel.

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

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

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

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

And use the slowmode_delay kwarg

slate swan
vocal plover
#

You should receive the message from it like any other message event, provided your bot shares a server with the webhook

#

You can check if it's from the webhook with message.webhook_id

slate swan
vocal plover
#

If your bot is in the server the webhook is sent to then you can receive it's event

slate swan
#

It's not tho.

vocal plover
#

Then it's impossible

slate swan
#

That sucks..

earnest ferry
#

anybody pls teach me how to code a discord bot
dm me pls

vocal plover
#

It's a pretty decent tutorial if I say so myself mmlel

slate swan
#

For the beautiful tutorial yert

#

how do I add role to message.author

#

in async def on_message(message)

vocal plover
#

You can use message.author.add_roles with the roles you want to add

slate swan
vocal plover
#

I added the pumpkin after Halloween because someone said everyone should remove pumpkin while it isn't Halloween dogekek

#

So logically I'm gonna keep it until October next year then remove it

slate swan
#

Good point igyert

verbal cairn
#

Anyone good with tasks 😭

tiny ibex
#
  copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\test_system.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\__init__.py -> build\lib.win-amd64-3.10\psutil\tests
  copying psutil\tests\__main__.py -> build\lib.win-amd64-3.10\psutil\tests
  running build_ext
  building 'psutil._psutil_windows' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for psutil```
#

How to solve this for heroku?

tawdry perch
slate swan
tiny ibex
tiny ibex
slate swan
#

You need the extension as said in the error

tiny ibex
slate swan
#

Aka c++ 14.0 or greater

valid galleon
#

so i currently have an avatar command that just sends the user's avatar(without an embed, just a simple attachment). Do you know how i can make it show hyperlinks to all the different formats of the image like in the bigger bots?

slate swan
tiny ibex
slate swan
tiny ibex
#

How can I fcking install that on heroku

#

Heroku is not my machine

#

On which I can just go on browser

#

And do it

slate swan
# tiny ibex How can I fcking install that on heroku

You need it on your pc the error says it:

  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for psutil 
valid galleon
#

doesnt heroku support c++?

valid galleon
#

(dont want to argue, i just wanted some info)

slate swan
tiny ibex
valid galleon
#

ok

tiny ibex
slate swan
valid galleon
#

also, is it possible to use the discord.py module with cython without having to change much of the code?

tiny ibex
unkempt canyonBOT
valid galleon
#

to make the bot efficient

tiny ibex
tough lance
unkempt canyonBOT
#
Not in my house!

No documentation found for the requested symbol.

slate swan
valid galleon
#

oof

tiny ibex
lucid prism
#

how can i fix this ?

valid galleon
tiny ibex
#

I am sorry

valid galleon
slate swan
lucid prism
#

yes

tiny ibex
valid galleon
#

it doesnt support databases i think

tiny ibex
slate swan
tough lance
#

What little one

lucid prism
#

why its getting deleted ?

slate swan
tiny ibex
valid galleon
#

use absolute path

valid galleon
#

with os

tough lance
tiny ibex
slate swan
tiny ibex
#

Where does a little one come from?

slate swan
#

Thats not nsfw😮‍💨

tiny ibex
#

Yeah.......

slate swan
#

Oh that

tiny ibex
slate swan
#

Well your dirty mindedpithink

valid galleon
#

i thought it was a pedo joke but ok

tiny ibex
#

The very beautiful thing

slate swan
valid galleon
#

:troll:

slate swan
valid galleon
slate swan
full valley
#
team1idlist = [860858858628055040, 218993342707400704]
team2idlist = [346219923451936770, 636493966971371530]
for count, x in enumerate(team1_ids.values()):
    expected[team1idlist[count]] = float(
        0 - (0.7 * (1 / (1 + 10 ** ((art2 - get_mmr(team1idlist[count])) / 400))) + ept1))
    pstats.update_one({"id": team1idlist[count]}, {"$inc": {'Losses': 1}})

for count, x in enumerate(team2_ids.values()):
    expected[team2idlist[count]] = float(
        1 - (0.7 * (1 / (1 + 10 ** ((art1 - get_mmr(team2idlist[count])) / 400))) + ept2))
    pstats.update_one({"id": team2idlist[count]}, {"$inc": {'Wins': 1}})

How come my expected dictionary is only doing the first index of each id list? Any ideas?

tiny ibex
#

But ok

valid galleon
#

this dude calls himself the god of programming in 5 different languages and then he asks this:

slate swan
full valley
valid galleon
#

friend's friend

slate swan
#

Lmfao😭

valid galleon
#

same dude again:

slate swan
#

💀

valid galleon
#

he pinged me for 2 hrs like this until i said i had to go out somewhere lmao

valid galleon
slate swan
tiny ibex
#

IK only Bash(The Best), Java, Python

slate swan
#

But it is helpful

valid galleon
#

but still tho, if he has experience in other langs, especially ones similar to python like JS, he should know how to make functions lmao

tiny ibex
valid galleon
tiny ibex
#

TBH I only know bash and shell scripting

slate swan
valid galleon
#

i was gonna start learning C today, but i gotta fix my CLion config tho

#

its completely broken rn

slate swan
#

I only know py because im to lazy to jump to js yet

valid galleon
#

the CMake thingy

tiny ibex
valid galleon
#

i started python like 1 and a half years ago

slate swan
valid galleon
#

havent had the need to learn another language until now

slate swan
valid galleon
#

only thing hard to do in python is stuff like animations

tiny ibex
valid galleon
#

and core things

valid galleon
#

im gonna try learning JS as quickly as possible cuz i gotta build a website for my bot

slate swan
#

Im going to back end software development

valid galleon
#

or i could yoink code from git repos lmao

valid galleon
#

im gonna go to either backend or data science

slate swan
#

Good stuff ngl

tiny ibex
tiny ibex
#

Messing with dbs

slate swan
#

Ikrpithink

slate swan
tiny ibex
valid galleon
#

im learning how to use sql through my discord bot

slate swan
valid galleon
#

i dont really have any projects other than my bot cuz whatever i learn i try to integrate it with d.py since im very familiar with it

slate swan
tough lance
#

Learning SQL is easy, but implementing is hard

slate swan
#

Yeah

valid galleon
tough lance
#

You'll have to consider the schema

valid galleon
#

postgre is hard

valid galleon
#

pycharm helps a lot for learning sql cuz it has inbuilt db tools

slate swan
tough lance
valid galleon
#

so i wont have to open another sql browser

slate swan
#

Yepyert

valid galleon
tiny ibex
#

NVM for interrupting but anyone knows how to get a free domain?

slate swan
#

You don't

tiny ibex
slate swan
#

Domains are not free

#

As simple as that

sage otter
valid galleon
slate swan
#

Not a personalized domain

valid galleon
#

free

slate swan
valid galleon
#

github pages

tiny ibex
slate swan
#

Buy it at a registrar

tiny ibex
slate swan
tiny ibex
#

And I already have one

valid galleon
sage otter
#

namecheap has some nice ones

valid galleon
#

shit

tiny ibex
slate swan
#

No

sage otter
#

Pretty sure they got the xyz ones that everyone uses

valid galleon
slate swan
#

As I said, no domains are free...

valid galleon
#

it'll be cheap tho

#

are you a student?

#

you can get the student pack and get a few domains

slate swan
#

Temporarily

tiny ibex
#

On github

slate swan
#

Not related to bots.

tiny ibex
#

IK already

valid galleon
#

as long as you are a student, yes

tiny ibex
tawdry perch
red sundial
#

hi can i ask a question about discord bots here, or should i ask in the help channels?

red sundial
#

ill ask here i guess

valid galleon
#

and see if you like anything

tiny ibex
slate swan
#

!ot Bring that over there please, not related to bots anymore

unkempt canyonBOT
valid galleon
#

after it gets accepted, get a free domain

red sundial
#

i made a music bot, and i use a lavalink server for it, where can i host the lavalink server for free?

#

24x7

tiny ibex
slate swan
#

Everyone: !ytdl

valid galleon
#

!ytdl

unkempt canyonBOT
#

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

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

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

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

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

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

Since lavalink is not ytdl

sage otter
slate swan
valid galleon
#

where does it get the songs from then?

slate swan
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

tiny ibex
red sundial
slate swan
#

for i in range(0,5000):
num = i

helpchannels = ["staff-cmds", "❓┃community-support", "ticket-"+str(num)]

slate swan
#

Breaches terms of service of youtube

#

im tryna get all channels 0-5000

valid galleon
#

definetely not running an illegal bot made for school server with ytdl

tiny ibex
vale wing
#

How to make group accept an argument if it has subcommands

@bot.group
async def rank(ctx, user: Optional[discord.User]):
    if not ctx.invoked_subcommand:
        #gives info of author if user is not provided

@rank.command(name='ranksubcommand')
async def other_rank_command(ctx): ...```
Didn't work, it only tried parsing 'ranksubcommand' as an argument
slate swan
#

how

#

So questions related to lavalink are against #rules 5

slate swan
tiny ibex
red sundial
#

lemme see this

tiny ibex
tiny ibex
slate swan
valid galleon
tiny ibex
valid galleon
#

kinda complicated

tiny ibex
slate swan
#

Ah i seeyert

tiny ibex
#

LavaPlayer scrapes YouTube and 100 other sites for music streaming

#

Just the way ytdl does

valid galleon
#

tried using it for a music bot, then dropped the idea after finding out that its quite heavy and i cant host the bot on heroku(which in the end i didnt anyway, cuz im too lazy to make another email for it)

valid galleon
tiny ibex
#

Which will rate limit you hardly

valid galleon
final iron
#

I wouldn't suggest you carry on this discussion

#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

red sundial
valid galleon
modest plover
tiny ibex
valid galleon
modest plover
#

Look above then,

It uses the spotipy module to get song info from spotify and searches the song on soundcloud

valid galleon
red sundial
valid galleon
#

and is it illegal like ytdl?

modest plover
glass rock
#

what is the use of @client.command?

final iron
#

Its a command decorator

tiny ibex
tiny ibex
glass rock
slate swan
glass rock
#

oops

slate swan
#

😳

final iron
glass rock
visual island
#

a decorator

#

nested function

glass rock
#

thank

valid galleon
slate swan
#

I wanna make a voice join/leave logs, like " user has join/eave test voice channel ", may i know how can i do it?

#

Use the event made for it

#

!d discord.on_voice_state_update

unkempt canyonBOT
#

discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").

The following, but not limited to, examples illustrate when this event is called...
slate swan
#

Compare before.channel with after.channel

#

what's a better option for storing a dict database, json or just a .py file?

hasty loom
#

which library can send discord slash commands invisibly (like this)

slate swan
#

how do I check if array has array.[1]

hasty loom
#

im trying to move away from discord.py so i dont want any libraries that depend on that

hasty loom
slate swan
#

I mean

    arg = message.content.lower().split()
    if arg[1] in arg:
#

check if it has more than 1

#

in the array

#

if arg[2] in arg?

hasty loom
#

if len(arg) > 1

slate swan
#

or that

hasty loom
#

if thats what you mean

slate swan
#

if len(arg) <= 2: works thx

#

embed = discord.Embed(title="Purge", description=arg[1])

#

doesn't work hm

valid galleon
slate swan
valid galleon
#

you just need to enable ephemeral in slash commands

hasty loom
#

yes but would that be a global setting?

#

bc i need it so that i can send it on specific msgs

#

like the current lib im using you can do

await ctx.send("hi", hidden=True)
slate swan
#

why cant I print(arg[1])

slate swan
slate swan
hasty loom
#

oh cool

#

im tryna decide between nextcord pycord and disnake but idk which to pick

slate swan
#

Most mature fork out therepithink

hasty loom
#

cool thanks 👍

slate swan
#

if message.content.lower() == prefix+"purge":
arg = message.content.lower().split()
if len(arg) <= 2:
print("debug")
else:
print(str(arg[1]))
embed = discord.Embed(title="Purge", description=str(arg[1]))
await message.channel.send(content=None, embed=embed)

#

doesn't work hm

#

doesn't print the arg[1]

#

Use actual commands, not events to make commands

#

nvm fixed

earnest ferry
#

can u tell me how to code a bot? pls if u are a bot player will give rewardds

hasty loom
#

🤨

#

check pins lol

earnest ferry
tawdry perch
earnest ferry
#

i need a guide

tawdry perch
#

Replit is not good at all for bots

#

Guide for?

hasty loom
earnest ferry
#

a bot and i will code in repl it

hasty loom
#

dont use replit

tawdry perch
earnest ferry
#

can we use the code in repl it??

#

will it work??

hasty loom
#

can you not read

slate swan
#

Yes.

tawdry perch
#

Yes you can but It's bad

slate swan
#

No need to add thousand of questions mark either...

hasty loom
#

there is??????

slate swan
#

Read the guide, use replit although it's bad and start your stuff

earnest ferry
#

k lol

hasty loom
#

why dont you just localhost

earnest ferry
#

wdym?

hasty loom
#

like host it on ur own pc

earnest ferry
#

ye its my pc only

hasty loom
#

yea so if ur using it for urself then just host it locally

#

no need for replit

earnest ferry
#

how to host it locaally??

hasty loom
#

just run ur main bot file using python in the cmd or whatever

earnest ferry
#

o ]kk

#

and we just need to cpy the code??

slate swan
#

@earnest ferry ive sent you many tutorials and others as well and so has alec the creator of the tutorial has recommend to see and learn from the tutorial what is the part you cant understand?

hasty loom
#

read it, understand it, and write it

slate swan
tacit token
slate swan
#

If your not willing to learn then we cannot help you

earnest ferry
#

im wiling bro

slate swan
earnest ferry
#

ok thnx 👍 👍

slate swan
#

so i have this code

await server_channel.send(file=discord.File(data, 'database.png'))

is there any possible way i can put that image on the embed image?

prisma spoke
#
@bot.command()
async def brackets(ctx, p:int):

    while 0!=p:
        data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT 2;")    
        dataa  = await data.fetchall()
        await ctx.send(dataa)

        p-=1``` i want it like if dataa send in the first msg == dataa sent in the 2nd msg then it shud re do the dataa sent in the 2nd msg
#

how to do it

slate swan
prisma spoke
#

whats server_channel defined as?

slate swan
#

a channel, i already have an embed

#

I just wanna ask if is it possible i could set that file to the embed image?

#

i wanna make it embed

slate swan
#

how?

prisma spoke
#

idk how to explain

hasty loom
#

uhh read the docs for embed theres prob an image property

prisma spoke
#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
slate swan
#

Something with set_image

slate swan
prisma spoke
slate swan
#

Still learning them

prisma spoke
wary ice
#

!p drop menu select roles

unkempt canyonBOT
#
Bad argument

Converting to "int" failed for parameter "pep_number".

#
Command Help

!pep <pep_number>
Can also use: get_pep, p

Fetches information about a PEP and sends it to the channel.

wary ice
#

!pep <pep_number>

#

what is this?

slate swan
#

#bot-commands

slate swan
slate swan
prisma spoke
honest saffron
#

is this channel for using bots?

prisma spoke
slate swan
#

i dont quite get what you mean

prisma spoke
slate swan
prisma spoke
earnest ferry
#

@slate swan

kindred drum
#

hey

#

I was wondering why this doesn't send the message ```py
@bot.event
async def on_reaction_add(reaction, user):
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send("Verified by {user.id}")

#

No error

earnest ferry
slate swan
earnest ferry
#

now?

#

@slate swan

slate swan
prisma spoke
wary ice
#

guys where can i find drop menu select role?

earnest ferry
#

why?

slate swan
#

if any([x for x in message.content.lower().split() if x in file.read()]):
flags every letter in the file for some reason

slate swan
prisma spoke
earnest ferry
#

ok ....

slate swan
earnest ferry
#

ok now regenerated

slate swan
#

Indent it

wary ice
#

guys where can i find drop menu select role? @slate swan

slate swan
#

And dont put it in the function

earnest ferry
#

bt still offline

prisma spoke
earnest ferry
#

wait

prisma spoke
slate swan
prisma spoke
slate swan
prisma spoke
#

its a bad practice

prisma spoke
slate swan
earnest ferry
#

hmm but still offline

#

how indent??/

#

where to indent

slate swan
prisma spoke
earnest ferry
#

wdym??

prisma spoke
#

dont

slate swan
slate swan
#

No its not

prisma spoke
#

if uk the deficiencies of repl.it then u wudnt say that

shadow wraith
slate swan
#

@earnest ferry btw make a env file to hide your token since replit is public

shadow wraith
#

no need to argue over replit, i'll say replit bad because people see ur repl and discord bot token unless it's private

kindred drum
#
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user:
            return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send("Verified by {user.id}")
        return
``` Why does this not output anything
slate swan
shadow wraith
#

oh yeah that

shadow wraith
kindred drum
#

Ignore that for now and no, it doesn't even print anything

slate swan
prisma spoke
kindred drum
#

its like it isn't there :/

shadow wraith
prisma spoke
#

and whats with ur indentation

shadow wraith
#

true thats some weird indentation

kindred drum
hoary gust
#

Guys what are the things I can host my bot into except my pc lol

prisma spoke
kindred drum
#

No error

shadow wraith
prisma spoke
kindred drum
#

Yes but not for this

prisma spoke
shadow wraith
#

bru idk sql and that stuf

prisma spoke
#

Aws machine

slate swan
shadow wraith
#

its free too

#

but if you wanna get 2 bots running

hoary gust
#

No I mean, I heard some people talking about hosting their bot in something like rasp or aur, and that's what made me curious about it

kindred drum
#

like in this new piece im coding

earnest ferry
#

ok tell me where to indent

#

i didnt nderstand

slate swan
#

hey how to end interaction after button is clicked once??

shadow wraith
hoary gust
#

@slate swan what is rpi?

prisma spoke
prisma spoke
kindred drum
#

whats wrong with the indentation

slate swan
hoary gust
#

I have a vps but I still wanna know about rpi

shadow wraith
prisma spoke
prisma spoke
prisma spoke
#

nextcord?

prisma spoke
slate swan
kindred drum
#
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user
        
        return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send("Verified by {user.id}")
        return

ah okay ill try this

shadow wraith
prisma spoke
slate swan
#

i use disnake

hoary gust
#

@slate swan can u tell me what rasperry pi does?

shadow wraith
#

oh

hoary gust
#

I mean what is it?

prisma spoke
slate swan
#

ah sad

prisma spoke
verbal cairn
slate swan
earnest ferry
#

@slate swan once see dm pls

shadow wraith
kindred drum
#
async def on_reaction_add(reaction, user):
    if user == bot.user:
        
        return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send("Verified by {user.id}")
        return``` Still nothing
kindred drum
#

o

prisma spoke
#

he wants to disable

prisma spoke
#

not stop

kindred drum
#

I didn't its there

slate swan
shadow wraith
slate swan
hoary gust
verbal cairn
#

Remove the buttons bro 😭

shadow wraith
kindred drum
slate swan
prisma spoke
earnest ferry
#

@slate swan pls see dm

slate swan
prisma spoke
#

the thing @slate swan said was for nextcord

slate swan
shadow wraith
verbal cairn
#

Anyone KNOW HOW TO DO A TASK LOOP

kindred drum
prisma spoke
shadow wraith
slate swan
verbal cairn
shadow wraith
earnest ferry
#

@slate swan pplllllzzzzzzzzzzzzzzzzzzz see dmmmmm

slate swan
slate swan
verbal cairn
#

Should probably try starting the task

shadow wraith
earnest ferry
#

nah

hoary gust
#

What!!!!????

slate swan
#

right right, lemme

verbal cairn
#

WHAT IS SELF

slate swan
hoary gust
#

How can I program that rasberry pi?

prisma spoke
shadow wraith
prisma spoke
#

he said disnake

slate swan
prisma spoke
slate swan
prisma spoke
#

nvm tho

shadow wraith
#

it also works in classes too

earnest ferry
#

plz tell indent where

prisma spoke
verbal cairn
earnest ferry
#

im frustated

prisma spoke
earnest ferry
#

brehhhhhhhh

prisma spoke
slate swan
kindred drum
#
    
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user:
        return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send(f"Verified by {user.id}")
        return
``` still no output 😭
shadow wraith
prisma spoke
#

spamming here wont help

prisma spoke
kindred drum
#

THERE IS NO ERROR!

verbal cairn
# slate swan Ik that?

No I’m saying like if u don’t put it it’s already there so like what does it ever help with

shadow wraith
#

like a async def on_command_error

prisma spoke
slate swan
prisma spoke
verbal cairn
#

Oh

slate swan
verbal cairn
#

I don’t use classes

shadow wraith
#

wait it's not a command

prisma spoke
shadow wraith
#

im stupid asf

slate swan
verbal cairn
#

Disnake

shadow wraith
#

@kindred drum add else: raise Error

earnest ferry
#

tell how to indetn!!!!

kindred drum
#
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user:
        return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send(f"Verified by {user.id}")
        return
    else:
        raise error``` No output
kindred drum
#

wait

prisma spoke
#

what we told u

dapper cobalt
prisma spoke
#

He copied it

kindred drum
slate swan
#

What does empheral do?

shadow wraith
prisma spoke
dapper cobalt
kindred drum
slate swan
prisma spoke
kindred drum
#

you said "Raise Error" but its not defined

slate swan
#

Oh

prisma spoke
#

@client.event

kindred drum
#

k

shadow wraith
prisma spoke
dapper cobalt
shadow wraith
#

not event error

slate swan
#

ahh i still dont know how to end interaction

prisma spoke
shadow wraith
slate swan
prisma spoke
prisma spoke
slate swan
dapper cobalt
#
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user:
        return
    try:
        print("Noted")
        await reaction.message.channel.send(f"Verified by {user.id}")
        return
    except Exeption as e:
      raise e
shadow wraith
shadow wraith
#

just use what @dapper cobalt said :trol:

slate swan
#

Not really spoonfeeding as you guys arent quite helping the poor guy

kindred drum
#
@bot.event
async def on_reaction_add(reaction, user):
    if user == bot.user:
        print("check 1")
        return
    if reaction.emoji == "👍":
        try:
            print("Noted")
        
            await reaction.message.channel.send(f"Verified by {user.id}")
        except Exception as e:
            raise e
    else:
        raise Error``` No output still
shadow wraith
visual island
kindred drum
#

either

visual island
#

so the event got triggered?

prisma spoke
kindred drum
visual island
#

or no

kindred drum
#

it didn't get triggered

prisma spoke
prisma spoke
kindred drum
#

wont change anything but sure

visual island
prisma spoke
visual island
#

use on_raw_reaction_add

slate swan
#

how to add emoji in buttons?

dapper cobalt
slate swan
#

emoji = 'thumbsup' ?

prisma spoke
slate swan
#

nvm i understood how to do

#

Can recall how to do it

dapper cobalt
#
if str(reaction.emoji) == "👍":
  ...

Should work afaik.

slate swan
#

nvm i didnt understand

verbal cairn
#
@tasks.loop(minutes=1.0)
async def task():
   async with aiohttp.request("GET", url="Your url") as res:
   json_data = await res.json()
   print(json_data)

task.start() 
#

Does that look right

kindred drum
#

finally an error

#
TypeError: on_raw_reaction_add() missing 1 required positional argument: 'user'```
dapper cobalt
#

Is that inside a cog?

shadow wraith
verbal cairn
#

Do I need to make a cog

kindred drum
#

oh god, is it reaction or user

tough lance
prisma spoke
dapper cobalt
dapper cobalt
#

!d discord.on_reaction_add

unkempt canyonBOT
#

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

Note

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

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

Note

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

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
prisma spoke
shadow wraith
slate swan
shadow wraith
kindred drum
#

wait

shadow wraith
#

btw i think 1 arg only in python means = 2 args only

kindred drum
#

I do

shadow wraith
#

because you start counting from 0 in python

#

🤔

slate swan
shadow wraith
#

oh

#

i said "i think"

kindred drum
#

@bot.event
async def on_raw_reaction_add(user):
    if user == bot.user:
        print("check 1")
        return
    if user.emoji == "👍":
   
        print("Noted")
    
        await user.message.channel.send(f"Verified by {user.id}")``` no output
vast gale
earnest ferry
#

pls tel @slate swan how to indent

shadow wraith
vast gale
#

what features have y'all made with interactions

slate swan
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

earnest ferry
#

where!
!!

kindred drum
shadow wraith
earnest ferry
#

no!!!

shadow wraith
#

one second ill look at a github example

kindred drum
#

k

#

I hate reactions holy

shadow wraith
late wigeon
#

how do I create a thread for an async function that closes itself when it's complete?

shadow wraith
#

what modules (excluding dpy 2.0) could i use to make discord buttons and dropdowns and isn't discontinued?

prisma spoke
prisma spoke
slate swan
#

disnake has good buttons that are easy

shadow wraith
#

🤔

prisma spoke
prisma spoke
shadow wraith
#

what about stuff like discord-interactions

prisma spoke
vast gale
kindred drum
#
@bot.event
async def on_raw_reaction_add(reaction):
    if reaction.member.bot:
        print("check 1")
        return
    if reaction.emoji == "👍":
        print("Noted")
        await reaction.message.channel.send(f"Verified by {reaction.author.id}")
    
``` First check works, how do I get the second one to
slate swan
#

Disnake is the most mature fork out therepithink

prisma spoke
#

nextcord is*

slate swan
#

No.

prisma spoke
shadow wraith
#

i will be using discord-interactions

slate swan
prisma spoke
#

menus too

slate swan
#

Disnake has examples in their git too btw

shadow wraith
#

looks good to me

prisma spoke
shadow wraith
#

was kind of interested in selects

vast gale
#

I've done a personal, in depth* analysis on all of the libraries, and this is my ranking:
disnake

nextcord

pycord
discord-interactions

shadow wraith
#

time for the deep dive

prisma spoke
prisma spoke
#

nc has menus

prisma spoke
earnest ferry
prisma spoke
# earnest ferry ye

what is indentation? in python? idk python help me figure this question out