#discord-bots

1 messages · Page 876 of 1

silk kelp
#

not that ive noticed, dont think

cold sonnet
#

oh ok

quaint epoch
#

i think it depends on your traffic, mine slows my internet to a halt at times

slate swan
#

damn thats crazylemon_glass

cold sonnet
#

so this is not cuz of a discord bot

silk kelp
quaint epoch
# cold sonnet

i use bell up here, but switched to virgin, it was a mistake. i got like 250 mbs speed with bell now only 100

silk kelp
#

im using ethernet and get like 500

quaint epoch
silk kelp
quaint epoch
#

!ot

unkempt canyonBOT
silk kelp
quaint epoch
#

im not going to ot

#

just linked it for ya

silk kelp
#

alr

#

well back on topic

quaint epoch
#

looking for more ppl to help

silk kelp
#

anyone know any small bot lists

quaint epoch
#

like, a list of bots?

#

like mod bots, music, games?

silk kelp
# quaint epoch what?

im trying to get my bot in more servers and bot lists are basically where users can search for bots to add to their server

silk kelp
#

already using those

#

also small ones, for fast verification

slate swan
#

how do i put required arguments in slash cmds

red sundial
#

im familiar on doing it with py-cord

winter geyser
#

here i have a task that doing something consistently every XX:00, but everytime the bot restarts, it reruns the task so like it's doing something again

how do i make it so it doesn't reruns everytime i restart the bot?
*partial is functools.partial

slim ibex
#

woah wtf

livid jacinth
#

Best show me how do you mean it

kindred epoch
#

Idek what that datetime is doing

lost lichen
#

can i put disnake slash commands in cogs?

kindred epoch
#

Yes

lost lichen
#

i would have to call ‘bot’ twice, how can i not do that

#

as in, how can i use it in a cog

bleak flower
boreal osprey
lost lichen
vocal snow
silk kelp
torn sail
silk kelp
#

@bleak flower ```py
war_channel_id = 927600918843777074 # 867737787557085195 change to actual channel

bleak flower
#

no

#

i have a test channel on my server, if the bot is finished i have to change the channel id

slate swan
bleak flower
# silk kelp can you tell me your error?
Ignoring exception in command war:
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Admin\Documents\Programmieren\FreezeBot\gather.py", line 61, in war
    reaction, user = await client.wait_for("raw_reaction_add")
TypeError: cannot unpack non-iterable RawReactionActionEvent object

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

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: cannot unpack non-iterable RawReactionActionEvent object

^happens after the reactions are added

slate swan
lost lichen
torn sail
bleak flower
#

only reaction, isnt it?

red sundial
slate swan
#

is the code correct?

red sundial
#

im looking at it

slate swan
#

ok

red sundial
#

give me a sec

#

i think you will have to use Option

torn sail
unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
slate swan
#

oh

red sundial
#

wait ill give you an example how to use it

#

lemme open up one of my bots

#

so in you imports first you have import it

slate swan
#

yeah

red sundial
#
from discord.commands import slash_command, Option
slate swan
#

oh alr

red sundial
#
@slash_command(guild_ids=[918349390995914792], description="Tells the weather of a loaction!")
    async def weather(self, ctx, location: Option(str, "Enter a location", required=True, default=None)):
#

this is ho you use it

#

so in your case, instead of a string it would be discord.Member

#

this should work

slate swan
#

ok

red sundial
#

and you can choose if you want it to be required or not, if its optional you can set a default

slate swan
#

alright

#

thnx

final iron
#

Pycord

#

🗿

red sundial
maiden fable
#

Lol

red sundial
#

i abandoned it

maiden fable
#

Ah okay

red sundial
#

but it still got stars on github

#

so i had to archive

slate swan
#

@honest vessel peepwth

#

Is it possible to have the bot monitor a webpage and wait for a specific condition to be met however each person that dms the bot can choose a different webpage

slate swan
#

i mean I would be sending requests to an api

honest vessel
slate swan
#

lol

#

you can use threading with discord bots??

honest vessel
#

@slate swanaint it creative?

slate swan
honest vessel
#

am from sweden we are not nato but send anti-tanks ammo to ukraine

quick gust
#

ot btw

final iron
quick gust
slate swan
#

hunter will

honest vessel
unkempt canyonBOT
quick gust
#

smh water

maiden fable
#

@honest vessel it is against CoC of this server to talk about the war and anything related to it (:

maiden fable
#

Code of Conduct

#

!rule 1

unkempt canyonBOT
austere herald
#

Mfw mini moderators

maiden fable
#

¯_(ツ)_/¯

final iron
austere herald
#

This server is rife with them

cunning ice
#

Conclusion to my making my first bot journey
Discord bot can only be hosted for free with using replit

final iron
#

You shouldn't be using replit to host your bot

#

And Oracle free tier exists

cunning ice
cunning ice
final iron
#

What even is uptimer robot

maiden fable
cunning ice
maiden fable
final iron
#

Those are 2 different answers

cunning ice
#

ahh i will be wrong

#

but i hosted my bot it runs 24x7

#

thts all i know about uptimerobot

final iron
#

God that tutorial is terrible

cunning ice
#

from where you learnt ?

final iron
#

The docs

cunning ice
#

but now i can continue without any tutolrials

final iron
cunning ice
#

i didnt used it for making bot

#

i used only for hosting the bot

#

bcz i was fed up searching free softwares for 24x7 hosting

boreal ravine
cunning ice
boreal ravine
#

yeah but it uses shared IPs, I don't recommend it

cunning ice
boreal ravine
#

not if you choose the free plan

cunning ice
#

you didnt mean to recommend it xd

slate swan
#

i dont see member as a required argument ;-;

dense swallow
cunning ice
austere herald
dense swallow
#

no, railway

boreal ravine
#

thats the downside to using free hosts lol

boreal ravine
dense swallow
silk kelp
austere herald
#

Bro

cunning ice
dense swallow
silk kelp
#

it will give me covid if i learn how to code 😲

dense swallow
silk kelp
#

for a decent server

dense swallow
#

free plan is good tho
I use it

silk kelp
dense swallow
#

my bot is in 80 servers :/

silk kelp
#

when i hit 50 i was getting railed by my webhosting

dense swallow
#

and still works fine...

silk kelp
cunning ice
silk kelp
#

use commands a shit ton

dense swallow
unkempt canyonBOT
#

@dense swallow Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!

Our server rules can be found here: https://pythondiscord.com/pages/rules

silk kelp
dense swallow
#

ahh see it's getting deleted

silk kelp
#

ive been using Sparked Host

cunning ice
cunning ice
boreal ravine
dense swallow
#

true

silk kelp
#

if you really want to make a good bot, you will need to invest some time and money into it.

dense swallow
#

I have sent in dms

cunning ice
cunning ice
#

for a bot no chance

silk kelp
#

i used to run my bot off my raspberry pi

cunning ice
#

that too a prvate one

cunning ice
silk kelp
silk kelp
#

its pretty cheap if u get it from a good source

silk kelp
#

yeah

#

i cant get a "real" job until im 14 - 15

boreal ravine
#

oof

silk kelp
#

yeah

dense swallow
#

I have to be 18 -_-
in my country

left crater
#

fivver is bad for new people

#

cuz why would you want to buy something from a guy with no reviews when you can buy it from a guy with 300

stable lark
#

hopw do u make a discord bot with python coding?

ebon pasture
stable lark
cunning ice
boreal ravine
lyric tusk
#

error: member is a required argument that is missing.
code: ```py
@commands.command()
async def mute(self, ctx, member:nextcord.Member, time, *, reason=None):

    if not member:
        await ctx.send("You need to name someone to mute")
        return
    if not time:
        await ctx.send("You need to have a time")
        return
    if ctx.author in member:
        return await ctx.send("You can not mute yourself")
    
    time = humanfriendly.parse_timespan(time)
    await member.edit(timeout=nextcord.utils.utcnow()+datetime.timedelta(seconds=time))
    await ctx.send(f"{member} has been muted because {reason}")
```
boreal ravine
silk kelp
lyric tusk
cunning ice
honest vessel
#

ofc u get error

#

and missing member argument when u just do !mute

#

what u want is member:nextcord.Member=None

#

then your personal error will trigger

#

"you forgot mention a user"

boreal ravine
honest vessel
#

@boreal ravinereally?

boreal ravine
cunning ice
stable lark
#

does anyopne know how to make a discord bot with python coding??

honest vessel
stable lark
#

anyone teach me pls

cunning ice
honest vessel
#

no,but you cancheck out reasources

silk kelp
#

how can i strip spaces between args so that if i have a time as an interger and seconds, minutes, days, etc they can be the same.

what i have

mute <member> 10 s

what i am trying to get

mute <member> 10s # 10 is a interger, s is a string
cunning ice
#

and learn some basic python

honest vessel
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

boreal ravine
unkempt canyonBOT
#

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

001 |   File "<string>", line 1
002 |     def func(ctx, member=None, time, *, reason=None):
003 |                                ^^^^
004 | SyntaxError: non-default argument follows default argument
stable lark
#

teach me how pls

silk kelp
stable lark
#

im alr there

honest vessel
silk kelp
#

then go learn

stable lark
#

yeah where do i go to code the bot

honest vessel
#

then grabs a discord fork and starts coding

boreal ravine
silk kelp
#

how can i make the user input 2 args without spaces instead of with spaces (ik this sounds confusing idk how to explain it)

like the user types the command like this atm

mute <member> 10 s

but im trying to get them to do it like this

mute <member> 10s
slate swan
#

stop spamming s.m.h.

boreal ravine
#

why send it two times

honest vessel
silk kelp
lyric tusk
honest vessel
#

but you want the errors to say umissingarguments

stable lark
honest vessel
#

@lyric tuskkeep as u had first, ignore use None
and remove those if not member: await ctx.send("You need to name someone to mute") return if not time: await c and use a correct error_handler for your command

silk kelp
#

@boreal ravine
wait so

import time_str
arg = "10s"
time_str.convert(arg)
datetime.timedelta(seconds=10)

how would i use that with asyncio?

silk kelp
#

how would i get the seconds and then asyncio.sleep() with it?

honest vessel
#

but sleep ^

sage otter
#

You extract the seconds from the timedelta object

silk kelp
sage otter
#

timedelta().total_seconds()

honest vessel
#

^

silk kelp
left crater
#

you can make a dictionary for that

sage otter
silk kelp
sage otter
#

assign the conversion to a variable and that will be your timedelta() object representation

boreal ravine
sage otter
#

omg

placid skiff
#

bruh json isn't a storage system lol

sick birch
alpine furnace
#

Why shouldn’t I use a JSON file as a database?
• Performance is deterministic on Data size:
– As Data increases, reading/writing takes longer
• No concurrent writing (One write at a time):
– Effects performance, and can cause corruptions
• Human readable/Easily accessible by users:
– This can leave your text vulnerable for attacks
– If you can read the text, it's not encrypted

What should I use instead?
• SQL Databases:
SQLite, PostgreSQL, MariaDB, etc...
• NoSQL Databases:
MongoDB, RethinkDB, ArangoDB, etc...

For similarity, and easier porting, NoSQL is advised.

What can I use a JSON file for?
Storing Static Data (Not changed often), such as:
Configurations, Properties, or User-Defined Data

silk kelp
boreal ravine
sick birch
#

(at least that's what i was told)

silk kelp
silk kelp
sick birch
#

Either way json is not a database, shouldn't be using it as such

placid skiff
sick birch
#

Replit provides you with all these seemingly nice tools and people just end up using it, it honestly sucks

flat crystal
#

I have this command but when im sending a message the bot reacts this is not my id*

@bot.listen()
async def on_message(message):
  user = bot.get_user(899209951141064724)
  if user==user:
    await message.add_reaction('🏳️‍🌈')
    await message.add_reaction('🏳️‍⚧️')
sage otter
silk kelp
sick birch
sage otter
#

I thought it’s literally just humanized formatting. Atleast that’s what I’ve been using it for.

maiden fable
silk kelp
#

dont ask why im sharding at 20 guilds

sick birch
# silk kelp

That's the time between HEARTBEAT and HEARTBEAT ACK doesn't have much to do with json

sage otter
#

how are you grabbing shard latency

silk kelp
sage otter
#

I know but how are you grabbing the latency

placid skiff
sick birch
#

If it breaks down, which it will, it will break down bad and you're gonna end up losing all of your data

#

(I've been there, so have many of us)

sage otter
#

Since you're on only one shard your Bot.latency should be the same as your ShardInfo.latency

silk kelp
sage otter
#

That’s not how that works

sick birch
#

Not really how it works

silk kelp
flat crystal
#

I have this command but when im sending a message the bot reacts this is not my id*

@bot.listen()
async def on_message(message):
  user = bot.get_user(899209951141064724)
  if user==user:
    await message.add_reaction('🏳️‍🌈')
    await message.add_reaction('🏳️‍⚧️')
placid skiff
#

BRUH. i'll say no more after this

sage otter
#

That’s just so bad though. That looks extremely bad on you as a developer

silk kelp
#

im really not looking forward to the day i have to switch

alpine furnace
#

It works, yes, but that’s not the point

sick birch
#

Like i usually say working =/= good

boreal ravine
silk kelp
#
while break == False:
  me_use_json = True
if break == True:
  me_use_json = False
  me_use_db = True
sick birch
#

It will break down and you're gonna end up wishing you never used json as a database

#

If you like the data structure of json, look into a NoSQL like mongodb

#

the structure is almost identical to a json

silk kelp
#

ive tried mongodb, i got confused, cried in a corner, and went back to json

placid skiff
# silk kelp tldr

do you want a stupid example? you can cook a chicken directly on a campfire, but log will burn it. If you use some stone you will not eat charred food

boreal ravine
sick birch
#

SQL is definetely easier

#

sqlite is just a .db file, no server needed

boreal ravine
#

yep

silk kelp
#

do i need to change how i input my data?

sick birch
#

If you don't like writing raw queries try out an ORM like sqlalchemy

boreal ravine
#

yes

silk kelp
#

is there json to sql converters

boreal ravine
#

you gotta learn SQL first

sick birch
boreal ravine
sick birch
#

They're tables, they have row & columns you have to figure out how to reorganize your data

#

Can you give one example of something you're storing in your json?

silk kelp
placid skiff
#

in sqlite key is your table, value becames your rows and columns

#

rows are like the keys of a dict so they're constant, untill you change them from the db directly

spring flax
#

does the bot prefixes accept a list?

sick birch
silk kelp
#

i tried to convert my json to sql

#

i got this

CREATE TABLE prefixes(
   931055707959197706 VARCHAR(1) NOT NULL PRIMARY KEY
  ,435477728549142528 VARCHAR(2) NOT NULL
  ,931576245882335253 VARCHAR(1) NOT NULL
  ,739861800769552525 VARCHAR(2) NOT NULL
  ,933131501745348708 VARCHAR(1) NOT NULL
  ,928399452505538610 VARCHAR(2) NOT NULL
  ,921906683180105768 VARCHAR(1) NOT NULL
  ,937547458320429106 VARCHAR(2) NOT NULL
  ,940242360820957284 VARCHAR(2) NOT NULL
  ,940290219058561114 VARCHAR(1) NOT NULL
  ,940764701263020143 VARCHAR(2) NOT NULL
  ,945679334386057226 VARCHAR(1) NOT NULL
  ,859104527047327745 VARCHAR(2) NOT NULL
  ,947851552058658836 VARCHAR(1) NOT NULL
  ,944357489179250733 VARCHAR(2) NOT NULL
);
INSERT INTO prefixes(931055707959197706,435477728549142528,931576245882335253,739861800769552525,933131501745348708,928399452505538610,921906683180105768,937547458320429106,940242360820957284,940290219058561114,940764701263020143,945679334386057226,859104527047327745,947851552058658836,944357489179250733) VALUES ('!','m!','$','m!','!','m!','$','m!','m!','>','m!','$','m!','-','m!');
#

these are prefixes and guild ids

sick birch
#

oh that's easy in a database

sick birch
#

just a table with 2 columns

silk kelp
#

is it just a "db" file

placid skiff
#

the first value on your table is the name of the column

sick birch
#

first column is the guild ID, primary key, 2nd is a string, prefix for that guild

sick birch
#
GUILDID | PREFIX
1234567 | $
2234567 | +
3234567 | -
#
INSERT INTO prefixes VALUES (id, prefix)
silk kelp
#
CREATE TABLE prefixes(
   931055707959197706 VARCHAR(1) NOT NULL PRIMARY KEY
  ,435477728549142528 VARCHAR(2) NOT NULL
  ,931576245882335253 VARCHAR(1) NOT NULL
  ,739861800769552525 VARCHAR(2) NOT NULL
  ,933131501745348708 VARCHAR(1) NOT NULL
  ,928399452505538610 VARCHAR(2) NOT NULL
  ,921906683180105768 VARCHAR(1) NOT NULL
  ,937547458320429106 VARCHAR(2) NOT NULL
  ,940242360820957284 VARCHAR(2) NOT NULL
  ,940290219058561114 VARCHAR(1) NOT NULL
  ,940764701263020143 VARCHAR(2) NOT NULL
  ,945679334386057226 VARCHAR(1) NOT NULL
  ,859104527047327745 VARCHAR(2) NOT NULL
  ,947851552058658836 VARCHAR(1) NOT NULL
  ,944357489179250733 VARCHAR(2) NOT NULL
);
INSERT INTO prefixes(931055707959197706,435477728549142528,931576245882335253,739861800769552525,933131501745348708,928399452505538610,921906683180105768,937547458320429106,940242360820957284,940290219058561114,940764701263020143,945679334386057226,859104527047327745,947851552058658836,944357489179250733) VALUES ('!','m!','$','m!','!','m!','$','m!','m!','>','m!','$','m!','-','m!');
spring flax
#

can i pass a list into commands.when_mentioned_or?

sick birch
#
when_mentioned_or(*someList)
silk kelp
#

would it work @sick birch ?

sick birch
#

Why varchar

silk kelp
#

im literally clueless when it comes to databases

spring flax
#

ah okay got it thanks

sick birch
#

Strings probably easier to work with

silk kelp
spring flax
sick birch
#

or TEXT

placid skiff
#
CREATE TABLE IF NOT EXISTS MyTable(
  ID INTEGER PRIMARY KEY NOT NULL,
  user_id INTEGER NOT NULL,
  user_name TEXT DEFAULT NULL,
  channel_id INTEGER DEFAULT NULL
)

And so goes on

silk kelp
#

TEXT "text"?

sick birch
#
CREATE TABLE IF NOT EXISTS MyTable(
  GUILDID INTEGER PRIMARY KEY NOT NULL,
  PREFIX TEXT
)
#

sorry if that's messy, i rarely write sql these days

placid skiff
#

you can study a bit instead of putting random value in your sql you know?

silk kelp
#

trust me im really trying to understand this rn im just rlly confused

sick birch
#

Yeah it gets easier once you learn it

silk kelp
sick birch
#

Also aiosqlite helps with discord bots as it's async

placid skiff
#

bruh search online python sqlite3 introduction and you will get everything you need

sick birch
#

^

placid skiff
silk kelp
#

how am i supposed to learn if i dont know reputable sources i can learn from

sick birch
#

Realpython has one

placid skiff
#

Usually devs don't put stupid things on internet

sick birch
silk kelp
proven ore
#

you could make just a user row, and it has a prefix column

#

in that way you could also do other stuff, other than prefixes

#

guild*

proven ore
sick birch
#

better to organize them into their own tables

#

one table for prefixes, one table for other stuff

silk kelp
#

dude im literally trying to learn about databases when i only have one resource atm

proven ore
sick birch
#

oh like settings for that guild?

proven ore
#

yeah

#

like a row for each guild, in a guilds table, or maybe multiple tables in one guilds.db, and rows named with "prefix" or if you want also "welcomeChannel"

sick birch
#

yeah that makes sense

proven ore
#

etc

silk kelp
#

ok so

#

instead of doing sql stuff (because im still reading about it) i did this instead and im kinda proud of it

#

overhead nav bar

silk kelp
sick birch
#

distasteful

silk kelp
#

its like one of my first attempts and i like the color scheme

sick birch
#

I find using a framework better as bots dashboards or something like that are usually more than just static sites you know

silk kelp
#

but this happens

sick birch
#

but asthetically? very nice

silk kelp
#

thinking about making a dashboard

sick birch
#

I meant using a javascript framework such as Next (what i'm using right now for my dashboard) or react

silk kelp
#

but i just really want to get more servers because ill just put so much effort into it just to fail

sick birch
#

Nah, if you keep putting more effort in i doubt it'll fail

silk kelp
silk kelp
silk kelp
# sick birch what do you mean by that?

if i use javascript frameworks while im a mainly "python" developer, my javascript knowledge is varied between "oh thats easy i know that" leaning into "what the actual fuck"

sick birch
#

Yeah I can see that

silk kelp
#

but i did get offered a development spot on a bot with 85 guilds

#

kinda hype

sick birch
#

Take them up on their offer, could be good for a learning experience

silk kelp
#

yeah, im going to do that

#

i also want to make a better logo

sick birch
#

Yeah I wish i had some more offers like that, sort of bored at the moment not really having any actual projects to work on

silk kelp
#

im trying to get something more modern because right now i have the transparent one as the profile photo and the other as the server icon

sick birch
#

I really like the color scheme

silk kelp
#

thanks

#

i worked on it with a couple of the other owners

#

none of us have ever worked with design before

silk kelp
boreal ravine
#

ty

silk kelp
#

the first one used to be blurple, and i had to fill in about 300 individual pixels

#

after filling

sick birch
#

It has that "mocha" feel, is that what you're going for?

boreal ravine
#

my profile picture has now evolved

silk kelp
#

play on words moment

silk kelp
native wedge
#

reminds me of Mocha custom firmware for the Wii U

silk kelp
sick birch
#

I used a javascript ORM to interact with postgres, they made it really easy with minimal setup. In python, i just used regular old aiohttp to send requests to localhost on a different port

#

But if you don't wanna do that I'm sure there are postgres connectors in async

livid jacinth
#

Best show me how do you mean it

native wedge
#

and it looks like the js framework mocha

honest vessel
#

i got food in my stomach yiiihaaa

#

all good Mmmmm

modest plover
cunning ice
#

now whats wrong
?

sick birch
#

Nothing

slate swan
#

hi guys, im making a discord bot that during verification it makes you sign an application to give permissions to rejoin the discord, incase we get raided or deleted, theres no information on the api docs for this. i would apricate some help ty, pls slide me a dm if your up for helping.

flat crystal
#

why it doesnt delete the msg

@bot.listen()
async def on_message(message):
  
  kampias = bot.get_user(807240742640287764)
  if "xa" in message.content and message.author==kampias:
    await message.delete()
sick birch
cunning ice
slate swan
sick birch
modest plover
cunning ice
sick birch
#

Pretty sure it has to be on the same line

cunning ice
sick birch
slate swan
flat crystal
#

bruh can someone help me

slate swan
cunning ice
cunning ice
sick birch
#

print() prints in console, not in general

modest plover
#

itd be ctx.send right?

slate swan
cunning ice
flat crystal
#

okay

modest plover
#

oh

sick birch
sick birch
long blade
flat crystal
sick birch
modest plover
#

yes

desert cosmos
sick birch
long blade
flat crystal
long blade
#

you have this?

#

import asyncio

flat crystal
#

yes

cunning ice
#
import os
import discord
client = discord.Client()

@client.event
async def on_ready():
    print("Ready to welcome!!")



my_secret = os.environ['bot_token']
#

@sick birch

modest plover
#

is that the full code?

long blade
sick birch
#

Or are you leaving anything out?

cunning ice
slate swan
#

holy shit life is depressing

modest plover
#

christ

long blade
#

@flat crystal you get a error?

sick birch
flat crystal
long blade
#

mabye like await user.message.delete()

cunning ice
modest plover
#

yeah no you didnt have the thing to run the bot, which was that

long blade
#

ohhh @flat crystal shouldnt it be event no listion

slate swan
honest vessel
#

my_secret OMEGALUL

long blade
#

yes

sick birch
long blade
#

yeah thats why i said it

sick birch
#

Don't use event for on_message

desert cosmos
#

@flat crystal

long blade
cunning ice
sick birch
#
@bot.listen()
async def on_message(message):
  
  kampias = bot.get_user(807240742640287764)
  if "xa" in message.content and message.author==kampias:
    await message.delete()
#

Whos ID is that?

honest vessel
#

@sick birch

#

its not urs @sick birch

sick birch
#

No I was just reposting the code cuz it was getting far up

modest plover
#

its them

sick birch
#

@flat crystal asked for help on that

honest vessel
#

😛 just messing

modest plover
flat crystal
#

@long bladedoesnt work

honest vessel
#

@flat crystal confirmed his

sick birch
long blade
sick birch
#

Do you have an error handler?

long blade
#

?

sick birch
flat crystal
#

my last account got b4nned from discord because of h4cking but i didnt anything

#

so its difficult to go and check intents

long blade
#

so is your bot on that account?

flat crystal
#

yes

desert cosmos
#

are my messages seen to you people ?

modest plover
#

make a new application then

sick birch
long blade
desert cosmos
#

alr they didn't reply twice so i thought maybe its somethin

long blade
modest plover
#

lol

safe fulcrum
#

Hello i get an error when trying to do ctx.author.avatar_url

modest plover
#

how do i make the bot check that the user who sends a message is the same who started the command?

flat crystal
long blade
#

ok wait

#

!docs intents

safe fulcrum
#
embed.set_author(name=f"Requested by {ctx.author.name}",icon_url=ctx.author.avatar_url)
unkempt canyonBOT
#
long blade
#

ok illl look it up

modest plover
#
def channelCheck(message: disnake.Message):
            return len(message.channel_mentions) > 0
            
        welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck)
        
        await inter.channel.send(embed = announcementsConfig)
        
        await self.bot.wait_for("message", timeout = 30.0, check = channelCheck)
desert cosmos
#
@bot.listen()
async def on_message(message):
  
  kampias = bot.get_user(807240742640287764)
  if "xa" in message.content.lower() and message.author==kampias:
    await message.delete()
sick birch
#

Just do .all() for testing

slate swan
#

@flat crystal

slate swan
#

his own xd

safe fulcrum
#

I get an error with ctx.author.avatar_url

gaunt ice
honest vessel
#

@modest ploverdef channelCheck(message: disnake.Message):
return len(message.channel_mentions) > 0

    welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck
#

u checking ur own function ....

long blade
#

ok @flat crystal do intents = discord.Intents.default() intents.all() = True

safe fulcrum
gaunt ice
#

i need to make it so that when i use a cmd called stopspam this spam shud stop

desert cosmos
honest vessel
#

check=anotherCheckFunctionPLZ

gaunt ice
safe fulcrum
sick birch
#
intents = discord.Intents().all()
long blade
safe fulcrum
honest vessel
#

@modest plover```def channelCheck(message: disnake.Message):

    welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck```

channelCheck used

sick birch
flat crystal
long blade
#

yh

safe fulcrum
flat crystal
honest vessel
#

its wrong thinking -

def whoami():
    if 10 == 10:
         return True
    else:
         return False


def channelCheck(message: disnake.Message):
        welcome = await self.bot.wait_for("message", timeout=30.0, check=whoami
           ``` check will check whoami function and if true or false is what check will use
safe fulcrum
slate swan
long blade
slate swan
safe fulcrum
honest vessel
#

avatar.url?

safe fulcrum
#

ill try

slate swan
flat crystal
safe fulcrum
cosmic agate
#

AttributeError: 'NoneType' object has no attribute 'channel'
help

sick birch
#

ctx.author.avatar.url in 2.0.0

quick gust
#

try avatar.url because maybe you're on 2.0+

safe fulcrum
sick birch
silk kelp
desert cosmos
sick birch
honest vessel
#

i like when i respond but 10 others has to replay same 😄

silk kelp
#

oh

sick birch
cosmic agate
#

AttributeError: 'NoneType' object has no attribute 'channel'
help

slate swan
sick birch
#

@flat crystal just constructing an intent object isn't enough, pass it into your bot/client constructor to the intents= kwarg

cosmic agate
cosmic agate
#

ok sir

cosmic agate
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

cosmic agate
#

@silk kelp

silk kelp
#

are you in a vc?

cosmic agate
#

no

silk kelp
#

thats why

#
elif not ctx.author.voice_client:
  return await ctx.send("join a voice channel bruh")
cosmic agate
#

but it should reply with a message

#

yes

silk kelp
cosmic agate
#
@bot.command()
async def play(ctx, search:wavelink.YouTubeTrack):
 if not ctx.voice_client:
  vc: wavelink.Player = await ctx.author.voice.channel.connect(cls= wavelink.Player)
 elif not ctx.author.voice_client:
  return await ctx.send("join a voice channel bruh")
 else:
  vc.play(search)
cosmic agate
#

now i understand

#

thank you!

silk kelp
#

np

modest plover
#

how do i check if the person who sent the message is the person who called the command?

#

im acc really confused lmao

silk kelp
modest plover
#

its a slash

silk kelp
#

ah.

modest plover
#

so ctx doesnt woerk

silk kelp
#

what is slash version of ctx

modest plover
#

inter i think

silk kelp
#

inter.author?

#

inter.message.author?

#

@modest plover what is your wait_for, because it should check for the authors message

modest plover
#
 def channelCheck(message: disnake.Message):
            return len(message.channel_mentions) > 0
            
        welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck)
livid jacinth
#

How can I trigger an event when someone plays a game?

modest plover
#

it currently checks for channels being mentioned

cosmic agate
#

help

#
@bot.command()
async def play(ctx, search):
 if not ctx.voice_client:
  vc: wavelink.Player = await ctx.author.voice.channel.connect(cls= wavelink.Player)
 elif not ctx.author.voice_client:
  await ctx.send("join a voice channel bruh")
  return
 else:
  vc.play(search=wavelink.YouTubeTrack)
#

my bot joins vc but no sound

#

hello??

cold sonnet
#

no

#

you seem to download sounds from youtube

#

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

proud rain
#

TypeError: create_node() got an unexpected keyword argument 'Client'

#

why am i getting this?

livid jacinth
#

Why can't I trigger the event with py str(after.activity) == "listening"?

cold sonnet
#

trigger the event with a comparison?

#

do you mean on_member_update?

livid jacinth
#

Yes

cold sonnet
#

you don't trigger it yourself

#

the API does it

livid jacinth
#

Which api

cold sonnet
#

discord api

#

I wanna make sure if I understand the question correctly

livid jacinth
cold sonnet
#
str(after.activity) == "listening" #<- run this code

@bot.event
async def on_member_update(before, after):
   .... #<- launch this
#

?

#

please elaborate

cunning ice
#

error ?

cold sonnet
#

and what do you mean to do? @cunning ice

cunning ice
#

error is in this line

cold sonnet
#

firstly, client should be replaced with a discord.abc.Messageable instance

cold sonnet
#

second, send_message can be replaced with send

cunning ice
#

ok wait a sec

cold sonnet
#

and you can remove the discord.Object(...) part

livid jacinth
# cold sonnet please elaborate

so? or how

@bot.event
async def on_member_update(before, after):
    if str(after.activity) == "listening"
    channel = bot.get_channel(941209391917568000)
    await channel.send("123")
cold sonnet
#

if statements?

cunning ice
cold sonnet
cold sonnet
#

and I'm not sure if converting activity to a str will return listening

#

try it

#

if not, you can always do
if after.activity == discord.Listen

cunning ice
cold sonnet
cold sonnet
cunning ice
cold sonnet
#

where are you doing all this?

cunning ice
cold sonnet
#

meant function

#

realised on_member_join

#

and you wanna send the message to the member

#

or a specific channel

cunning ice
cold sonnet
#

okay then

cunning ice
#

the id is of channel

cold sonnet
#

you're gonna save the channel like this:
channel = client.get_channel(id)

#

replace id with the id

#

then, you can do
msg = await channel.send(embed=embed)

cunning ice
#

ok just a sec

livid jacinth
cold sonnet
#

presences intent?

#

members too

livid jacinth
#

yes

cold sonnet
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

livid jacinth
#

I've already checked that

cold sonnet
#

are you sure both of the intents are enabled in both places

livid jacinth
#
intents = discord.Intents.default()
intents.members = True
intents.typing = False
intents.presences = True

bot = commands.Bot(
    command_prefix = ".",
    help_command=None,
    intents=intents
)
cold sonnet
#

dev portal?

livid jacinth
#

Yes

cold sonnet
#

hm

#

print(str(after.activity))

cold sonnet
#

same question

#

what does triggering an event mean

cunning ice
manic wing
#

im not sure if you should be helping without understanding yourself what is going on

cold sonnet
#

I do though

cunning ice
#

@cold sonnet ??

cold sonnet
#

yeah, it seems okay

cunning ice
#

then like this

manic wing
#

you told someone to put str(after.activity) == "listening" outside of a function so that a) after is not defined b) there is nothing actually happening, it is evaluating to a bool or not

cold sonnet
#

then the send

cunning ice
cold sonnet
cunning ice
#

@cold sonnet

cold sonnet
cunning ice
livid jacinth
#

Mh but i the bot works a little bit when i use this code

@bot.event
async def on_member_update(before, after):
    str(after.activity) == "listening"
    channel = bot.get_channel(941209391917568000)
    await channel.send("123")
cold sonnet
livid jacinth
#

But the bot spam the message

cunning ice
cold sonnet
#
@bot.event
async def on_member_update(before, after):
    if str(after.activity) == "listening":
        channel = bot.get_channel(941209391917568000)
        await channel.send("123")
livid jacinth
#

I know but with the if statements the bot dont work

#

I dont get an error or anything

cold sonnet
#

try printing what str(after.activity) returned and see if you can check for it in the if statement

cunning ice
#

@cold sonnet

cold sonnet
#

I don't know why that error could occure

#

the code's good

cunning ice
cold sonnet
#

yes

cunning ice
#

ok

cold sonnet
#

everytime a person joins

livid jacinth
#

No the bot print nothing

cold sonnet
#

but it will send (member.mention)

cunning ice
cold sonnet
cold sonnet
#

and in an f-string

livid jacinth
#

No ig not

proud rain
#
TypeError: create_node() got an unexpected keyword argument 'Client'```

why am i getting this?
cold sonnet
cold sonnet
#

could you send the code?

proud rain
#
async def node_connect():
    await Client.wait_until_ready()
    await wavelink.NodePool.create_node(Client=Client, host='lavalinkinc.ml', port=443, password='incognito', https=True)

@Client.event
async def on_wavelink_node_ready(node : wavelink.Node):
    print(f"Node {node.identifier} er klar!")

@Client.command()
async def spil(ctx: commands.Context, *, search: wavelink.YouTubeTrack):
    if not ctx.voice_Client:
        vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
    elif not ctx.author.voice_Client:
        return await ctx.send("´Først join et call - ellers kan jeg ikke spille musik!´")
    else: 
        vc: wavelink.Player = ctx.voice_client
    
    vc.play(search)
cold sonnet
#

create_node seems to have a bot kwarg, not Client

#

create_node(bot=Client....)

#

or client with the pep8 correct naming (lowercase)

proud rain
#

So where should i put the code?

cold sonnet
#

you just

#

replace the client kwarg with bot

#

await wavelink.NodePool.create_node(bot=Client, host='lavalinkinc.ml', port=443, password='incognito', https=True)

proud rain
#

is there more i should change?

cold sonnet
#

well, it seems like a music bot to me, so you could just delete the whole bot...

slate swan
#

isnt lavalink againts tos?

proud rain
#

oh

#

i didnt know

cold sonnet
#

lmao

slate swan
#

!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)
proud rain
#

im sorry, im gonna delete the code now

cold sonnet
#

he was not asking about the ToS breaking part

#

I am not a partner-in-crime bruhkitty

slate swan
proud rain
#

@cold sonnet, im sorry, im deleting the code now

maiden fable
#

Bruh for once, when @proud rain was typing, I though the server owner Seb was typing lmao

slate swan
unkempt canyonBOT
cold sonnet
slate swan
cold sonnet
#

Ash comes for once
!ot
Ash goes away

slate swan
#

no advice no help just comes to invoke a command and leaveslemon_thinking

maiden fable
#

I'mma just go sleep ¯_(ツ)_/¯

cold sonnet
#

you are just giving Ash a job, aren't u

shut axle
#
@client.command()
async def casinoh(ctx, member: discord.Member=None, *, reason=None):
    if reason is None:
        reason = "אין סיבה!"
    member = ctx.author
    await ctx.send("<@&948997997860126740>")
    embed = discord.Embed(
        color = discord.Color.green(),
        title = "עזרה בקזינו",
        description = f"המשתמש {member.mention} צריך עזרה בקזינו!\n`סיבה:` {reason}"
    )
    await ctx.send(embed=embed)
#

Example: !casinoh hgdgbda

safe fulcrum
#
@client.command()
async def averpic(ctx):
    embed = Embed(
        title="AverPics",
        url="https://onlyfans.com",
        color=random.choice(colors)
    )

    embed.set_author(name=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar.url)
    embed.set_image(url=f"{random.choice(pics)}")
    embed.set_footer(text=f"👍 {random.randint(10000,30000)} | 💬 {random.randint(500,9999)}")
    embed.timestamp = datetime.datetime.utcnow()

    await ctx.send(embed=embed)
quick gust
safe fulcrum
#

Hello' it says i cant send an empty message

quick gust
#

send complete traceback

slate swan
#

that link in the urllemon_glass

quick gust
#

lmao

safe fulcrum
#

lol its a meme bot

#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message

slate swan
safe fulcrum
#

ik

#

it never happened

quick gust
#

idk tbh

safe fulcrum
#

also

#

is it ctx.author.avatar_url or avatar.url

quick gust
#

.url in 2.0+

shut axle
quick gust
safe fulcrum
#

i dont wanna freeze

quick gust
#

print(discord.__version__) iirc

safe fulcrum
#

2.0.0

quick gust
#

nice

safe fulcrum
#

so

#

does it have to be .url?

shut axle
slate swan
#

it probably doesnt work because ctx isnt definedlemon_glass

shut axle
#

That's the error

shut axle
#

I wrote the ffgsdfd as a reason.

slate swan
#

member is a positional argument which it gets satisfied by its positionlemon_glass

slate swan
shut axle
#
@client.command()
async def casinoh(ctx, member: discord.Member=None, reason=None):
    member = member or ctx.author
    if reason is None:
        reason = "אין סיבה"
    await ctx.send("<@&948997997860126740>")
    embed = discord.Embed(
        color = discord.Color.green(),
        title = "עזרה בקזינו",
        description = f"המשתמש {member.mention} צריך עזרה בקזינו!\n`סיבה:` {reason}"
    )
    await ctx.send(embed=embed)
slate swan
#

member goes first after context ofc its a positional argumentpithink

boreal ravine
slate swan
#

you mean one?

#

and nvm he changed them

#

no?

#

theyre positional arguments with default values am i missing something?

#

is a positional argument with a default value a kwarg?

#

im not sure how if they get called by position?

unkempt canyonBOT
#

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

001 |   File "<string>", line 1
002 |     def x(y=1, b):
003 |                ^
004 | SyntaxError: non-default argument follows default argument
slate swan
#

well isnt that because y isnt needed?

boreal ravine
#
def send(content, *, embed):
    ...

send(123, embed=...)

kwargs are only made using the * in a function's parameters

slate swan
#

same thing?

manic wing
#

do you guys not know args or kwargs 💀

boreal ravine
manic wing
#

!e def func(a, *, b, c): print(a,b,c)
func(1, 2 3, c=4)

slate swan
#

!e

def a(b, c=None):
    pass
a("s", "a")
unkempt canyonBOT
#

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

[No output]
slate swan
slate swan
boreal ravine
#

yea

slate swan
#

this convo😭

boreal ravine
final iron
#

Wtf is going on

boreal ravine
#

nothing

#

maybe Bruhmoment

manic wing
#

kayle is asking for help?

slate swan
#

well iirc theyre know by optional arguments which are positional but not neededlemon_glass

manic wing
slate swan
#

?

boreal ravine
#

i don't even consider myself a programmer

#

i haven't even programmed anything big

manic wing
#

!ot

unkempt canyonBOT
slate swan
#

well optional args are by position and non default how would it change?

boreal ravine
slate swan
#

kayle with nitro 🗿

#

test it!

#

or anyone test it😭

boreal ravine
#

optional args can be postional and can be a keyword

slate swan
#

iirc yes

slate swan
boreal ravine
#

yea if you don't use * in the function's parameters

slate swan
#

no no they are positional but not needed and can be kwargslemon_glass

slate swan
boreal ravine
manic wing
#

wait till you find out you can have required kwargs 🤯

boreal ravine
#

no

manic wing
#

every arg can be required and optional lemon_exploding_head

boreal ravine
#

why you guys getting confused over postional and optional

tidal hawk
#

Does anyone by any chance know, what db is Discord Tracker bot using?

manic wing
boreal ravine
#

well

tidal hawk
#

Thanks!

slate swan
#

if i dont know python youre americanlemon_glass

tidal hawk
#

Also what's really good bot hosting service (can host multiple bots at once)

boreal ravine
#
def main(x=1) # x is now optional

def uwu(z) # z is not optional, but can be a postional/keyword arg
``` ![chadmoyai](https://cdn.discordapp.com/emojis/911260989750669323.webp?size=128 "chadmoyai")
slate swan
#

i think he ment which 😭

velvet tinsel
#

hi

slate swan
#

yuplemon_glass

tidal hawk
#

Like somewhere 15$ month

boreal ravine
#

bruh

slate swan
tidal hawk
#

Europe

boreal ravine
#

you only need 1-5$ max for a good vps

tidal hawk
#

bruh

slate swan
boreal ravine
#

thats what I heard ok

boreal ravine
tidal hawk
#

What about AWS xd

slate swan
slate swan
tidal hawk
#

Okayy

manic wing
#

you skipped basic python

slate swan
#

no?

#

i didntlemon_glass 😳

boreal ravine
#

why do you need a vps in a certain country? pepehmm

slate swan
#

thats like saying you and me are both best friends😭

#

youre cool tholemon_glass pithink

#

and all devs always miss basic stuff dont we? were humanslemon_glass

#

and SELF THOUGHT which is crazy no? like think about it

#

LOL

slim ibex
#

e

#

ooo robin

velvet tinsel
#

robin

slate swan
#

Roblemon_glass

slim ibex
#

i made my first rest api with deno and ts

manic wing
unkempt canyonBOT
slim ibex
#

||fuck||

slate swan
velvet tinsel
#

||shit||

manic wing
slate swan
boreal ravine
#

chill

sick birch
#

Guys

boreal ravine
sick birch
#

That's enough

velvet tinsel
#

calm down

slate swan
#

im just saying no offense to caeden pithink

silk kelp
manic wing
velvet tinsel
slim ibex
#

🗿

slate swan
#

!ot

unkempt canyonBOT
silk kelp
#

how do you get the "add to server" button?

sick birch
#

No need for this, stop before someone calls the mods

slate swan
silk kelp
velvet tinsel
#

ok mod

boreal ravine
slim ibex
#

im co owner of discord

silk kelp
velvet tinsel
velvet tinsel
boreal ravine
slim ibex
#

im not the president of the us

silk kelp
slim ibex
velvet tinsel
silk kelp
#

i am am

slate swan
#

i own python 🗿

boreal ravine
#

no you don't

slate swan
#

yes

velvet tinsel
boreal ravine
#

guido_zoom owns python

slate swan
#

i have paper work👁️ 👁️

velvet tinsel
#

humbug

slate swan
velvet tinsel
boreal ravine
#

guido_zoom idk why this emoji exists but it's funny

slate swan
sick birch
#

What in the world is this channel

velvet tinsel
unkempt canyonBOT
#

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

slate swan
#

rich😔

velvet tinsel
#

@boreal ravine high five

quaint epoch
#

I'm trying to add a cog, called rules_cog but unless i run ```
bot.remove_command('rules')
bot.remove_command('rule')
bot.remove_command('rule_add')
bot.remove_command('rule_remove')
bot.remove_command('rule_replace')

These are all the commands within the cog``` it says the commands already exist

slate swan
#

me?lemon_glass pithink

#

i mean idklemon_glass

quaint epoch
#

mhm?

boreal ravine
#

the command names already exist as aliases/commands

slate swan
#

sure iglemon_smug