#discord-bots
1 messages · Page 693 of 1
First of all what loop
Eevee
Or floats
I gave you so many
Please don't say like this thanks (:
Sorry mr simp
coughs
I didnt mean to offend her it was a jk

!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Keep on topic mr
Lollll
Or else
Hm? Or else?
Do u really think that I care about u being anywhere in the world?
!ot you guys can plan a date in off topic channels not here
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Thank you eevee i appreciate it
Welcome
Seems like you do?
🕴️
Yeah Why not
i thought christians were supposed to have love in their heart
translator bot
grab a message, use some shitty translator api to change it and reply to it on that lang
I do but just no
Ayo?
You should make a bot that is very infuriating
Nothing without love jeez
Lol tinder bot
Love is in the air blushes
Reminds me of the bot kai was making, was actually tinder bot
Guys i said COMMAND ideas
async def send_dm(ctx, member: discord.Member, *, content):
channel = await member.create_dm()
await channel.send(content)
what will the command look like when the user will send a message?
Oh command
A command that is very infuriating
Just do it lol
!send_dm @user msg
I'll take it if you don't do it
A trigger command
You better not
thanks
Idk ur prefix so I used !
Is nsfw all you think of?
Just like ygg, make the userphone command
no just make it
Why should i?
Whats that?
You can talk to people from other servers
Random people in random servers use --userphone and can talk with each other connected to different nodes
again, ask the user for their biodata and sell it on the dark web
Eevee🕴️
What is going on inside your head🕴️
Well u may get multiple dollars
no
First you guys want me to make a nuke bot then make a nsfw bot then sell data on the darkweb?
hm do nuke bots really even break tos
Thinking about you blushes
Nah, this kinda ot
Wao
Nah you want a case🕴️
software developer
1 day
Ill be one

On the grind if you know what I mean
i dont.
||I've already rejected 2 proposals, end of discussion||
Understandable have a good day
Guys I have a small problem with Discord buttons, if one guys is using a button, the bot respond to another server where the button was pressed previosuly.. what can i do?
Im learning everyday to be a software dev
No cap
My dream job lol
||understandable, I see||
🚶
Guys what commands should i do with buttons?
reactions > buttons
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.economy' raised an error: SyntaxError: can't delete function call (economy.py, line 34)
@commands.command(aliases=["deactivate"])
async def cancel(self, ctx):
users = await self.get_bank_data()
user = ctx.author
if str(user.id) in users:
del users(user.id)
else:
await ctx.send("You dont have a account to deactivate.")
with open("bank.json", "w") as f:
json.dump(users, f)
code
try del users[user.id]
ideas for voicechannel commands?
Nah
nah
!d discord.ext.commands.Bot.help_command
The help command implementation to use. This can be dynamically set at runtime. To remove the help command pass None. For more information on implementing a help command, see Help Commands.
so inside commands.Bot(), you can set help_command=None
in python
client/bot.remove_command("help")
obviously
ok
Only bot
@slate swan
not necessarily
Clients don't have the concept of commands
😔
where do i need to put that
they would name commands.Bot client
you (should) have bot = commands.Bot
inside commands.Bot, you put help_command=None
Misnaming is terrible especially in an API wrapper such as this because those two classes mean different things.
where should that be
inside commands.Bot
where is commands.bot
B
from discord.ext import commands
bot = commands.Bot(help_command=None)
yes
yes, because it's instant and doesn't need to invoke a line more
It is best to subclass commands.HelpCommand and pass it to help_command
Imagine subclassing the help command
imagine not
I just make another command named help
it gives me errors
Traceback (most recent call last):
File "c:\Users\Pasci\Documents\Netheritesmp.py", line 18, in <module>
bot = commands.Bot(help_command=None)
TypeError: __init__() missing 1 required positional argument: 'command_prefix'
PS C:\Users\Pasci\Documents>
commands.Bot(help_command=None) is missing 1 required positional argument: 'command_prefix'
place commands_prefix = "your prefix" in it
i think
I am not the one having the error
huh

wrong reply lol
any way to fix
by putting that keyword argument there
oh god
!resources I wanted to say this long ago
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
ok
Good thing you did
Should the command prefix be an integer or string?
str
How can i add cooldown to my commands?
there's a decorator
Should the str be the python str class?
!d discord.ext.commands.cooldown
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
it wont work
Show
This is giving me brain damage
i wanna remove that
Not the actual command
and there goes bro again is string a discord function?
Your bot constructor
Only thsi?
WHAT
okay you're trolling
good
I know
how do i remove it doe
can you.... screenshot your code?
without the token
You said what🕴️
bot = commands.Bot(..., help_command=None)
I'm curious if you replaced your bot definition or put a 2nd one
I swear if he named hes bot constructor client im going to lose it
like that
In imports
Eww
🕴️
you've got a damn lot of unnecessary imports
and not the knowledge of classes
it's Member, not member peepoCry
wait you have two
ik im lazy removing that
Im done
no
uh
Im done

got it before you okimii
Not the client part mr
okay we all stop bullying
@slate swan remove the client variable completely
and use your bot instead
Why am I always ignored
magic
you just deleted your message
Lol i didnt
Idk i mostly go over your msgs for a reason
you said something with love
Wha......
Weird isnt it
I edited it
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
wait there's only one
Your funny arent you🕴️
Bye, thanku for your kindness
Thats why you get ignored
🚶
Hold up
I left my bot over night and it activated on ready 2 times wtf?
hmm
Why?
Ah i see
Probably cause of my wifi
I was installing a game so it probably got disconnected from the gateway
.
Make an alexa
Ight
okimii pfp 
Clean isnt it
!d discord.Member.bot
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
member.bot?
how do i make my bot @ everyone
im not stupid anymore
I'm not sure if a simple
await ctx.send("@everyone") does the work
probably
what is disnake api
disnake is a modern, easy to use, feature-rich, and async ready API wrapper for Discord.
An API wrapper is a program that allows you to interact with an API without having to write the code to do so.
how can I get all roles in the server?
Ohh, i got it
using threading you can run discord.py and flask at once so maybe you can do same for disnake
i have to use replit so to keep my bot running i ahve to do flask + uptime robot
how do I use this
but how would you get flask to interract with discord?
like, the api. .
??
lets say on some restful api event, id like the bot to send a message. . (i ended up using quart instead for that reason)
what do you want to use it with
tho im still curious if you can still use flask for that?
with discord.Client() and printing it into console
i mean what do you want to use guild.roles for
I just wanna print all the roles of a guild into the console for experiment purposes
and what do u need help with
with how to get the list of all the roles in a guild
its just guild.roles
so I can just write
print(guild.roles)
```?
you said ur using dsicord.Client?
client.loop.create_task(my_task(message))
hm
ye
how do I use this
then you would use message.guild.rolesif ur doing it in the on_message thing
Thanks
Im wondering of how to make my bot give roles to new members and the admins of servers can choose what role is given. I also need this to work in multiple servers who will have different roles.
well you could give them the role on_member_join and have a command which is admin only that could set the role to give which would be stored seperately by server
ty
because musicbot.py probably doesn't have a function/class named utils
but what?
the IDE isn't giving any errors?
if you try to ctrl click on utils where does it lead you to?
no were ;-;
i download this code from github
I don't understand what the roles parameter is suppose to be
a role object, your adding a role to a user
how can I get that
like the role id or something else?
you'd convert a role id to a role object, or another simpler way for testing would probs be ctx.guild.roles[1] should return the first role in that guild,
you could have your command require a role as a param, but then you'll need to @ that role. . . (or maybe a check with written as words but some roles maybe harder to type out)
another method that i use is using ui, get the user to select a role from a list...
I am using discord.Client()
import discord
client = discord.Client()
@client.event
async def on_ready():
print("Ready!")
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("!!test") and message.author.id == 489115020412715041:
await message.author.add_roles()
unless required, i would highly suggest moving to commands, it does make it alot easier
alright
its really simple once you set it up!
I just wasnt confident with how it works
yes, me too when i first started, made my first bot with client too, it was a nightmare!
second bot was without cogs, did a full rewrite and im on my third iteration . - .
lol, ima try commands now
client != bot so name them differently.
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!!', description="BossSaitama's bot.")
welp, ill leave the rest for you to figure out, cant spoon feed, just a stepping stone
alright, thanks
intents is not defined 
oh, f. . .
thx fixed it
👍
Also i recommend using Disnake.
whats that
!pypi disnake It's also a Discord wrapper but more up to date :)
if i moved from dpy to disnake, do i need to do a full rewrite (from 2.0)
i got a lot of ui stuff too
no
Most of the stuff is just the name Discord to Disnake.
just replace all discord -> disnake
are the docs separate for this
so should I learn this instead of disocord.ext commands
hmm, guess ill make a copy and try it ;-;
welp, ive ended up just changing core discord py code, couldnt figure out how to implament stuff, assumed they just dont exist like refreshing cooldown for ui thru code
Well it's practically the same but Discord.py is not getting updated anymore.
oh so disnake is getting updated and discord.py isnt
I started to use it
Yep.
due to reasons pertaining to the direction discord is taking with slash commands, the owner of dpy has stopped updating it
it's functioning
🥳
alright ima learn disnake then, thanks
role icons? is that new
yes
requires boost?
I think so
but you can farm boosts
with that steelseries giveaway
how does one farm boosts?
Are you new to Discord..?
it's just a new account
oh
last 2 lines mean "only for new users of discord nitro"
it's like the epic games giveaway
ig thats what you mean by farming boosts. . .

if someone open spoiler text can discord bot recognized it
no
this is not possible ?
if you send me a spoiler text
and I open it
can you recognise it that I opened it?
if discord bot send a spoiler test and i open it then can discord bot recognized ?
ofc ;-;
actually it can do alot more lol
I'll never say no to free stuff.
do u know any good bot source code
discord took 1 dollar from me
meaning
it's a scam


!source is the source code of @unkempt canyon.
Unable to convert 'is the source code of @unkempt canyon.' to valid command, tag, or Cog.
!source
wasn't scoopy a dev of disnake?
No?
I was promoting disnake because it's good, not because I'm its developer.
Should this work? I want to check every hour if a specific Vanity is available and use it instantely. I will connect it to a loop. It's like a "Vanity-Sniper"
await asyncio.sleep(3600)
try:
await guild.edit(vanity_code="cool-server")
except:
print("Vanity already taken")
but your pfp was the thumbnail of the github url when you linked it
Thought, I don't take it as promoting. People were just asking for good forks, so I recommended it.
That wasn't me, then. The only links I advertise on my profile are where I work, and I am not a staff team nor a partner of disnake.
got my emoji's back
that was quick
hi panda
is there a way someone could help me with this ^^
what's Vanity
Well vanity URLS can be taken for a really long time.
Yeh I know a guy who is stealing my vanity everytime.
Just to annoy me
And sometimes his boost go lower than 14 but I miss it
You can't "steal" vanity URLS or you just don't have enough boosts.
Yea well mine went under 14 one time and since then he has my vanity
I recommend making a task for it then.
but I'm over 14 again and now I want to "snipe" as soon as his boosts go lower then 14
How would you do it?
class MyCog(commands.Cog):
def __init__(self):
self.printer.start()
def cog_unload(self):
self.printer.cancel()
@tasks.loop(hours=1)
async def printer(self):
try:
await guild.edit(vanity_code="cool-server")
except:
print("Vanity already taken")
Smth like this?
Don't bare except it.
Then it's all good.
so just
@tasks.loop(hours=1)
async def printer(self):
await guild.edit(vanity_code="cool-server")
without try?
No do the try except but not a bare except.
Hmm
uhh
question, does disnake allow you to add buttons at a specific row, so all other items get shifted a row (after view is created)?
!e ```py
test = {"t": "test"}
try:
test["s"]
except KeyError:
# The exception that is being raised
print('error')
@slate swan :white_check_mark: Your eval job has completed with return code 0.
error
ok ty!
How to get my discord bot's latency aka ms?
Why does my task run after every 12 minutes IF its set for 180 minutes xD
why not time.sleep
!d discord.ext.commands.Bot.latency
property latency: float```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.
This could be referred to as the Discord WebSocket protocol latency.
Code?
The first task loop is fine, but after 2nd cycle it starts to run after 12 minutes
😠
😭
!d asyncio.sleep
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
@cloud dawn But is guild.edit(vanity_code="cool-server") right for changing the vanity?
what is the bot react to messages commend
yup
eh?
k ty
!d discord.Message.add_reaction
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
check dms
@commands.InvokableSlashCommand()?
What is your client/bot var?
No idea tbh
lemme try that one
client = commands.Bot(command_prefix="!", intents=intents)
File "c:\botok\VCbot\cogs\menus.py", line 8, in Menus
@commands.InvokableUserCommand()
TypeError: init() missing 1 required positional argument: 'func'
prob remove the ()
hm
idk what invokbleusercommand is tho
disnake stuff
I'm just experimenting
seems to work on startup
command is not found
I'm making commands from a JSON file. My file looks like this:json [ { "name": "hello", "output": "Hello!" }, { "name": "goodbye", "output": "Goodbye!" } ] I have figured out how to make new commands, but I don't know how to make multiple. Here is my code:```py
Get data
def getData():
with open("customCommands.json") as jsonFile:
data = json.load(jsonFile)
return data
data = getData()
for command in data:
@commands.command()
async def newCommand(ctx):# Somehow change newCommand to command["name"]
await ctx.reply(command["output"])
client.add_command(newCommand)
print(f"Added " + command["name"])
once I make a new avatar command in the main file
disnake.ext.commands.errors.CommandRegistrationError: The command avatar is already an existing command or alias.
meaning it exists but it doesn't exist
I dont know if i get what u are trying but i think u could solve this by using aliases?
client.latency
it prints "nan"
!d discord.ext.commands.Bot.case_insensitive
Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.
Could you show your code?
which part for it?
Well what you are trying.
panda
Yes?
kk
how to start my bot react to every msg
if a pass a command !start
client = commands.Bot(command_prefix="!", intents=intents)
ms = client.latency
print(ms)
Every message the bot sends?
no i send
Use on_message
Show what you got so far
how do i get the author.channel
its author.channel or something else ...
message.channel
@cloud dawn
Yeah this message.channel = message.content idk what this is
same
Uhh idk did you do something before that?
You haven't logged in by the time ms is printed
Therefor the bot has no ping
Yeah makes sense lol
why this is not working
if message.content == 'c':
await message.add_reaction("\U0001F60E")
-_-
It's not the full code
The output is nan
I don't need to see the full code to know that is the issue
Your bot.run should be at the bottom of the code, thus is ran last; Your print is before that
Meaning the bot isn't connected when you print the latency
bot.run is at the bottom
^^^ Keyword: when you print
Your are connecting, just does it after the print
Therefor when the print is called it isn't connected yet
Therefor is NaN
What if its inside of a command?
Yes that would work
Do whatever
K
Can you provide a example code please?
damn
how is tasks.loop blocking the code ffs
Hey guys. I'm looking to make a big Currency Bot with a very big system of mining and more. DM me if interested. It's very amazing idea.
The bot won’t be connected so it won’t have the latency. Once the bot is connected you can get the latency like in a command. So once the bot is connected and not before
Does disnake also help with ping, or is this just a coincidence?
They havent changed anything major so coincidence did you try it more than once?
if i do sort on a 2D array, what is it going to sort?
i have a 2d array of [[name, score],[name2,sccore2]] etc
i want to sort the score
oh why am i asking is discord bot sorry
hight to low?
Why not use a dict?
If I want to make a bot that accesses a number from a command(eg. >>> sayhi 50) how would I code that?
Like an echo command?
Hi
how do i sort once i get a dict
?
im new to using dictionaries sorry
!e ```py
k = {
"player1": {
"score": 10
},
"player2": {
"score": 50
},
"player3": {
"score": 35
},
"player4": {
"score": 5
},
"player5": {
"score": 66
}
}
print(list(k.keys()))
print(sorted(k, key=lambda x: k[x]["score"]))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
001 | ['player1', 'player2', 'player3', 'player4', 'player5']
002 | ['player4', 'player1', 'player3', 'player2', 'player5']
Function but shorter
are there any forks of discord.py v1.7.3 that can be used at the same time as discord.py v2? wether it be something like import discord, discordv1 or just a fork, i need both at the same time. let me know 🙏
idts
just use one fork
im trying to have discord v1.7.3 znd discord v2.0 as 2 seperate imports, not to use in the same file, but to be able to operate old code sources without needing to uninstall and reinstall then uninstall and reinstall each time
pycord's import is discord
so something like
#file 1:
import discord```
```py
#file 2:
import discordv1```
but you only need to install it one time only? why would you need to reinstall it
u can have both versions at the same time?
nvm didnt read it correctly
cuz some of the attributes im trying to use arent working with the old sources when using dpy v2
no, it'll overwrite the 2.0 dpy if you use dpy 1.7
weird, when i tried to install v1 while v2 was installed it said requirement is already satasfied
does that not mean that the files already exist and no changes will be made?
or have i been looking at this the wrong way the whole time
hm
yes, if you wish to change it use the -U flag
which array should I use for a tree command for a marriage cog
yes
Just download them..?
Wouldn't the imports just overwrite each other
Not if you actually download it
Not trough pip
So if you downloaded both version and imported discord you'd be able to use both versions???
That doesn't sound right
You can just modify the name ofc
how?
Trough the setup, just change the name and your good.
Then use local pip to install it as a local package.
im testing endpoints
dpy endpoints? or what
discord endpoints
theres more than that but i wont go into details
hm
requesting endpoints, as in making http requests to them?
those are really just get/post requests and are independent of the d.py library
how do i install pycord, by that i mean what version do i install? what is the command because i found quite a lot of them on pycharm
!pypi pycord || pip install pycord
A Python wrapper for the Discord API forked from discord.py
so, do i just do py import pycord as discord from pycord.ext import commands because im honestly just too lazy to do anything else
then what?
apologies
its fine
never used these forks
So, i just tried this, discord.py got me around 100 ms ping, disnake around 50, pycord a little more than 50, and the results are constant? Are the forks meant to be faster like this?
or is it just me?
discord.py always got more ping in all of the tests
Really depends on allot of things
i know, but this is very consistent
Ig disnake is faster but it depends on the traffic of your wifi and many other stuff
mine is around 1gb/sec
Idk maybe disnake is faster ig
But wait
yes?
Its not a good test youll have to check 10 times
okay
guess i have to uninstall pycord now
If it does 50ms each try its 100%
Faster
Youll have to so many tries since it depends on many stuff it will be a good test
oof the ping just spiked with pycord
im not going to filter out outliers im biased towards disnake lol
Lol
def page_url(method, page:int=0):
if method=="main":
return f"https://www.curseofaros.com/highscores.json?p={page}"
else:
if method in ['mining', 'smithing', 'fishing', 'crafting', 'cooking', 'woodcutting']:
return f"https://www.curseofaros.com/highscores-{method}.json?p={page}"
def stats(method, name):
page=0
while True:
r= requests.get(page_url(method, page))
if not r.text.strip()=='[]' and not ( r.text.strip())=='Not Found':
for i in range(len(r.json())):
if r.json()[i]['name'].lower()==name.lower():
stats=r.json()[i]
return stats
page+=1
else:
raise Exception('Not Found')``` This requests is blocking my async program and making the bot process only one command at a time. How can I fix this mess? (I have only used requests for requests, I never tried urllib/aiohttp/httpx etc.)
the ping means absolutely nothing in the grand scheme of things. And besides disnake, pycord and discord.py all use the exact same code for the WebSocket connection.
^
anybody know how to parse data from a user's input in a pytorch chatbot? Basically if the input is "whats the weather in tokyo" for example, how would I get that little "tokyo" bit?
Hard to do this without some sort of machine learning
^
At the very least you would need to tokenize the sentence though
And then you'd parse those tokens
which array should I use for a tree command for a marriage cog
pytorch and nltk to tokenize everything
I can only think of a dict, or 1d array of classes containing data for the marriage.
discord.py last_boost.premium_since will return secs right?
hmmm ok
it'll return a datetime.datetime object iirc
yea checked the docs
U need to do ctx, *, entry
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
self._check_closed()
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000229E4BF2200>
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed```
async def close(ctx):
await ctx.send(f"{client.user.name} has been shutdown")
await client.close()```
Ignore it, normal behavior on windows.
Yeah but it doesnt work
what doesnt work
The bot doesn’t close when you call .close() ?
It should be shutting down if it’s throwing that error.
yes
well it didnt close the bot
its staying online
Does it still respond to commands?
i got error : AttributeError: 'Infos' object has no attribute 'say_permissions'
'Infos' was the cogs
u cant use a method u havent made
ok, so if it doesn’t respond to commands then it did close then. It takes discord time to update shit. So it will look like it’s still online when it isn’t in some cases.
That wasn’t my question….
Would it be fixed if i change the token?
I’m asking after you call that method
no?
Does it respond to commands
@jade tartan
oh nvm its offline now
k
but why does it do this error?
changing the token is useless
it isnt an error
is showing if it offlining btw
It’s a Windows thing.
Nothing you can do about it
its just asyncio saying ur loop (the bot loop) closed
ohh ok
not all things is error
So its not really a bot error?
no
when ur bot on a vc it will show another error
in*
Well it aint
ye
That’s why you should have proper clean ups 👌
XD
nope
if u shutdown the bot it was disconnected to discord anymore
u need to restart or run the code again
You could always use a process manager like systemd or pm2 that auto-restarts when the process is killed.
how tf would you invoke the command if the bot was offline
???
Ohh really how?
Read their docs.
systemd is standard for most Linux distros
embed.add_field(name='’Coin toss', value='Play coin toss', inline=True)
Is there any other way to write this code?
Ex. Instead of embed.add_field what other way could I write this?
pm2 tho is kinda iffy. You have to install node/npm/yarn/etc to install it.
discord.Embed(**kwargs).add_field(**kwargs) use the method directly
i havent pushed my code but i turn off my vscode
Open cmd/poweshell or something and cd to the directory that has your .git file in it then. Ez
is that for custom embedded command?
Where would I add my texts and stuff?
Yes
in the kwargs
Oh gotcha, ty!
oh cool i used that too
Nice
embed.add_field(name='Coin toss', value='Play coin toss', inline=True)
i think that will be more cool
yeah
i need a more complex one tho
and inline=False
XD
meaning?
tryhard embedding then
non readable and not beginner friendly
still to this day I try to figure out why Embed.add_field() arguments aren’t positional.
lol
I’m trying win a bet
if Embed = discord.Embed ?
what
?
make worse bot?
no, “Who could build a complex discord bot”
Without easy code
that isnt complex though
you can just make a musicbot then lol
thats just embeds
with only ytdl and ffmpeg
But there are other ways to write embeds no?
no
Wayyyyyy to hard and over my skill gap
ig you can subclass discord.Embed
oh shit
wym
use class
ohhhhh okk
Thats a function though I said subclassing discord.Embed
something like.
class EmbedSub(discord.Embed):
… init shit
self.add_field()
init shit lol
yea because it was classed
stack overflow has this
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
if (message.channel.id == redacted):
if "status code" in message.content:
print('Message from {0.author}: {0.content}'.format(message))```
lol
lol
dont copy bad code, if you wanna make a real bot use commands.Bot not discord.Client since Client has limited features compared to commands.Bot
wait but why when im resetted the bot those "Downloader cogs loaded" not shown
oh
subclass it first
ah im bad at that
wait ur class is called Events, whats Downloader
wait so it need to at same as cogname?
obviously
why’d you reply to me.
wrong person
well my class is like class Downloader(commands.Cog):
and because i think it was an event i named those class Events
!e
class A:
def do_stuff(self):
print("Did stuff")
class B(A):
def do_more_stuff(self):
self.do_stuff()
print("Did more stuff")
print(B().do_more_stuff())
``` an easy example of inheritance, bye now
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
001 | Did stuff
002 | Did more stuff
003 | None
kayle is @commands.command() the same as @bot.command()?
if cogs u should use @commands.command()
!d discord.ext.commands.Command rtd
class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.
These are not created manually, instead they are created via the decorator or functional interface.
ah i got my problem
h
kayle
i got one
kayle = discord.Embed()
kayle.add_field….
await ctx.send(embed=kayle)
yes what
Wow such empty
^
SyntaxError: unexpected EOF while parsing```
this the error
and code keep_alive() bot.run(os.environ['Token']
u didnt close a string
ohh
!e
print("h)
@boreal ravine :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print("h)
003 | ^
004 | SyntaxError: unterminated string literal (detected at line 1)
ohh
ok but i think your error means you didnt close a string
ah ok
ty again
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 183, in on_message
embed=discord.Embed(color=0xff0000)
File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 15 column 6 (char 263)``` can sameone help pls
can you provide JSON which you are trying to decode? Is it properly formatted?
https://www.toptal.com/developers/hastebin/tumuvozori.json theres a joson file for leveling system and theres https://www.toptal.com/developers/hastebin/jogiwakofe.py code of my bot
remove , at the ending
{
"739861800769552525":{
"791583999361155092":{
"experience":7,
"level":1
},
"689461924038967346":{
"experience":626,
"level":5
},
"814226043924643880":{
"experience":538,
"level":4
}
}
}``` should look like this
oh
also just saying removing the default help command is not a good option
guild = client.get_guild(756504534897000528)
while True:
for member in guild.members:
try:
if member.nick.startswith("✨"):
pass
else:
await member.edit(nick=f"✨・{member.display_name}")
except:
pass
I want it to stop if everyone is done, How do I do that?
ugh
they arent fluent in english so i dont think they'll understand much
oh
remove while loop
But it won't do it for everyone
Ur doing it for every member so shouldn’t it do it for everyone?
nvm it works
it will though
it did, Thanks ❤️

async def on_member_join(member: discord.Member):
role = member.guild.get_role(8912345321432145942)
role = member.guild.get_role(123321432321123)
await member.add_roles(role)```
why does this not work?
it only gives a member the second role on join
Well ur defining role twice
So change one of the role to a different name
second variable overwrites the old one
^^
right
!e
role = "value"
role = 1
print(role)
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
1
async def on_member_join(member: discord.Member):
role1 = member.guild.get_role(893297001897295942)
role2 = member.guild.get_role(921597725215178783)
await member.add_roles(role1, role2)```
could i do this
Should work
thx
Should show code
its class music
import discord
from discord.ext import commands
import youtube_dl
class.music(commands.Cog):
def init(self, client):
self.client = client
@commands.command()
async def join(self, ctx):
if ctx.author.voice is None:
await ctx.send("You're not in a voice channel")
voice_channel = ctx.author.voice.channel
if ctx.voice_client is None
await voice_channel.connect
else:
await ctx.voice_client.move_to(voice_channel)
@commands.command()
async def disconnect(self, ctx):
await ctx.voice_client.disconnect()
@commands.command
async def play(self,ctx,url):
ctx.voice_client.stop()
FFMPEG_OPTIONS = {'before-options': '-reconnect l -reconnect_streamed l -reconnect_delay_max 5', 'options': '-vn'}
YDL_OPTIONS = {'format':'bestaudio'}
vc = ctx.voice_client
with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
url2 = info['formats'][0]['url']
source = await discord.FFMpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
vc.play(source)
@commands.command()
async def pause(self, ctx):
await ctx.voice_client.pause()
await ctx.send('Paused ⏸')
@commands.command()
async def resume(self, ctx):
await ctx.voice_client.resume()
await ctx.send('Resumed ▶️')
def setup(client):
client.add_cog(music(client))
bruh.
any solutions?
r u sure?
yes I'm sure
Don’t put dot in between class and music
basic OOP
Also shouldn’t def init be def __init__
and im positive keywords dont have something after them, ```py
pass #correct
pass.do_shit() #wrong
i have written that
discord has messed that part of code
discord formats it wrong
guys
r u sure
Yes
oh ok
With space
but still
show
functions must be on the same line you used a decorator
Yeah no indent after the decorator
@stuff
async def func():
... #correct
@stuff
async def func():
... #wrong
Go the the replit packaging thing on the left side and add discord.py
There’s another discord.py in the packaging thing. Try adding that
Btw your commands arent gonna be found lol
what?
Your commands arent indented
They should be indented with the function
Inside of the class
doesn't python do auto indentation?
no
go learn python now yes
Yes
im aiming for js now no hate to python whatsoever
Python isnt hard really
lemme just check what the matter with python indentation is
oh
the commands must be inside the class for the command to register
before that
TODAY we’re making a budget Rythm as easily as possible. Enjoy!
Thanks (for non copyright music):
🍪 Soundcloud : https://soundcloud.com/lukrembo
⭐️ Twitter : https://twitter.com/LuKremBo
😀 Instagram : https://www.instagram.com/lukrembo
✉️ Email : Lukrembo@gmail.com
----------------...
i wanna ask yall if this vid shows proper indentation



