So I already have another bot running that handles requests, this would simply be for users to track their favourite shows and be notified when a new episode is available :) currently the code I have checked the sonarr API for upcoming episode info as well as existing files in the library. It's storing and reading data from a sqlite3 db as well. If you like when I get home from dinner i can send through the existing files for clarity?
#discord-bots
1 messages Β· Page 1135 of 1
π
well then, what is your issue and is it related to the implementation of a future feature?
u know the github/rapttz/discord.py link?
discord.pys repo link? what about it
ei no
pip install -U git+https://github.com/Rapptz/discord.py
thanks thanks
dw
oh hydro you wanted the full link?π
π
"right click"
didnt thought about that
imagining forgetting about the OG stuff
im not og anyways
13 year olds π
cap
damn hydro is older than me >:(
π
no wonder I'm still immature
i thought u are elder than me hmmmmmm
im going to be 16 in jan :(
elder kekw
im one month elder than u
π€£

why cry π
lucky
hi sarth
sarthπ
shortcut in linux shell/replit is ctrl+shift+v^
just in case you want to not use your mouse
im window
same ig
whatever
i hate using my mouse
me who use touchpad to play valorant and 23 3 yesterday π€£
oki
go sleep
10 months younger ic π
i need to wait for 5 more months for bot vertification
im waiting for youπ
find a way to control laptop thru brain waves
keep waiting forever
π
yeah sarthak is with me π oki keep waiting
hun bun better
most of the operations are possible with keyboard itself
π
i am even lazier
I hate git bash π
just don't use ur desktop then, sleep.
i love git
i use github desktop
π€£
what on earth
pwsh > *
linux shell
same but mehh
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
:(
what happened to ur pfp
!get-a-pfp
zsh is the shit that make yo terminal look like this
LMAO
ugly
i used both git cli and the desktop
I like you more
ok
π‘ I don't want any pfp
noob anime pfp
sparky was an amonger now hes a discord logo
π
everyone has anime pfp except for me and sparky
;-;
how does anime pfp and noob relate
c'mon Sparky, you're sharing your pfp with thousands of ppl, get something unique
okimii is both of them
ΰΆΰΆΰΆΰΆΰΆΰΆΰΆ
ΰΆ@slate swan ΰΆ
ΰΆΰΆΰΆΰΆΰΆΰΆΰΆ
sparky has been surrounded
Cringe
hm.. Alr
I'll go before it becomes the war channel
π
sparky was a cool amonger now hes plainer than a minecraft plain
they all remind me of shinchan that symbol
||and his temper is flatter than the girls in my class||
guy will be moving on his ass
π
rip
Hydro
why tf is my alt account beign shown as the contr π helppp
you didn't have to say that
its spoiler tho so...
u shouldn't have clicked π
maybe you edited that repo/gist with that account
oh me oh my, that's so true
I didnt.....
I just created the repo rn
make another edit with ur main acc and commit
hm lemme try
thats really something unique
π
u want a pfp? i can find one for u
sure, thanks
yeah and i put my bed beside yoursπ©
u want a minecraft bread?
i didn't
man be reading through spoiler
kekw
I don't play survival only bedwars
i don't get spoilers cause i turned them off from settings
minecraft command syntax > assembly syntax
No
C is easier than mc cmds
MC cmds are ez I have created tons of builds with it
what about potato
get some scenery pfp if u don't like anime ones
i play 1v1 combos
scenery wdym
sm1 should make programming language that compiles to mc
Same I also
some nature photos
didnt work π
or just add a PewDiePie pfp like an average 15yo
i play with ais
No face revel as for now
guess im not average
imagine being 15
ais?
ais kacang batu
sedap
huh? i said nature pfp
NPCs
the plural for ai
lets leave it to the ashley and me last year
my reaction to yalls pfp rn
not clicking it
what sadistic pleasure do you get remembering the past π
who played with npcs?
not gonna listen
huhM
lamo
Okimii
I'd rather listen to it all tbh, I love that song π
im an npc π³
in Minecraft
with no redirects
π
okimii's theme song
lemme download em will listen later
im not clicking any mp3 files bro
same
π€
is literally 200kb
its in my Spotify top #3 so idm
Okimii scared of ghosts
im not getting rick rolled
13 sec rickroll nice

Paranoia moment
||nope not a rickroll||
||never gonna give you up||
ghosts under the bed
imagine getting Rick rolled
hydro i hope you stub your toe
i trusted you
π€£
thats like the most vicious curse ever
wait there is people out there trusting me??? hmmmm
I have a very unique trick to overcome every fear
π
i hope you pore your cereal and you have no milk
why my bot no works :c
cuz hikari
nobody is going to help u
so depressd #brocken # \βοΈ \π€
Hmm π§
indeed both of u are high
high on weed
from lack of sleep
Lightbulbing my ass bro
Wtf
are you is what are getting bot error in your bot code?
i slept 2 hours yesterday and i went to a 10 hours band training and a boring party
Wumpus in spaceπ
π€ΈββοΈπ¦½
@slate swan π³
btw who is technoblade and why do i see that on every status
He is yt
rip lyrics
He ded
a popular minecraft player who died of cancer on first july, this year
the best minecraft player
ic
it says Cannot import sarcasm from Sparky.messages
sed
cap, best mc player is meπΌ
My battery low
π
^
π
pov: technoblade wakes up and challenge u to a 1v1
i've seen you send that gif about 1,436,658 times
technoblade was so uwu π I feel like crying
wither revival
I not even sent 1,436,658 messages
add some filament to it
more like zombified piglin
Add electricity too otherwise it will not glow
I bored π΄
its asking me to enable Intents.okimii
So turn on
haven't enabled it yet
π tf sz
π΅βπ«
π
π°
π
i am gonna await u
Go and sleep
rip typos
sad ashley noises
this chat is getting too weird
Ye
okimii stop talking bro
dude be creating python jokes π€£
.topic
**What feature would you be the most interested in making?**
Suggest more topics here!
all of us high now
the ping command
a form to ask user id and password for different sites
π³
Just chill
π AttributeError
monkey patched π³
clearly postgres better because yeah
/tp @s sarth's_house
guys why isnt my mc command working?ππ
Because you live inside his walls already
name error it's sarthak
i forgor
also you can add ignore_missing_imports = True to your mypy.ini to avoid those type: ignore on aiomysql
Tf is this chat becoming
don't really find a difference
- im not working with tuples/dictionaries
the fetchone/many/all()s are converted to a object in the end
it's for adults children go sleep

you're already in a genjutsu
sleep.
Go and sleep you all
what did he sayyyyy
Just now I realized
whenever I go to sleep I cant fall asleep π
π³
he said yes and u happily lived ever after

guys i will only sleep in one condition
that u will never wake up
is it is_sz_with_me()?
that happened a long ago
π π
Isn't that love is war
same
Cause mister
Go and listen music and sleep π΄
cokecane duck is back
knowledgeable
yeah kaguya sama's song
what is love
There's mister
when tho
a month and a half ig
if you guys help me with my complicated error
AttributeError: 'sarth' object has no attribute 'okimiis_love'
?
This chat cannot stop being a shithole
how you know about thatπ³
Is this channel for dating? Or whatever
mine is 2 years ago and her new bf now is my good friend π€£
how do i make a slash command bot? the
from discord import app_commands
doesnt work
idk anymore
coz nonetype object has no attribute
#sus-playground
bad naming convention
Go and sleep
no it says sarth objπΏ
looks like u ntred urself
Cause mister
π₯²
Only love song i know that has mister is love is war
π
let me import sarth in okimii.py π©
DUDE

circular import error coz u are there in sarth.py
>> class MySarth(sarth):
def __init__(self) -> bool:
super().__init__(love=True)
@property
async def okimiis_love(self) -> bool:
return True
>> my_sarth = MySarth()
>> my_sarth.okimiis_love
>> True
welcome
typing.TYPE_CHECKINGπ
bro, mypy wants to know ur location
π
π
sarth π oki
where is sarth from tho
you may now kiss the bride
well then you can just use it for annotations
fuck it, l wanna know your location
yup
india
oo
i live with sarth thats how i know hes telling the truth
typecast yourself to me ππ
oh I used a lowercase L instead of a capital i, sorry π
in wid the kids in oki's basement
how you know that?
π
wait did you escaped?
why is this channel so wild from the past half hour
!ot lets move to some other channel ig
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
.topic whenever you guys are here this channel is fucked
saying that after 20 minutes of shitting
read at ur own risk
||and im done with your mama||
im done so yeah
me too
I'm going to sleep now sooo good morning
you cant access my mom? you would access invalid memory making the memory explode
gunnite ash
sweet dreams
it's 10 in the morning what do you espect
expet*
expect
epxecet*
except*
dude really needs to sleep
espresso*
*sleep
iliveinyourwalls*
good night
themks
why is this not working
await ctx.send('my crush loves me')
same to you uwu
Why discord bots don't have eyes
ValueError: your crush does not love you, keep dreaming
owo
you don't have start_a_conversation intents
@slate swan so i want to yeet a button to you so i know if you want to accept my marriage proposal, but only the yes button sends, that wasnt a mistake
π
more like NameError: you dont have a crush π€£
they do
more like TypeError: shes not your type
i had that turned on
violation π
I'll just delete the message
π
Oki get out this channel
π
Bro π
WorthlessnessError: hydro object has no attribute 'worth'
π
lets move to some ot pls
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
.topic
**What's one feature you wish more developers had in their bots?**
Suggest more topics here!
i tried using a try and except but i excepted the truthπ
π₯²
A command to shame oki
π
aw
I just remembered moderators can see deleted messages
mod be modding 1 minute every week π€£
and u wont see me after this
ever again
well bye I'll go study and sleep
byebye
plot twist im a under cover mod reporting all of you guys to get banned by @unkempt canyon 
MODS
about me?
mods are probably laughing their ass off in the hidden channels
imagine
Sleep in afternoon sheesh
rip mpds
i Carried an all nighter today too
rip mops
rip mobs
hmm?
okimii I wanna catch you just like a pokemon π©
The power that's inside
go sleep
no thank you.
π±
yeah i had my phone with me anyways
rip
dude π
π
how bout i catch both u and sarth and put u both in the same ball
who?
Yes
I cant commit the sin of going to sleep without listening to the pokemon theme
Sarth
ash ketchum ley
Suck my pokeballs
broπ
dude
Someone was about to study
someone was about to change their pfp
my laptops' booting
funfact: u have none
bye
bye love you baeeeee
π
all of these jokes
im being serious
one day, oki will fall in love with someone
π±
π€¨
one sided relationship
π₯²
sorry im toxic
okimii trying to get sarth back
in chat
i control him allot but he loves it for some reason
sus
shhhhhhhhhhh
@slate swan go sleep or phantoms will come
hes sleeping
I'll pray to yato uwu
π
DUDE
Noragami Wiki
Yato (ε€ (γ) γ (γ¨) , Yato), also known by his given name, Yaboku (ε€ (γ) γ (γΌγ) , Yaboku), is one of the main three protagonists of Noragami. He is an obscure god who aims to become a God of Fortune. In the past, he was known as a God of Calamity. Yato appears to be a young man in his late teens to early twenties with a height of 173cm (5β7β).[cit...
itachi > yato
phantom wont spawn if u are under roof
Anime ew
yato is a god soooo
sumi > itachi
π
π
pikachu > every anime character
i think youre in a genjutsuπΌ
i see
mhm
Who tf is genjutsu now
cheating on kabuto π
shinchan.
rodaemon.
(if that's the name idr)
you don't even remember the name.
Doremon
guys lets be honest, sarth > any anime char
pfft
dude cant even get the name right
same thing, kiddo cartoons
im eating bro
kakashi > sarth
says a 16yo
wake up to reality
sarth is our unit of measurement
lmaooo
who goes to office
maybe stop ntr π€£
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
nigerundayo
**Do you think there's a way in which Discord could handle bots better?**
Suggest more topics here!
π€£
Hello everyone. Please stick to the channel topic. For anything else, there are off-topic channels.
deadchat in 1 sec π€£
yes
btw i built a bot that day
nice
and it did that and this and that
its kinda fun right?
ssssssssssshhhhhhhhhhhhhh
1 minute
idc
make the slowmode an hour long
4 seconds is already draining my sanity
π
anyways, get back to topic before the channel gets !shhhhed
π
!locl
Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:
# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
file = discord.File(f)
When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.
discord.Embed instances have a set_image method which can be used to set an attachment as an image:
embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png") # Filename here must be exactly same as attachment filename.
After this, you can send an embed with an attachment to Discord:
await channel.send(file=file, embed=embed)
This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.
I cotinusly hit ener until the solwmod runs otu
Shesh
im going to sleep LX so this channel wont go off topic again, right?
imma sleep too now fr
goodnight
another goodnight
Reply yes if u want okimii muted
Good night guys π
Yes
wait no
goodnight
I dont like being alone π
good morning
what
π
dude countered himself
π
!silence
β silenced current channel for 10 minute(s).
Guys...
This channel is just for talking about Discord bots.
Please move your conversation over to one of the off-topic channels.
I will hand out mutes!
!unsilence
β unsilenced current channel.
Also, not an appropriate topic of conversation for this server.
mods can see deleted msgs?
Yep
oh
u all record the msg in another channel?
ofc
oo
guys stop going ot, go to #ot0-psvmβs-eternal-disapproval insteadπ
π Rly
βΊοΈ
Channel lock
sounds like a feature all mod bot has
Does bot.get_channel(βChannelNameβ) works?
nope
No
you need to pass an channel ID
discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Changed in version 2.0: The `iterable` parameter is now positional-only.
Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
What happened here?
Then discord.utils.get_channel(βChannelNameβ)?
@slate swan is there a way to check how two Message objects differ? π
i got ratelimit hard because of reactions having a 2/1s ratelimit iirc so now im using a vpn to avoid the ratelimitation lol
lol
their ids
Ye
No I mean, their uh.....changes?
like message one has embeds and message two does not, so without actually using conditionals for every message attr
I know smh
you mean changes as the changes of their contents?
yes that whatever
you can compare embed objects too iirc
I uhh nvm
ig you can compare objs and if the message obj has them
there's no Direct way to compare 2 messages π¦
hm ic
Is there any library to check that message is not toxic or insulting?
perspective api
what key?
so get one
lol
its free anyway Β―_(γ)_/Β―
β¬ββ¬ γ( γ-γγ)
this sounds like a project that'd lead to a lot of false positives
maybe there will be for another way round
btw u can just use that
and use if else to get the job done
Since cogs can be reloaded without having to stop the bot, is there a way to reload main.py like the cogs?
no unless it's a cog too
Ok
cogs only
Thx
why would u need to reload main.py
cuz there is error in main.py?
I updated the code
If you read the whole thread I went to use the dev version after all
But I don't wanna restart it on terminal but in command like cogs
What's the difference between pycord and d.py
Aren't they the same
no
one is made by idiots and one is made professionally.
I'm gonna guess pycord is made by inexperienced programmers
maybe i was too harsh
idiots is too harsh. Inexperienced programmers is more accurate
Oh so that's the one that got discontinued?
exactly what i was going to correct myself with ^
no
Which one got discontinue
discord.py got discontinued for a bit. this is why pycord was made.
to "continue" discord.py
Oh he owns it
this is why you want to minimise the code that's in your main.py π
good idea
But wait_for doesn't work in cogs last time I tried
it does π
it does.
perhaps you didnt set up your cog correctly
or make according changes to run the code in cogs
I don't use wait_for but you probably forgot the self? self.bot.wait_for
because you redefined client and used client.wait_for there, right?
the error you received should have told you everything.

Ye i redefined client
Oh wait
idk why people still name their Bot instance client
yt
that utterly hurts me.
yup.
I took it from a yt tutorial and stuck with it
youtube is frfr
copying code from youtube is your first big mistake
YouTube is your mistake
big mistake
YouTube Discord bots is a mistake
yeah basically the end of the world if you use youtube
yep.
this would be in your cog init yh
yeah universe will explode
from discord.ext import commands
class Cog(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Cog(bot))
thats all u need
What does -> do
it tells you the function return type
Okk
def foo() -> int:
return 69
``` the function is returning an integer, so its annotated with int
it has no change in how your code runs, see it as a typehint
just helpful for linting
what appears when u hover ur mouse over a function or variable
what ide are you using currently?
if you say replit
it will show expected blah, blah....
Pycharm
thank you.
and pydroid3
still better than replit
mhm.
I don't like replit
good.
no need - uPtImErObOt
pycharm was too bulky for me, I jus use sublime lol
No
vsc is the move
type py a = "string" in a .py file, if you hover on it, it gives some documentation about class str, now when you add a . after it, you will find your IDE auto-completing functions for you, thats basically what the type hints work for
Also does on_message need self?
what do you host it on
no
Termux on my phone
any method inside a class instance needs it
Oh ok
Ok
Gonna try the bot now
I'm getting a client is undefined error
show ur code
@client.event
async def on_message(message):
channelid = message.channel.id
ctx = await client.get_context(message)
if channelid == 886796749258235954:
if message.author != "USAHQ Bot#352":
await message.add_reaction(u"\u2705")
def check(filler, m):
return m != "USAHQ Bot#352"
reaction, user = await client.wait_for("reaction_add", check=check)
user_roles = [i.name for i in user.roles]
permitted = False
for i in ["USAHQ | Operator", "USAHQ |π Executive Operatorπ", "USAHQ |πModeratorπ"]:
if i in user_roles:
permitted = True
break
if permitted:
unverified = get(ctx.guild.roles, name="βunverifiedβ")
verified = get(ctx.guild.roles, name="β
VERIFIEDβ
")
member = message.author
await member.remove_roles(unverified) # Removes unverified role
await member.add_roles(verified)
await ctx.reply("You are now verified!")
await client.process_commands(message)```
@commands.Cog.listener()
async def on_message(self, message: discord.Message) -> None:
channelid = message.channel.id
ctx = await self.client.get_context(message)
if channelid == 886796749258235954:
if message.author.name != "USAHQ Bot#352":
await message.add_reaction(u"\u2705")
reaction, user = await client.wait_for("reaction_add", check=lambda i: i.name != "USAHQ Bot#352")
user_roles = [i.name for i in user.roles]
permitted = False
for i in ["USAHQ | Operator", "USAHQ |π Executive Operatorπ", "USAHQ |πModeratorπ"]:
if i in user_roles:
permitted = True
break
if permitted:
unverified = get(ctx.guild.roles, name="βunverifiedβ")
verified = get(ctx.guild.roles, name="β
VERIFIEDβ
")
member = message.author
await member.remove_roles(unverified) # Removes unverified role
await member.add_roles(verified)
await ctx.reply("You are now verified!")
Oh so that's what a listener does
It works
So I got another error
Actually the same error
Nvm
Do I have to do self.client all the time?
if you're in a cog, yes
Can't I just do
client = self.client```
?
yeah ofcourse inside your function do that, it will still work, but why
πΏ
sure u can
Why isn't ```ctx = await self.client.get_context(message)```` working
I did self.client so why is it still giving me the client is undefined error
did you define client then?
I didn't do this yet
Ye self.client = client
and the setup function?
also this
dont do client = commands.Bot() and make things confusing for everyone
Not doing that
Anymore
cat = commands.Bot() also works lol
Bruh
So just don't name it client or bot
Actually just don't name it as the bot var from the main.py
bot is best name
Yeah
I'll keep it as client for this bot but will name it bot for new discord bots
rework ur code
you can just ctrl+f ctrl+r ;-;
you should not have process_commands inside a listener
it makes commands run twice, because process_commands processes the commands and runs them
i'm pretty sure it's a discord.Member object
!d discord.Message.author
yep
I meant like from an on_message()
yeah
on_message literally takes a discord.Message
Oh ok
So that means if I do message.author.roles it should return a list of roles right?
if the command was used/message was sent in a server, yes
Ok
I wrote this Code, everything seems fine, when I run the bot, there are no errors. The terminal is blank, but when I run this command, it doesn't work, it doesn't send a response, there is no error in the terminal also.
@bot.command()
async def serverinfo(ctx):
embed = discord.Embed(title=f"{ctx.guild.name} Info", description="Information of this Server", color=0x4c8d5c)
embed.add_field(name=':id:Server ID', value=f"{ctx.guild.id}", inline=True)
embed.add_field(name=':calendar:Created On', value=ctx.guild.created_at.strftime("%b %d %Y"), inline=True)
embed.add_field(name=':crown:Owner', value=f"{ctx.guild.owner.mention}", inline=True)
embed.add_field(name=':busts_in_silhouette:Members', value=f'{ctx.guild.member_count} Members', inline=True)
embed.add_field(name=':speech_balloon:Channels', value=f'{len(ctx.guild.text_channels)} Text | {len(ctx.guild.voice_channels)} Voice', inline=True)
embed.add_field(name=':earth_americas:Region', value=f'{ctx.guild.region}', inline=True)
embed.set_thumbnail(url=ctx.guild.icon_url)
embed.set_author(name=f'{ctx.author.name}', icon_url=ctx.message.author.avatar_url)
await ctx.message.delete()
await ctx.send(embed=embed)
You sure the command is being triggered?
Also it's not avatar_url
It's avatar.url
normally yes
Would you maybe perhaps have a error handler eating up the error?
no it is avatar_url
I don't know, how do I know?
Which version are you on
Makes sense if you aren't on 2.0
I'm not in the 2.0 version of discord.py but 1.7.3 I believe
Do you have a error handler
# ΠΠ
@commands.command(aliases = ["ΠΠ", "ΠΠΠ"])
@commands.cooldown(2, 60, commands.BucketType.user)
@commands.cooldown(1, 5, commands.BucketType.user)
async def command_CD(self, ctx):
await ctx.send("ΠΡΡΡ ΠΏΡΠΎΠ±ΠΈΡΠΈΠ΅")
Dear. is there a way to make it so that the command can be used 1 time every 5 seconds and 2 times every 60 seconds? My team only reads one cooldown line
So no global error handler or a specific error handler
Nope
Have you tried the good ol' method of debugging
Of adding a print statement in the command
To see if it's even being invoked at all
I've never used this method personally I'm not sure how it works
It's just adding a print statement to see if the command is being run or not
Well technically the code
you'd need to write a custom cooldown for that
if you do then yes, if you don't then no
see this for inspo
This is not exactly what you need (. I would like to simultaneously use the command 1 time in 5 seconds and 2 times in 60 seconds. And thanks for the example. You will definitely need it !!
add random string prints throughout the code and see where it stops
AttributeError: 'Member' object has no attribute 'add_role'
What is the correct way to do this?
I am doing it like this: await ctx.author.add_role(member_role)
Idk how to use it
its add_roles
Ok thanks bro
Not all prints run
I may have found the problem
anyone help me in this?
/home/runner/Vejita/venv/lib/python3.8/site-packages/schedule/init.py: 100 : RuntimeWarning: coroutine 'msg_Send' was never awaited
self._run_job(job)
Object allocated at (most recent call last):
File "/home/runner/Vejita/venv/lib/python3.8/site-packages/schedule/init.py", lineno 661
ret = self.job_func()
You forgot await
When you are calling that function, add await before it
still same
main.py:59: RuntimeWarning: coroutine 'schedule_job' was never awaited
schedule_job("secs",5)
Object allocated at (most recent call last):
File "main.py", lineno 59
schedule_job("secs",5)
you forgot to put await before schedule_job()
please put await before calling asynchronous functions
exception for memory allocation
Remove that, it's probably because you saw it on the terminal, not the right way to solve it
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/runner/Vejita/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 58, in on_ready
await schedule_job("secs",5)
File "main.py", line 48, in schedule_job
await schedule.every(interval).seconds.do(msg_Send)
TypeError: object Job can't be used in 'await' expression
now this is exception
remove await
in the schedule.every line
can you help me in vc?
now this is the error
I have tried a lot, by referring online forums but not get it
did it still there is an error again
.
def custom_cooldown(self, interaction: discord.Interaction):
if interaction.user.id != self.id:
return None
else:
return commands.Cooldown(1, 30)
@discord.ui.button( emoji = f"{e_eco_work}", style=discord.ButtonStyle.green, row=1, disabled=False)
@commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
async def b_work(self, interaction: discord.Interaction, button: discord.ui.Button):
if interaction.user.id != self.id:
await interaction.response.send_message(content="Π’Ρ Π½Π΅ Π°Π²ΡΠΎΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ", ephemeral=True)
else:
await interaction.response.send_message(content="123", ephemeral=True)
Dear, tell me why the cooldown does not work? button can be pressed continuously
ok so kinda good news for those playing along at home:
I managed to fix all the errors that were showing up, and the bot is now running. That works fine. I now can't get the bot to react when I enter the prefix in the discord server itself
!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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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'll be honest, the docs for discord.py confuse the heck out of me haha
It's one of the more well documented library 
copium
the docs don't have many examples tho most of them just show the class or datatype and the docs intro ends
I think there are sufficient examples in the docs.
You also got the examples in the main branch.
@heady sluice
You can track it but you can't know how many users a specific user invited. Unless you have been tracking it since the creation of the guild.
you can track invites in the audit logs, save the invites as objects, every invite has a creator and every join has an invite which was used
tracking after tracking
at least that's what I know you have to do, never tried it
!d discord.Guild.invites
await invites()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Returns a list of all active instant invites from the guild.
You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to get this information.
oh you don't have to save the invites
Audit log invites could be expired as well.
you do, because invites can get revoked and removed from Guild.invites
Well you can't possibly retrieve the data anymore then.
And iterating trough an audit log, errr.. I don't recommend it.
tbh discord should allow checking that
helpful in moderation ;-;
Yeah
they can just add it as a field in the member object
so we talking about discord or dpy now
Both
this was about the discord API
!d discord.on_invite_create
discord.on_invite_create(invite)```
Called when an [`Invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite "discord.Invite") is created. You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to receive this.
New in version 1.3.
Note
There is a rare possibility that the [`Invite.guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite.guild "discord.Invite.guild") and [`Invite.channel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite.channel "discord.Invite.channel") attributes will be of [`Object`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Object "discord.Object") rather than the respective models.
This requires [`Intents.invites`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.invites "discord.Intents.invites") to be enabled.
https://github.com/toxicrecker/DiscordUtils/blob/master/DiscordUtils/InviteTracker.py im not recommending it, but you can take an idea from how this 3rd party library does it
the results are never 100 reliable*
im having a problem with the await and return command
Never seen button cooldowns.
If I would make it I would probably just disable the button for x amount of seconds then re-enable it when they are allowed to use it again. People can't spam what they can't click π
can someone help me with the await and return command?
What exactly?
if message.author == client.user:
return
if message.channel.name == "testing-1":
if user_message.lower() == "hello":
await message.channel.send == (f'Hello {username} !')
await and return are unknown
Unknown as in?
I am trying to make commands for my Discord bot. Does someone know how to fix this error?:
File "main.py", line 22
await message.channel.send('Hello!')
^
SyntaxError: 'await' outside function
This is my whole code:
#imports
import discord
import os
client = discord.Client()
#running bot account
client.run(os.getenv('DISCORD_TOKEN'))
#botcommand
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
#command Hello
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("*Hello"):
await message.channel.send('Hello!')
indents
single space indents π
uwu
both are syntax errors for some reason
Press Spacebar in front of if
And await
Ur indents
oooh yeah sorry I am a beginner
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
U can read this its helpfull
okay
AS much as i want to send you a ss(screen shot) im using vs code which isnt letting me smh
please help
So I made a discord bot, it works with sqlite3, uploaded it to heroku. When I download the repository, the database file remains unchanged, although I made changes in the bot. I made the bot output the database values - and they were changed, but when I downloaded them , there were no changes. How do I download the sqlite3 database file from heroku?
Hey @viral dock!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
I am trying to make commands for my discord bot. When I type *Hello in my discord server the bot doesn't respond. Someone know the problem?
#imports
import discord
import os
client = discord.Client()
#running bot account
client.run(os.getenv('DISCORD_TOKEN'))
#botcommand
#command Hello
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("*Hello"):
await message.channel.send('Hello!')
if message.content.startswith("*Hello"):
await message.channel.send('Hello!')
Extension 'cogs.administrator' raised an error: TypeError: object NoneType can't be used in 'await' expression
Enable tracemalloc to get the object allocation traceback
async def load_extensions():
for filename in os.listdir(".\cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
async def main():
async with bot:
await load_extensions()
await bot.start(TOKEN)
asyncio.run(main())
Python 2.0 version
nm
Guys how can we make a email notify in dpy bot?
sorry was this message answer to me?
no
@bot.command()
async def test(ctx):
await ctx.send("hello")
try this and remove on_message event
@shrewd apex can I ask some thing?
Is it possible to make a bot that dm me when i get a email?
use the gmail api
can you help me?
Is it possible that it notify me?
yes
use that api to trigger an event in ur bot
Thanks for help
def custom_cooldown(self, interaction: discord.Interaction):
if interaction.user.id != self.id:
return None
else:
return commands.Cooldown(1, 30)
@discord.ui.button( emoji = f"{e_eco_work}", style=discord.ButtonStyle.green, row=1, disabled=False)
@commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
async def b_work(self, interaction: discord.Interaction, button: discord.ui.Button):
if interaction.user.id != self.id:
await interaction.response.send_message(content="Π’Ρ Π½Π΅ Π°Π²ΡΠΎΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ", ephemeral=True)
else:
await interaction.response.send_message(content="123", ephemeral=True)β
Dear, tell me why the cooldown does not work? button can be pressed continuously
How do you put your code in such a text block with the colors?