#discord-bots
1 messages · Page 876 of 1
oh ok
i think it depends on your traffic, mine slows my internet to a halt at times
damn thats crazy
0.09 
i use bell up here, but switched to virgin, it was a mistake. i got like 250 mbs speed with bell now only 100
im using ethernet and get like 500
🧠
im on school wifi and its so bad
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
looking for more ppl to help
anyone know any small bot lists
what?
like, a list of bots?
like mod bots, music, games?
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
top.gg and discordbotslist
how do i put required arguments in slash cmds
what fork are you using
im familiar on doing it with py-cord
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
woah wtf
Best show me how do you mean it
Idek what that datetime is doing
can i put disnake slash commands in cogs?
Yes
i would have to call ‘bot’ twice, how can i not do that
as in, how can i use it in a cog
https://paste.pythondiscord.com/noyajiwuma
where is my error this time?
could i have an example setup of a slash command in a cog file?
for which package?
can you tell me your error?
I don’t use disnake but it would probably just be commands.slash_command instead of bot.slash_command
@bleak flower ```py
war_channel_id = 927600918843777074 # 867737787557085195 change to actual channel
no
i have a test channel on my server, if the bot is finished i have to change the channel id
pycord
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
https://media.discordapp.net/attachments/881309496385884180/948966075998023700/unknown.png
i dont see member as optional argument in /mrps
ah ok thanks, was not sure if that would work, thanks!
Raw reaction add doesn’t take user and reaction
only reaction, isnt it?
i can help you then
@red sundial this
oh you don't see it
huh
i tried re-running multiple times
is the code correct?
im looking at it
ok
!d discord.RawReactionActionEvent
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.
oh
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
yeah
from discord.commands import slash_command, Option
oh alr
@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
ok
and you can choose if you want it to be required or not, if its optional you can set a default
location*
this is a broken bot LOL
Lol
i abandoned it
Ah okay
@honest vessel 
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
any API for said webpage?
well, it is possible.....you can better make an api for that tbh
i mean I would be sending requests to an api
wrong chan #python-discussion it was for my daily support of ukraine
@slate swanaint it creative?
very much, nato member pog 
am from sweden we are not nato but send anti-tanks ammo to ukraine
ot btw
we are gonna get oted
Why would you what to?
i didn't do the command
hunter will
we can pretend its a discordbot command
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
smh water
@honest vessel it is against CoC of this server to talk about the war and anything related to it (:
coc....clash of clans?
1. Follow the Python Discord Code of Conduct.
Mfw mini moderators
¯_(ツ)_/¯
🆗
This server is rife with them
Conclusion to my making my first bot journey
Discord bot can only be hosted for free with using replit
just to code i will host it on uptimerobot
it requires credit card ig
What even is uptimer robot
Yes
a free webhosting service
A website to check for downtime on websites
Those are 2 different answers
ahh i will be wrong
but i hosted my bot it runs 24x7
thts all i know about uptimerobot
its been also give in discord bot tutorial in freecodecamp.org
God that tutorial is terrible
why i learnt from there
from where you learnt ?
The docs
Bad practices, terrible explaining, not using the commands extension and a few others
ohh
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
https://railway.app is decent
hosting server ?
yeah but it uses shared IPs, I don't recommend it
will not ask to pay after sometime ?
bruh
not if you choose the free plan
you didnt mean to recommend it xd
i dont see member as a required argument ;-;
uptime is good.. I often get rate limited :(
uptimerobot you mean ?
No music bots tho
no, railway
thats the downside to using free hosts lol
yep
they have limited resources for free plan.. if u want more (storage) u have to pay
Bro
no i want a free server for webhosting my bot lol
corona covid means you cant code
it will give me covid if i learn how to code 😲
u can ask in their support server.. idk if I can send link here
its like 5 bucks
for a decent server
free plan is good tho
I use it
not for more than like, 50 servers
my bot is in 80 servers :/
when i hit 50 i was getting railed by my webhosting
and still works fine...
active with your bot
uptime robot one u use ?>
use commands a shit ton
u can send
I used to use replit + uptimerobot.. replit is bad for some reasons
@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
unwillingly open source
ahh see it's getting deleted
ive been using Sparked Host
yes
but no other option :(
downtime + rate limits not worth it tbh for a beginner
yupyupyup
true
buy a laptop for like 150 they're pretty cheap nowadays
if you really want to make a good bot, you will need to invest some time and money into it.
I have sent in dms
i have a spare pc but i cannot keep that runnig all time
why not?
i used to run my bot off my raspberry pi
that too a prvate one
u have money xd
yeah but im also 13 with a paper route, which funds most of my hosting
its pretty cheap if u get it from a good source
paper route?
oof
yeah
I have to be 18 -_-
in my country
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
hopw do u make a discord bot with python coding?
yeah its first come first serve with creating stores with ideas
anyone that knows how?
whats the problem in it ?
you can get rate limited easily
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}")
```
Did you do the command correctly? !mute @Member 30s for being naughty
you have no conversion for your time
that works but when i only do !mute i get error
nothing else ?
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"
you can't do that
@boreal ravinereally?
not sure
ok tq
does anyopne know how to make a discord bot with python coding??
i think 99% here can code a discord botyes.
anyone teach me pls
oof i am a beginner watch some yt video then come
no,but you cancheck out reasources
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
and learn some basic python
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!e ```py
def func(ctx, member=None, time, *, reason=None):
...
func(1, 2, 3, reason='.')
@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
teach me how pls
!resources
im alr there
no one gonna teach you like that, i gave u link for reasources
then go learn
yeah where do i go to code the bot
you learn python
then grabs a discord fork and starts coding
you can use a library for that ( https://pypi.org/project/time-str ), or you can parse the message manually
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
stop spamming s.m.h.
why send it two times
ill check this out, thanks
look up examples of discord.py e.q
was about to reply to ash
when i did that the time go a red line
then u put time=None too
but you want the errors to say umissingarguments
i cant find any
@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
@boreal ravine
wait so
import time_str
arg = "10s"
time_str.convert(arg)
datetime.timedelta(seconds=10)
how would i use that with asyncio?
u dont
how would i get the seconds and then asyncio.sleep() with it?
but sleep ^
You extract the seconds from the timedelta object
it converts it into a datetime.timedelta
timedelta().total_seconds()
^
so i do this?
asyncio.sleep(timedelta().total_seconds())
you can make a dictionary for that
Not literally I just made an example
but it has the seconds as an int?
assign the conversion to a variable and that will be your timedelta() object representation
bad way to make a mute command, instead save the time in some database and constantly query it to find our whether or not the time ended
yeah but i already have
omg
bruh json isn't a storage system lol
You're aware that replit has an ephemeral file system?
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
you mean a intergrated database
oof, you have unfortunately fallen into the discord.py tutorial trap where they use JSON as a 'database'
No, iirc if you write to file using code it'll get erased on startup
(at least that's what i was told)
i dont like databases as ive never used them too much and im not rlly good w em
never happened, i dont think that is a thing..
Either way json is not a database, shouldn't be using it as such
it's time to learn if you want to make a bot
imho using humanize is better
Replit provides you with all these seemingly nice tools and people just end up using it, it honestly sucks
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('🏳️⚧️')
Wot. Humanize can convert times like that?
doesnt slow down, doesnt change much, i have about over 200 lines in each json file, it doesnt cause errors, corruption, etc.
user==user is always going to be true, isn't it?
I thought it’s literally just humanized formatting. Atleast that’s what I’ve been using it for.
That is what R. Danny uses. !remind next thursday do laundry
So far
i dont think it will change as long as i have 0.04ms
dont ask why im sharding at 20 guilds
yy
That's the time between HEARTBEAT and HEARTBEAT ACK doesn't have much to do with json
how are you grabbing shard latency
eh
bot = commands.AutoShardedBot
I know but how are you grabbing the latency
So far. And json is NOT a storage system. json are used to represent structured data, it has javascript-like object syntax and is used for transmitting data, not to storage
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)
Since you're on only one shard your Bot.latency should be the same as your ShardInfo.latency
well it works as storage, smells like storage, looks like storage, must be storage
That’s not how that works
Not really how it works
if it works, i no fix, if it breaks, i switch
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('🏳️⚧️')
BRUH. i'll say no more after this
That’s just so bad though. That looks extremely bad on you as a developer
im really not looking forward to the day i have to switch
@silk kelp read
tldr
It works, yes, but that’s not the point
Like i usually say working =/= good
thats for converting datetime objects into readable formats, they wanted to 'strip' the parameter
while break == False:
me_use_json = True
if break == True:
me_use_json = False
me_use_db = True
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
ive tried mongodb, i got confused, cried in a corner, and went back to json
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
thats where your beginner friendly SQLite3 comes in :D
yep
do i need to change how i input my data?
If you don't like writing raw queries try out an ORM like sqlalchemy
yes
is there json to sql converters
you gotta learn SQL first
a little bit, yes since it's a key but has multiple values
probably no
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?
like
"key": [
{
"value": "value"
}
]
?
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
does the bot prefixes accept a list?
more like
KEY VALUE1 VALUE2 VALUE
1 value2 value3 value4
2 test test test
(hopefully that looks right)
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
oh that's easy in a database
BRUH
just a table with 2 columns
is it just a "db" file
the first value on your table is the name of the column
first column is the guild ID, primary key, 2nd is a string, prefix for that guild
oh ok
GUILDID | PREFIX
1234567 | $
2234567 | +
3234567 | -
INSERT INTO prefixes VALUES (id, prefix)
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!');
can i pass a list into commands.when_mentioned_or?
Unpack it first
when_mentioned_or(*someList)
would it work @sick birch ?
Why varchar
im literally clueless when it comes to databases
ah okay got it thanks
Strings probably easier to work with
what is a good alternative?
hmm?
or TEXT
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
TEXT "text"?
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
you can study a bit instead of putting random value in your sql you know?
trust me im really trying to understand this rn im just rlly confused
Yeah it gets easier once you learn it
can you send me documentation?
Also aiosqlite helps with discord bots as it's async
bruh search online python sqlite3 introduction and you will get everything you need
^
well you can write custom async function that runs db method, that won't be an issue
how am i supposed to learn if i dont know reputable sources i can learn from
Realpython has one
Usually devs don't put stupid things on internet
thanks for the tip
just. why.
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*
such as welcome channel
better to organize them into their own tables
one table for prefixes, one table for other stuff
dude im literally trying to learn about databases when i only have one resource atm
yeah, but i meant he creates a row for each guild, instead of having them as parameters
oh like settings for that guild?
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"
yeah that makes sense
etc
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
html?

and css
distasteful
how
its like one of my first attempts and i like the color scheme
I find using a framework better as bots dashboards or something like that are usually more than just static sites you know
but this happens
but asthetically? very nice
im using flask and render_template
thinking about making a dashboard
I meant using a javascript framework such as Next (what i'm using right now for my dashboard) or react
but i just really want to get more servers because ill just put so much effort into it just to fail
Nah, if you keep putting more effort in i doubt it'll fail
yeah but then ill have to do a lil js movement and it has a huge amount of fuckups inside
i put it on about 8 bot lists and im waiting for verification
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"
Yeah I can see that
Take them up on their offer, could be good for a learning experience
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
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
I really like the color scheme
thanks
i worked on it with a couple of the other owners
none of us have ever worked with design before
can I use rhis
go for it
ty
the first one used to be blurple, and i had to fill in about 300 individual pixels
after filling
It has that "mocha" feel, is that what you're going for?
my profile picture has now evolved
heheheeh
play on words moment
coolio
reminds me of Mocha custom firmware for the Wii U
that looks really similar i didnt even realise
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
Best show me how do you mean it
it's fine it's a very obscure thing don't worry
and it looks like the js framework mocha
lmao
now whats wrong
?
Nothing
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.
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()
What sort of action do you want to user to take to make sure they're verified?
so why its not showing output ?
just takes them to the site of a normal discord application permission
Do you get an error?
.
are uou wanting it to send it to discord?
no i want the msg to be printed
Pretty sure it has to be on the same line
it is
Where do you expect it to be printed>
did you client.run() ?
bruh can someone help me
@sick birch i would like it to be like this. https://restorecord.com
at last it is
umm in general ig
print() prints in console, not in general
.
itd be ctx.send right?
bro just wait a second.
oh yes sorry in console
okay
oh
on_message doesn't provide you with ctx
Well, if you've done everything right, and it doesn't print, its an network problem
do you want it to delete the bots msg?
but my network i good
no the message of the person
If so, you probably didn't do everything correct. Can you copy paste the full code?
here ?
yes
did you check if it needs message intents and you have enabled it ?
Yes
emm
?
yes
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
That's everything?
is that the full code?
emmm
Or are you leaving anything out?
yes !?!?
holy shit life is depressing
christ
@flat crystal you get a error?
Then you need to do client.run(my_secret)
nope
mabye like await user.message.delete()
IT WORKED TQ VERY MUCH
yeah no you didnt have the thing to run the bot, which was that
ohhh @flat crystal shouldnt it be event no listion
doesnt seem like that
my_secret OMEGALUL
bot.event?
yes
listener is preferred over event
yeah thats why i said it
Don't use event for on_message
@flat crystal
oh
oh yes sorry dude
@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?
No I was just reposting the code cuz it was getting far up
its them
@flat crystal asked for help on that
😛 just messing
mine
@long bladedoesnt work
@flat crystal confirmed his
So if you send a message with "xa" in it, it won't delete?
exactly
go to discord dev portal go to your bot and do this
Do you have an error handler?
ummmmmm
?
Oh yeah this
my last account got b4nned from discord because of h4cking but i didnt anything
so its difficult to go and check intents
so is your bot on that account?
yes
are my messages seen to you people ?
make a new application then
Yes
ok do intents = discord.Intents.default() intents.message = True
alr they didn't reply twice so i thought maybe its somethin
i think that would work would it @sick birch
lol
Hello i get an error when trying to do ctx.author.avatar_url
how do i make the bot check that the user who sends a message is the same who started the command?
embed.set_author(name=f"Requested by {ctx.author.name}",icon_url=ctx.author.avatar_url)
ok illl look it up
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)
@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()
Just do .all() for testing
@flat crystal
ok?
his own xd
anyone?
I get an error with ctx.author.avatar_url
@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 ....
ok @flat crystal do intents = discord.Intents.default() intents.all() = True
i need to make it so that when i use a cmd called stopspam this spam shud stop
what error
check=anotherCheckFunctionPLZ
C:
Um no
wdum?
ctx.author has no attribute avatarl_url
intents = discord.Intents().all()
^ do that @flat crystal
intents = discord.Intents.all()
@modest plover```def channelCheck(message: disnake.Message):
welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck```
channelCheck used
I think you need to make an instance first since it's a classmethod
no it works
like this?
yh
anyone?
I get an error with ctx.author.avatar_url
nothing again
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
its intents = discord.Intents.all()
what the "error" is?
ask @sick birch
you need to pass it inside your commands.Bot too
author hasn't avatarl_url attribute
oh ye
avatar.url?
ill try
author? or Member
u mean to developer portal?
ctx.author.avatar_url
AttributeError: 'NoneType' object has no attribute 'channel'
help
ctx.author.avatar.url in 2.0.0
try avatar.url because maybe you're on 2.0+
are u sure
Pass it in as well
ctx.author.avatar_url?
alr try doing ctx.author.avatar_url_as()
It's ctx.author.avatar.url in version 2.0.0
i like when i respond but 10 others has to replay same 😄
oh
Yes, i am
AttributeError: 'NoneType' object has no attribute 'channel'
help
where do you see commands.Bot in your code?
@flat crystal just constructing an intent object isn't enough, pass it into your bot/client constructor to the intents= kwarg
where you setup your bot
ok sir
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.
are you in a vc?
no
thats why
elif not ctx.author.voice_client:
return await ctx.send("join a voice channel bruh")
or just
elif not ctx.author.voice_client:
await ctx.send("join a voice channel bruh")
return
@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)
oh ok
now i understand
thank you!
np
how do i check if the person who sent the message is the person who called the command?
im acc really confused lmao
if ctx.message.author == ctx.author
its a slash
ah.
so ctx doesnt woerk
what is slash version of ctx
inter i think
inter.author?
inter.message.author?
@modest plover what is your wait_for, because it should check for the authors message
def channelCheck(message: disnake.Message):
return len(message.channel_mentions) > 0
welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck)
How can I trigger an event when someone plays a game?
it currently checks for channels being mentioned
message.author?
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??
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
TypeError: create_node() got an unexpected keyword argument 'Client'
why am i getting this?
Why can't I trigger the event with py str(after.activity) == "listening"?
Yes
Which api
I dont know how
str(after.activity) == "listening" #<- run this code
@bot.event
async def on_member_update(before, after):
.... #<- launch this
?
please elaborate
error ?
and what do you mean to do? @cunning ice
send embed when user joins
error is in this line
firstly, client should be replaced with a discord.abc.Messageable instance
could be a channel or a member
second, send_message can be replaced with send
ok wait a sec
and you can remove the discord.Object(...) part
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")
if statements?
then how it will know where to send the msg
due to the channel or member you specify instead of client
missing : and indents
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
i didnt get it could you pls rewrite the code
doesn't exist, mb
if after.activity.name == "listening"
do you have a channel or member defined?
member
where are you doing all this?
replit
meant function
realised on_member_join
and you wanna send the message to the member
or a specific channel
embed in a specifc chanel
okay then
the id is of channel
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)
ok just a sec
Both doesn't work
yes
!intents
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.
I've already checked that
are you sure both of the intents are enabled in both places
intents = discord.Intents.default()
intents.members = True
intents.typing = False
intents.presences = True
bot = commands.Bot(
command_prefix = ".",
help_command=None,
intents=intents
)
dev portal?
Yes
sorry what?
this has to be written prior to the msg command
im not sure if you should be helping without understanding yourself what is going on
I do though
like this
@cold sonnet ??
yeah, it seems okay
then like this
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
then the send
no, I explained how I understood the question, then asked the person to elaborate
define embed
i named my embed as embed
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")
please send the whole code you have
But the bot spam the message
if statements
once again
ok
@bot.event
async def on_member_update(before, after):
if str(after.activity) == "listening":
channel = bot.get_channel(941209391917568000)
await channel.send("123")
I know but with the if statements the bot dont work
I dont get an error or anything

try printing what str(after.activity) returned and see if you can check for it in the if statement
@cold sonnet
does it work if same member leaves and joins
yes
ok
everytime a person joins
No the bot print nothing
but it will send (member.mention)
yes to mention the user
does it reach the print
I think you meant {member.mention}
and in an f-string
No ig not
TypeError: create_node() got an unexpected keyword argument 'Client'```
why am i getting this?
well put it before the if statement, if you put it in the wrong place
what's create_node?
could you send the code?
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)
create_node seems to have a bot kwarg, not Client
create_node(bot=Client....)
or client with the pep8 correct naming (lowercase)
So where should i put the code?
you just
replace the client kwarg with bot
await wavelink.NodePool.create_node(bot=Client, host='lavalinkinc.ml', port=443, password='incognito', https=True)
is there more i should change?
well, it seems like a music bot to me, so you could just delete the whole bot...
isnt lavalink againts tos?
lmao
!ytdl
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)
im sorry, im gonna delete the code now
nvm it doesnt have anything related to lavalink
@cold sonnet, im sorry, im deleting the code now
Bruh for once, when @proud rain was typing, I though the server owner Seb was typing lmao

lool
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
(you don't have to, just don't let us know about it)
okay

Ash comes for once
!ot
Ash goes away
no advice no help just comes to invoke a command and leaves
I'mma just go sleep ¯_(ツ)_/¯
you are just giving Ash a job, aren't u
@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
@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)
there needs to be a valid member with that name
Hello' it says i cant send an empty message
send complete traceback
that link in the url
lmao
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
member would always be the author just use or so if the member is None the author will be the member and no need for the if statement just set a defualt value in params
weird
idk tbh
.url in 2.0+
member = ctx.author if not member else member ????????
no, just member = member or ctx.author
print(discord.__version__) iirc
2.0.0
nice
Doesn't work!
not in params
it probably doesnt work because ctx isnt defined
sus AF...
I wrote the ffgsdfd as a reason.
bro
member is a positional argument which it gets satisfied by its position
how?
I don't get it.
@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)
ctx, member, *, reason is your params
member goes first after context ofc its a positional argument

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?
@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
well isnt that because y isnt needed?
def send(content, *, embed):
...
send(123, embed=...)
kwargs are only made using the * in a function's parameters
same thing?
thats what im saying
do you guys not know args or kwargs 💀
no you weren't
!e def func(a, *, b, c): print(a,b,c)
func(1, 2 3, c=4)
!e
def a(b, c=None):
pass
a("s", "a")
@slate swan :warning: Your eval job has completed with return code 0.
[No output]

what
yea
this convo😭

Wtf is going on
kayle is asking for help?
well iirc theyre know by optional arguments which are positional but not needed
lol kayle is better at programming than the people helping 
?

i don't even consider myself a programmer
i haven't even programmed anything big
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
well optional args are by position and non default how would it change?

optional args can be postional and can be a keyword
iirc yes
are optionals arg like official or are they called that by the community maybe python probably calls them positional args lol
yea if you don't use * in the function's parameters
no no they are positional but not needed and can be kwargs
well isnt that just a kwarg with a default value🗿
def main(x=5):
...
``` x is optional, also a keyword/postional arg
```py
def main(x):
...
``` x can be postional or a keyword
```py
def main(x=1, /):
...
``` x is a postional and an optional parameter
wait till you find out you can have required kwargs 🤯
no
every arg can be required and optional 
why you guys getting confused over postional and optional
Does anyone by any chance know, what db is Discord Tracker bot using?
they dont know python cough okimii
well
Thanks!
bro what?
if i dont know python youre american
Also what's really good bot hosting service (can host multiple bots at once)
def main(x=1) # x is now optional
def uwu(z) # z is not optional, but can be a postional/keyword arg
``` 
i think he ment which 😭
hi
who are you explaining it too if i get it and yerlikaya
yup
Like somewhere 15$ month
bruh
where do you live
Europe
you only need 1-5$ max for a good vps
bruh
scaleway prob
thats what I heard ok
just wanted to clear things out 
What about AWS xd
digital oceans plan is like 6bucks lol
thats really good ngl
Okayy
idk to who
why do you need a vps in a certain country? 
thats like saying you and me are both best friends😭
youre cool tho

and all devs always miss basic stuff dont we? were humans
and SELF THOUGHT which is crazy no? like think about it
LOL
robin
Rob
i made my first rest api with deno and ts
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
||fuck||
ill wrap it😳
||shit||
not very well
says the one who never contributes you coward so much "skill" not being used

chill
Guys

That's enough
calm down
im just saying no offense to caeden 
you sound like my dad kek
wow dont be rude :o i dont particularly like to contribute to shit toxic people's api wrappers
sounds like my sister
i dont make apis?
smh
🗿
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
how do you get the "add to server" button?
No need for this, stop before someone calls the mods
in dev portal in the general tab
welp im gonna have to wait for the head dev to get on then
ok mod
How to get the Add to server button to your bot's profile:
- Go to https://discord.com/developers/applications/ and select your bot.
- Insert at least one tag in the TAGS (MAXIMUM 5) field (these can be any text, separated by comma's)
- From the side menu click on Oauth2 -> General
- Modify the Default Authorization Link with a Custom URL or In-App authorization
im co owner of discord
i am discord
im owner of discord, mortal
shit 😳
can I get free nitro please?
im not the president of the us
👁️ 👅 👁️
maybe yeah maybe nah
i am you
i am am
i own python 🗿
no you don't
yes
bah
owns python
i have paper work👁️ 👁️
humbug
thats me
show mf
idk why this emoji exists but it's funny

What in the world is this channel
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
rich😔
@boreal ravine high five
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
It's because
mhm?
the command names already exist as aliases/commands
sure ig

