#discord-bots
1 messages ยท Page 467 of 1
i dont understand, how will get the cogs then?
Yeah, it doesn't show any errors
you only need one cog?
did you make sure to save your code or something
how do i do buttons command?
I did, I pretty much do Ctrl + S every few seconds
i am trying if cogname == anyone of the cogs
I learned my lesson after crashing Vscode
then why are you using get_cog
as i said, bot.cogs is a mapping of the cog name and the cog itself
you only need to check the name
If you just want to see if a cog exists use get_cog and the walrus operator
if cog := bot.get_cog("name"):
# cog exists
Keep in mind walrus operator in python 3.8^
Yep, doesn't really show anything
Python?
Yep
use what andy said
It's the way to execute a file through the terminal
its better
That works for me, atleast
It still works when i doPython File.py
i am not doing it for jsut one cog
I'm not sure why, it just works like that
can someone explain why I keep getting this?
File "/home/turtle/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/turtle/dusk-beta/cogs/economy.py", line 423, in baltop
print(doc['net'])
TypeError: 'int' object is not subscriptable```
you have a single cogname
doc is an int
do you do anything inside the cog files that might block
anything outside the cog class
well in my bot there are many cogs, i am trying to cogname == any one of the cog then get it commands and limit them.
Nothing other than declarations and the def setup
Yeah? Use my example and instead of a string pass a variable to get_cog
I'm considering just rewriting the whole main.py, it's been giving me problems since forever
actually
And since it's in a walrus you get the cog obj if it isn't none
the issue could still be from that cog file you imported at the top
can you send its code
then what is it? How can I check what it is?
you tell me, itโs your code not mine
that's why i'm trying to print it to find out lol
!PASTE
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.pydis.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.
it should be an int
okay and doc is an int
you can always check with type()
I tried that
https://paste.pythondiscord.com/pecutujufe.py @hasty iron
why can I not print out an int?
What does it return?
You can print out an int, you can't try to index on it though
that error
if you want your int, then its doc
hm, i donโt see anything that could block
hm.
I might just rewrite
actually what about that Imports is it actually commented
This is getting ridiculous, it's been giving me problems since forever
It is, I just didn't copy it properly
anyways the problem could be from Python
from what i know, its only available if you install from windows store, which is basically a bad version of python
Jesus help me
try py?
k
what do u need?
Enlightenment
Yep, py doesn't work
and inside your cog file, you instantiate a Bot instance
i read that discord.py is dead
and that overrides your other instance i think?
Elaborate, I didn't quite get it?
well im not actually sure anymore
Only one image shows up...
invinfo.set_thumbnail(url=f"https://cdn.discordapp.com/banners/{r['id']}/{r['icon']}.png")
invinfo.add_field(name='Server ID', value=r['id'])
invinfo.set_image(url=f"https://cdn.discordapp.com/banners/{r['id']}/{r['banner']}.png?size=1024")
im just guessing at this point
What does this have to do with python?
in your cog file that you just sent, remove that bot = โฆ
discord.py is the discord api on python
how is it "dead"?
Yeah but his issue is not with a module.
k, testing
!e
@client.event
async def on_member_join(member):
channel = client.get_channel(880455561899044975)
embed = discord.Embed(title="๐Bem-vindo(a)!", description=f"Olรก {member.mention}, espero que vocรช se divirta no meu servidor!", color=0x850dbd)
embed.add_field(name="โ๏ธ Precisa de alguma ajuda", value="Caso necessite de alguma ajuda da STAFF, abra um ticket #ticket", inline=False)
embed.add_field(name="๐ฎ Evite Puniรงรตes", value="Leia as nossas @pale sky", inline=False)
embed.set_author(name=member.name, icon_url=member.avatar_url)
embed.set_thumbnail(url=member.avatar_url)
embed.set_image(url="https://i.imgur.com/1ajH1RF.gif")
embed.set_footer(text=f"ID: {member.id}")
await channel.send(embed=embed)
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'client' is not defined
i can send u the article
It has been discontinued, archived.
do you guys know any good api for pokemon or digimon ?
that could give all of the information about the characters ?
i searched but didn't found what i wanted
!e
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members=True
client = commands.Bot(command_prefix = "!", case_insensitive = True, intents=intents)
@client.event
async def on_member_join(member):
channel = client.get_channel(880455561899044975)
embed = discord.Embed(title="๐Bem-vindo(a)!", description=f"Olรก {member.mention}, espero que vocรช se divirta no meu servidor!", color=0x850dbd)
embed.add_field(name="โ๏ธ Precisa de alguma ajuda", value="Caso necessite de alguma ajuda da STAFF, abra um ticket #ticket", inline=False)
embed.add_field(name="๐ฎ Evite Puniรงรตes", value="Leia as nossas @pale sky", inline=False)
embed.set_author(name=member.name, icon_url=member.avatar_url)
embed.set_thumbnail(url=member.avatar_url)
embed.set_image(url="https://i.imgur.com/1ajH1RF.gif")
embed.set_footer(text=f"ID: {member.id}")
await channel.send(embed=embed)
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'discord'
inb4 discord makes breaking changes
you could use pokeapi for pokemon
Wouldn't be surprised anyhow
i used it before

You can't execute bots inside eval.
eval?
lmao
blanket your brain is so big, jesus
it doesn't have card images, afaik
I love you, seriously

yeah it doesnโt
are you looking for the trading card game version?
i found an api earlier but i forgot the domain
yeah kinda
i'm making a gacha bot
ah
and it got stuck on the loading
maan you should see my search history
I'd rather not
there are alot of pages
i use incognito so yeah ๐ ๐คฃ
in chrome you can search inside your search history
lmao I can already see how bad it's going to get when I get an internship as a JSE

what ?
there are a lot of pages
do you guys know any api for yugioh - shadowverse - digimon - gundam ?
but with card iamges
no, there is a search bar
I've spent the last three days trying to fix random errors from my Main file
And when it finally seems like I fixed it
Another one immediately appears
nice
i think i found it
pokemon tcg
I don't plan on hosting it
oh
i found this https://pokemontcg.io
The ultimate Pokรฉmon Trading Card Game developer resource. The Pokรฉmon TCG API allows developers to easily consume Pokรฉmon card and set data in JSON format.
its literally the first result of "tcg pokemon api"
yeah i meant that
?
np
Thats what google is for, this channel isn't your personal search engine
And anyhow out of the scope for this channel
as i said i searched but didn't found what i wanted, and i'm trying to create a bot, but need api for it
bruh
make your own api then
How Do I make my snipe bot put the person being sniped's avatar as a embed.set_thumbnail
@commands.command(name="Snipe")
async def snipe(self, ctx: commands.Context):
if not self.last_msg:
await ctx.send("There is no message to Snipe!")
return
author = self.last_msg.author
content = self.last_msg.content
embed = discord.Embed(title=f" Message from {author}", description=content)
await ctx.send(embed=embed)
BRUH
you could find a database of images
doing {', '.join(cmdList)} for cmdList = cog.get_commands()
should get all cmds like cmd1, cmd2, ... right?
What's up with the curly-brackets?
doing in a fstring
Well yeah this should be fine but cmdlist does need to be a list of strings and now it's a list of command objects
cmdList = [cmd.name for cmd in cog.get_commands()]
@client.event
async def on_message(ctx):
if ctx.content.content('poop'):
ctx.channel.send('poop')
in on_message
if ctx.content.content('poop'):
AttributeError: 'str' object has no attribute 'content'
anyone know how to fix
hmm
ctx.message.content
i want it whenever it says "poop" it replies with "poop"
obv just an example word for now
dont have the ctx parm for
on_message
use the message parm
what does that mean
thats convention
what would i put for that
if "poop" in message.content:
await message.reply("poop")
thanks
^
And change ctx to message inside the function.
yeah that worked
How Do I make my snipe bot put the person being sniped's avatar as a embed.set_thumbnail
@commands.command(name="Snipe")
async def snipe(self, ctx: commands.Context):
if not self.last_msg:
await ctx.send("There is no message to Snipe!")
return
author = self.last_msg.author
content = self.last_msg.content
embed = discord.Embed(title=f" Message from {author}", description=content)
await ctx.send(embed=embed)
Is there a way to make the code update itself in real time?
It's kinda annoying to keep restarting the code to deploy changes
!d discord.ext.commands.Bot.reload_extension
reload_extension(name, *, package=None)```
Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.unload_extension "discord.ext.commands.Bot.unload_extension") followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.load_extension "discord.ext.commands.Bot.load_extension") except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
does this still work if the cog uses global variables that are in the main file?
yo
async def on_message(ctx):
if ("poop","POOP") in ctx.content:
await ctx.reply('hi')
it doesn't work with more than 1 variable
can i not do that?
TypeError: 'in <string>' requires string as left operand, not tuple
no
oh
if ctx.content in ['poop', 'POOP']
if "poop" in message.content or if "POOP" in message.conent:
can i not make an array
or you can just a list
[
or just do this
async def on_message(message):
if message.content.lower() in ('poop'):
await ctx.reply('hi')
kk thanks
Thats a list
i thought brackets worked
I want to update the main file, though
and why are you doing ctx.content in on_message event? @vocal cargo
you cannot
should i be using something else
Welp
no what he wants is probably
@bot.listen()
async def on_message(msg):
_list = [...] # can be a tuple or set I think
if any([i in msg.content for i in _list]):
await msg.reply("hi")
You need to make the but so that it doesn't ever need to update the main, if you want to do this i'd recommend doing something with git .
reload the main file?
TypeError: 'in <string>' requires string as left operand, not list
bro [] in Python != array
the [] didn't work
Then it's still a list
oh
I'm making little tweaks for the Main.py
replace your entire event with
@client.listen()
async def on_message(msg):
_list = ["poop"]
if any([i in msg.content for i in _list]):
await msg.reply("hi")
what is that underscore for
Thing is, it's pretty annoying to keep reloading it and sometimes the terminal just freezes, forcing me to restart the window
whats the point of the underscore
nothing
so that you dont overwrite the data type
you could use
Basically means that you should not use that variable when imported quite useless in a function.
!d importlib.reload
importlib.reload(module)```
Reload a previously imported *module*. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to try out the new version without leaving the Python interpreter. The return value is the module object (which can be different if re-importing causes a different object to be placed in [`sys.modules`](https://docs.python.org/3.10/library/sys.html#sys.modules "sys.modules")).
When [`reload()`](https://docs.python.org/3.10/library/importlib.html#importlib.reload "importlib.reload") is executed:
but it can cause you probelms
to not override list which is a built-in type object
Which type of problems
ok
thanks
but it also makes it private
for example, your bot.run needs to be inside an if __name__ == "__main__" block
Leading underscores are for not overwriting, if it starts with an underscore that means its a private var
If you intend to follow pep8 don't get those two mixed up
wait there's actually private property in Python?
No its just a convention
how about protected
There is not really a true private variable in python

underscore is just meant to let other programmers know not to mess with that function or variable.
you could make it __var
"I am still going to do it because I can't read!"
cmd._buckets._cooldown.per moment
!e ```py
class Obj:
__a = 5
print(Obj.__a)
@hasty iron :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | AttributeError: type object 'Obj' has no attribute '__a'
!e
class Obj:
@property
def __a(self):
return 5
print(Obj.__a)
@tame nymph :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | AttributeError: type object 'Obj' has no attribute '__a'

Is putting the reload_extension on a loop worth it?
Or is it going to strain my system?
Don't reload if you don't need to reload
Mangling isn't meant for private variables still
u can do
async def on_message(msg):
match msg.author.id:
case YOUR_ID_HERE:
#do something
case _:
return
That would be if your using python 3.10
everyone is
Almost no one has python 3.10 running in it's bot.
Matter fact, 3.10 is still in beta iirc
Yep
3.10 didnโt work with my sphinx sadge
sphinx
Me who time travelled after October: k
๐คจ
mkdocs
why did it do that
well whatever, sphinx is better than mkdocs
well maybe i have spent 900 lines just writing .. autoclass:: but who cares
My point exactly
but sphinx actually read my pyx files
yes
instead of doing bot.add_cog() for every class, is there a way that i can register every cog in my code in 1 line
you can put the name of every cog in a list, then iterate through that list and do bot.add_cog(item) for each item in the list
!d str.lower
str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3.10/library/stdtypes.html#id15) converted to lowercase.
The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
make it all lowercase first ^
if msg.lower().startswith('dadadada'):
await message.channel.send('DADADADADADADDADADADADADADADADADADDDADADADADADDADADA!')
or lower
idk
yeah this
package
rip
what is the symbol to send a python coder in here?
doesnt work...
It's !e I think
I like to keep stuff tidy and pretty
For the bot
I'm not trying to execute, I'm just showing him how to format the code
Oh alr
!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.
And I learned Python like that, I don't like to keep stuff thrown around or pretty
Makes me feel like I didn't pay enough attention to the code and it's going to fail and explode
@plain birch
is there something like on_error() for cog listeners (not just the base events)?
Like, an errorhandle?
yeah
so i don't have to repeat my desired default error handling code in each listener
Does anyone know how to embed an image created in memory?
blank = Image.new("RGB", (1280, 720), (30, 30, 30))
em = discord.Embed(title="TEST", color=COLOR_DEF)
em.set_image(blank)
await ctx.message.reply(embed=em)
so there's no built-in dpy way to do it?
good idea though, i'll look into it
class ErrorHandle(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.cog.listener()
async def On_Command_Error(yada yada yada, stuff)
And not that I know off
you gotta build your own handler
that only handles errors for commands unfortunately
i have some listeners as well
ooooh, for listeners?
yeah makes sense
lemme see what I can find for ya
!d discord.on_error
discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is printed to stderr and the exception is ignored. If you want to change this behaviour and handle the exception for whatever reason yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.
The information of the exception raised and the exception itself can be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.9)").
If you want exception to propagate out of the [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client") class you can define an `on_error` handler consisting of a single empty [raise statement](https://docs.python.org/3/reference/simple_stmts.html#raise "(in Python v3.9)"). Exceptions raised by `on_error` will not be handled in any way by [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client").
this only handles the various on_x events, not their equivalent listeners
permissions_string = ', '.join([str(p[0]).replace("_", " ").title() for p in member.guild_permissions if p[1]])
Anyone who can help me?
Actively search for those permissions and ignore the rest
Although I'm not entirely sure on how viable this would be
Wouldn't this require unnecessary checks?
@high flame
I'm a big newbie but wouldn't you use a try: block to handle errors?
yeah :/ thanks for your help though!
yeah for sure i'm just trying to find a more efficient way of doing it
ah
no bananas for now though so i'll poke around
I want a banana, I'm quite hungry after all this bug hunting
@client.event
async def on_message_delete(message):
time = datetime.now(tz=pytz.timezone('America/Tijuana'))
formatted = time.strftime("%I:%M %p")
logchannel = client.get_channel(872911089258598421)
await logchannel.send(f'[`{formatted}`] Message by {message.author} `({message.author.id})` in {message.channel.mention} has been removed. \n**Content**: {message.content}')``` How could I get time the message was deleted, then subtract the current time from it to give me how long ago the message was in the channel for before it was deleted?
!d discord.Message.created_at
created_at```
The messageโs creation time in UTC.
that ^ can tell you when the message was created, and then you can get the current time and subtract
i think you can subtract two datetime objects? not sure
If I created a class within my Main file, would it still be readed normally?
Kinda curious on this one
like a cog?
hm not sure
i guess if you defined setup() underneath your cog and did bot.add_cog(MyCog), that could work? but i'm not sure you could load it in because bot.load_extension expects a file
you could put the cog in a different file though
What I went
What if I went*
Bot.load_extension(loader)
and just created a Cog dedicated to loading another cogs
Although that kinda sounds like extra work, it would allow me to clear my main and also easily reload/rewrite in case something goes awfully wrong
Why not just write some code in the main to load cogs?
File "c:\Users\jacob\OneDrive\Desktop\Code\Camilla\main.py", line 569, in on_message_delete
msgtime = (formatted - message.created_at).total_seconds()
TypeError: unsupported operand type(s) for -: 'str' and 'datetime.datetime'``` Code: ```py
@client.event
async def on_message_delete(message):
time = datetime.now(tz=pytz.timezone('America/Tijuana'))
formatted = time.strftime("%I:%M %p")
msgtime = (formatted - message.created_at).total_seconds()
logchannel = client.get_channel(872911089258598421)
await logchannel.send(f'[`{formatted}`] Message by {message.author} `({message.author.id})` in {message.channel.mention} has been removed. \n**Content**: {message.content} \n \n \n{msgtime}')```
Not sure what I'm doing wrong here :P
i have a command in my DevCmds cog that lets me reload a cog after making changes, it's pretty useful
probably difficult to do it in your main file though
Want to share it?
To make a reload command in main?
I might just try to code it too
difficult/unorganized yeah
Hello does anyone know how to create a dashboard website for a bot?
Not difficult itโs pretty easy
I have a reload command took 4 lines lmao
same
With flask?
no i just meant that it'd be unorganized and they were suggesting putting a cog in their main file (i think?)
which would be complicated
?
You could use flask ig
But this is a discord bot related channel so letโs stay on topic
@commands.command(aliases=['reload', 'reloadcog'])
async def reloadext(self, ctx: commands.Context, cog_to_reload: str):
try:
self.bot.reload_extension(f'cogs.{cog_to_reload}')
await ctx.send(f'Reloaded {cog_to_reload}!')
print(f'\nReloaded extension {cog_to_reload}')
except Exception as e:
await ctx.send(f'Something went wrong: {e}')
(my cogs are stored within a cogs folder) (also yes i should probably move my error handler to an on_command_error this is just legacy code and not meant for widespread use)
Flask is a module which lets you create a website
In python
And you may also use html with it
boop
Spoon feed lmao
Just jk
there's only so much in this command that you can communicate without spoonfeeding lmao
also they seem to know what they're doing at least somewhat
True
Thanks, saved me a lot of trouble
no worries but try to read through it and understand it!
so you can do it for yourself next time
I might actually try to create a cog dedicated to dev commands too
Also you can just do ctx as itโs type hinted by default now
yeah i'd recommend that
That's also going to save me lots of trouble while testing
oh sweet didn't know that, ty
ah sweet
Ok cool
oh that doesn't make sense then actually bc my IDE didn't give me all the popup details until i typehinted it and i've never been on anything below 1.7
oh well gtg now
Vscode crashed, yay
Damn
No internally it has always passed an instance of Context. When you see people manually type hint itโs for clarity, and IDEs will start giving pop ups and suggestions because of it
Damn
Seems like Vscode really died
Now It won't open
my IDE really went under with casket and flowers
i need a website dec
While I was working on my own bot I typehinted my custom context as the builtin one and it did convert. So I'm pretty sure it does matter as it seems like it evals the context arg as well looking back at it I probably just messed up the internals or something
devvv
so i need a bot to do notifications when i upload a video and i want my bot to do it but don't even have a clue were to start with that type of thing as its not something i have done before if anyone wouldn't care to help me out on the key words etc for that it would be great
@client.event
async def on_message_delete(message):
time = datetime.now(tz=pytz.timezone('America/Tijuana'))
formatted = time.strftime("%I:%M %p")
msgtime = (formatted - message.created_at).total_seconds()
logchannel = client.get_channel(872911089258598421)
await logchannel.send(f'[`{formatted}`] Message by {message.author} `({message.author.id})` in {message.channel.mention} has been removed. \n**Content**: {message.content} \n \n \n{msgtime}')``` How could I make this work? Error: ```py
Ignoring exception in on_message_delete
Traceback (most recent call last):
File "C:\users\jacob\appdata\local\programs\python\python39\lib\site-packages\discord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\jacob\OneDrive\Desktop\Code\Camilla\main.py", line 569, in on_message_delete
msgtime = (formatted - message.created_at).total_seconds()
TypeError: unsupported operand type(s) for -: 'str' and 'datetime.datetime'```
Iโm pretty sure it was only after the rewrite, and damn donโt know that my ide already does that with ctx
As the errors says, youโre trying to subtract a datetime from a string
Yeah, how can I make that not a string?
You did string - datetime
Well you did strftime
Which literally stands for string formatted time
xd, yeah
Strftime literally makes a string in the format you want
someone pls help with a blacklisted words script this shits hard no cap
It's the opposite here. They're trying to parse a string, instead of formatting it.
Making a good filter is a pain in the ass. Usually not worth the effort.
@crude crater ..
well it is kinda worth it, i dont want people using the n word in my discord server when im paying $50 for a FiveM server
You can fiddle around with regexes, or for a more basic boilerplate you can just list down the word and some bypasses to check every message for.
It's not going to replace the need for chat mods sadly.
I think you are looking at this in the wrong way, It would be better to moderate people who say the N word rather then delete it everytime it is said
If it was a blacklist people would try to bypass, if it was being moderated by users then people would probably stay away from saying it
or i could just have my bot do it, thats why im askin yall pls help lol
No discord bot is going to be as adaptable and intelligent to moderation as a human will be.
If you've ever played Roblox, even the filter there gets bypassed. It's almost impossible to make it perfect.
Arguably impossible.
Besides what you've heard already there's not much else.
People would try to bypass it
Anti spam and blacklists barely work due to how many unicode characters exists
I could spam some zalgo characters and your blacklist would fail
But hey, if you want to learn something like machine learning for this I guess that might work
What are you trying to do
AI-powered word filter would be interesting to see on a bot.
Active-searching list for a word filter?
That would take quite a lot of work
I'd imagine tokenizing words with unicode characters would be challenging as well
Which is how I'd assume you parse the text
Dynabench
Unreasonable amount of work, I would just prefer to leave that for mods
Already an AI culture from FB I guess
Although, can't we try to code an AI to actively search for new slurs/bad words?
It doesn't sound too bad
But surely lots of work
Well it's a prospect that Facebook has only pulled off a 60% success rate with
So,
Good luck kek
Facebook a billion dollar company only has a 60% success
I'd guess that tells you how fruitless this is
lol
Well, fair enough
can some tell me what wrong here
@client.event
async def on_message_edit(message):
logchannel = client.get_channel(886651843051155497)
await logchannel.send(f'message by {message.author} ({message.author.id}) in {message.channel.mention} has been edited. \nContent: {message.content} new message. \nContent: {new.message.content} ')
here is the error it gave
Bot is ready.
Ignoring exception in on_message_edit
Traceback (most recent call last):
File "C:\Users\ggmin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
TypeError: on_message_edit() takes 1 positional argument but 2 were given
on_message_edit passes 2 Message objects being the old message and new message accordingly. In your event handler you only have one of them stated
i have both stated
\nContent: {message.content} new message. \nContent: {new.message.content} ')
the terms for it may not be correct
new is undefined. To state them both you need to have them as parameters in your event function
async def on_message_edit(message):
async def on_message_edit(old, new):
That way, you can use both the old and new messages
got you okay cool thanks
anytime
import discord
from discord.ext import commands
client = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
print('Bot is Ready.')
@client.command()
async def clear(ctx, ammount=10):
await ctx.channel.purge(limit=amount)
client.run('token here i know')```
help me
whats the problem?
Are you sure the bot has enough permissions
im having issues with import name process player from discord.voice_client can someone help me
You have not typehinted the amount parameter so it is a str rather then an int
And the limit kwarg of purge takes an int
Make sure to typehint int
Also you named the param ammount
yah i gave it administrator
Rather than amount
typeo lol
So limit=amount would throw an error as amount isn't defined
hello?
It looks like you forgot to provide the intents in the code.
# How you generally do intents
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='!', intents=intents)
Yes what is your issue?
i barely know what yall are talking about im new to coding, ive coded one bot but im working on this one
ah the #
what should the intent be
ayo hold up
async def join(ctx):
channel = ctx.author.voice.channel
await channel.connect()
@client.command()
async def leave(ctx):
await ctx.voice_client.disconnect()```
What I have in the code?
Not what he asked. In fact I don't know what he asked. He needs to elaborate
You could also make discord.Intents.all() but the part in the code works too.
Show the errors
Traceback (most recent call last):
File "c:\Users\myname"\Desktop\Discord bot\Steve.py", line 18, in <module>
client.run('the token')
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "C:\Users\myname"n\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x00000203D5AF5AF0>
Traceback (most recent call last):
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\myname"\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users"myname"\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Hey, when I am ready to publish a bot, do I have to turn it into a .exe file?
It's now telling you to enable intents there.
how do i do that
import discord
from discord.ext import commands
#discord.Intents.all()
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='!', intents=intents)
@client.event
async def on_ready():
print('Bot is Ready.')
@client.command()
async def clear(ctx, ammount=10):
await ctx.channel.purge(limit=ammount)
client.run('token')
Exactly. Just do what the error tells you to. Having said that, I don't believe you need intents to access channel.purge. All that's required is read_message_history and manage_messages
You generally don't package bots into executables. You generally host them and provide a link so that an user can add your bot into their server.
I think you could remove the intents.members line and see if that works.
hm when i type !clear it gets errors
So I find a hosting server, uploading the .py file there and the server runs the bot, and I just give people an invite link?
hmm yes
Neato
What are those errors?
weird it says missing permission even tough it has administrator
FIXED IT YAY
woo
yay
thank you for the help
Even tho I didn't do anything, I will happily take credit
You're welcome @slate swan
XD
np
Yes you need to run the bot on a remote server. Much as you run it on your computer. It requires dependencies/source code etc...
You will need more than just one .py file.
So why not turn it into an exe? if i turned it into an exe it'd have all the necessary stuff ;-;
I guess you could... you'd still have to run the exe
I don't know I've never run a bot as an executable
So I'd upload the .py alongside everything I 'imported'? ๐ค
yes
Relpy look at it
well, how are you turning in to a .exe?
I did, can you explain what you mean?
Show errors/code example/ questions in correct english?
There's a python thing that turns python stuff into exe files.
most py2exe "compilers" will basically package a python interpreter and your code together
so the main benfit is just for distributing the code
They'd still need to do the whole pip install <package>?
also, do you mean publish the bot's code? or let people add your bot to their server
Upload the bot to a VPS so the bot is always online
and maybe share the bots invite code
I would personally just give people the .py file and tell them to pip install the packages
And what about my own personal bots?
wow ๐
and what if i just want my own bot online all the time? i dont wanna have to run it on my pc
Haha
one sort of vps I recommend is https://repl.it
@slate swan i found a vps. that's not my issue. My issue is. do I just upload the 1 script to the server? or do I have to grab all the packages as well?
like discord.py? and anything else I want to add.
also, what vps if you don't mind me asking
Im going with https://galaxygate.net/
i found a guide https://wiki.galaxygate.net/hosting/discord/python/
let me check for packages
Oh they require me to have ubunto or linux
fwiw iโm running a small bot on a raspberry pi and itโs working well so thatโs an option too (@ anyone else thinking about how to host their bots)
oh it's actually pip install on the vps
not a requirements.txt so ignore all of that stuff
Still galaxygate requires me to have ubunto or linux
you need to grab all of the packages that aren't in the standard library
eg a package in the standard library is the random module
a list of all packages in std: https://docs.python.org/3/library/
Anyone Know How To Make A Bot Command Like If We Do - .delete [channel name] ( not channel mention) it deletes every channel in the server with that name
can you have 2 channels with the same name?
No
Not same name, but same naming convention, like "ticket-1" "ticket-2" etc
i guess use the in keyword
i'll start it off for you
@client.command
async def delete(ctx, *, naming_convention):
for channel in ctx.guild.text_channels:
if naming_convention in channel:
print(channel)
I'd probs even add in a 'confirmation' to make sure the channels being deleted are what you want to delete
good idea
@neat birch
import os
import discord
from discord.ext import commands, tasks
from itertools import cycle
import youtube_dl
import random
from keep_alive import keep_alive
@client.command()
async def play(ctx, url : str):
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
except PermissionError:
await ctx.send("Wait for the current playing music to end or use the 'stop' command")
return
Hi Guys
Why my play command is not working
if song_there:
os.remove("song.mp3")
why you removing it?
Yes thank you
!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)
what?
TL;DR - voice bots no no.
Can anyone reply
is there a way to keep my bot online if i turn off my computer
host
if you still wish to run it in your computer, no
@client.command()
async def play(ctx, url : str):
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
except PermissionError:
await ctx.send("Wait for the current playing music to end or use the 'stop' command")
return
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General')
await voiceChannel.connect()
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
for file in os.listdir("./"):
if file.endswith(".mp3"):
os.rename(file, "song.mp3")
voice.play(discord.FFmpegPCMAudio("song.mp3"))
Can anyone reply ?
anyone??????????????????????????????
You've been told already that YTDL is ToS breaking thus we will not help due to rule 5
so this will delete the channel containing the provided name right?
then what should i do?
Btw I am not trying to promote my bot -__-
Also you could try googling 'discordpy connect to voice channel' and follow the multitude of guides or copy code or whatever.
No. it will simply find the chnanels you specify.
you will do something like:
$delete tickets
and it will pint out every channel with 'tickets' in its name
oh
To completely disregard any safety and what not, in the loop you'd grab the channel id and delete it right then and there
so it won't delete the channel
no. but you'd have all the channels that match your given criteria
from there you can add in things like.. delete.
rename. or even simply send a message to that channel.
oh
alter the permissions. whatever you want! \o/
We know you aint tryna promote your bot 
@client.command
async def delete(ctx, *, naming_convention):
for channel in ctx.guild.text_channels:
if naming_convention in channel:
print(channel) #channel is the channel that matches your criteria. so maybe do delete channel or something idk. up to you. just make sure it's here.
yeah
But why is that?
(just curious)
Won't work
What do you mean
Copied someone elses code from earlier
I never tested it so im not worried lol
If I input hey there but the channel name is hey-there. Discord replaces spaces with hyphens, forgot?
then obviously you'd replace " " with "-"
Why YTDL is ToS breaking?
Yeaa
Coz discord said no.
It doesn't break discord ToS
It breaks youtubes
And it also breaks copyright laws
Yeah
Coz youtube says no.
As some might know a big music bot was recently sent a C&D

07 groovy
Rythm still kickin it LOL
!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)
OK thank you
Same. Psychological or just code?
hey
oh yeah. me too. hahaha just code. yep.
import discord
import os
from keep_alive import keep_alive
client = discord.Client(activity=discord.Activity(name="CEO's actions", type=discord.ActivityType.watching))
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('Congratulations to'):
await message.channel.send(f'`RPG Miniboss {message.content.split("Congratulations to ")[1]}`')
@client.command()
async def ping(ctx):
await ctx.reply(f"\U0001f3d3 Pong! **{round(client.latency * 1000)}ms**", mention_author=False)
keep_alive()
client.run(os.getenv('TOKEN'))
Just code
The error is at client.command
candidate_votes = [int(vote_db.count_documents({"vote": str(candidate)})) for candidate in candidates.values()]
total_votes = int(vote_db.count_documents({}))
total_yesno = int(recall_yes_votes + recall_no_votes)
x = np.array([candidate_votes])
election_candidates = [str(x) for x in candidates.values()]
candidate_colors = ["red", "blue", "yellow", "green", "purple"]
raise ValueError("x must be 1D") ValueError: x must be 1D
wait wrong one oops
what's the error
Ig U Need a ':'
Line 20 is client.command
After The ()
Hmm
no? lol
Lol
class admin(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def announce(self, ctx, *, message):
if (ctx.author.guild_permissions.administrator):
embed = discord.Embed(
title = '',
description = '',
colour = ctx.author.colour
)
embed.set_footer(text='By oSeatch#6969')
embed.set_author(name=ctx.message.author)
embed.add_field(name='News', value=message , inline=False)
await ctx.send(embed=embed)
await ctx.message.delete()
return
else:
await ctx.send("__**This Command Requires a Higher Rank.**__")
def setup(client):
client.add_cog(admin(client))``` Uhh what am i doing wrong?
Your getting the error because discord.Client does not have any commands extension. You want to use commands.Bot instead
lmao
The command executes without any error but it says the command itself doesnt exist
@heavy radish
yes
commands.Bot inherits discord.Client and adds the commands extension
If you are gonna use commands
Keep in mind you need to pass command_prefix to the constructor of commands.Bot
so
@commands.Bot ```
no
oh
Also ```py
from discord.ext import commands
anyone?
Not now jerry
No you have to remove discord.Client
oh lol completely missed that. He needs this
that's a long code 
Replace it with commands.Bot
ok
Nice
ok
After that it should work
<@&831776746206265384>
then this wont work ```
activity=discord.Activity(name="CEO's actions", type=discord.ActivityType.watching)
Well
Hello, what's the issue?
@heavy radish add command_prefix
Can u show me it in the code?
Hey @visual yarrow, there was a user @slate swan sending images and not contributing to the topic of the channel.
I'm so lost
Someone was posting funni roblox screenshots
I can create a help channel
Go to my dms
@slate swan Keep on-topic in these channels please.
You posted Mr.Peanut
I'll be recording your actions from now on @slate swan. Please stop this tom-foolery
Guys any async driver for mariadb?
We do have message logs. There's no point arguing over this.
Gnome went full british
You can keep this code, just add this import line:
from discord.ext import commands
class admin(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def announce(self, ctx, *, message):
if (ctx.author.guild_permissions.administrator):
embed = discord.Embed(
title = '',
description = '',
colour = ctx.author.colour
)
embed.set_footer(text='By oSeatch#6969')
embed.set_author(name=ctx.message.author)
embed.add_field(name='News', value=message , inline=False)
await ctx.send(embed=embed)
await ctx.message.delete()
return
else:
await ctx.send("__**This Command Requires a Higher Rank.**__")
def setup(client):
client.add_cog(admin(client))``` Anyone? ._.
What's the issue?
done
the command is not registering
the bot works fine, the other commands work too but when i do this one it just says that the command doesn't exist
Uhuh?
no crap
Are you loading the cog
def setup(client):
client.add_cog(admin(client))``` it should auto load
@bot.command()
@commands.is_owner()
async def load(ctx, extension):
bot.load_extension(f'cogs.{extension}')
@bot.command()
@commands.is_owner()
async def unload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
@lone aurora you can use any of this to load the cog. either via command or just auto
@slate swan You can claim a help channel if you want, this channel is for discord.py, which the code you posted isn't related to
im alr doing this
but the rest of my cogs enable on bot start, why doesnt this one
@slate swan Please don't try to ping everyone
So wherever your discordbot.py script is, add a new folder called "cogs" and it put your "cogs" in that folder
@slate swan Did you not see what I said?
:/
MY Bot doesn't work on music command
I can't even send code bcoz u guys said YTDL is breaking (Given in rule 5 )
๐ฆ
This channel is in relation to discord bots, your code is not, so please claim a help channel (see #โ๏ฝhow-to-get-help) if you want to discuss your code
@lone aurora like so:
oh wait.. my admin.py was outside my cogs folder.. someone end me
well there you go
we figured it out and all it took was me doing something else ;D
Breh
ah thanks alot man, i keep forgetting to start from the basics and go over to the code ;-;
Hey @slate swan, I dont normally block people, but you're getting up there fast. please stop this. we can be friends not me ignoring you
๐ฆ
alright
!pban 650902544176119809 That's about enough, we're not going to tolerate trolls
Bro Try to respect or else get ban
:incoming_envelope: :ok_hand: applied purge ban to @peak mango permanently.
Thanks (:
Ty @hot cobalt
NICE ๐
PROUD OF U, MY MAN!
Can I get a reason y?
Because it's viewed as spam
Spam doesn't have to mean multiple messages, it's just unwanted/undesired messages
@boreal ravine A vast majority of servers disable the ability to use @ everyone because of how many it tags at once.
o ok
im not dumb.
how do i make multi processing in discord.py?
I want to make a bot command that download some links into my laptop, i want to make it multi process so i dont wait until the first links downloaded
i tried using multiprocess lib but it didnt work
#sorry if my english was bad :(
as a result, in discords where channels are separated by topic, such as this one, if you could use @ everyone you'd bring people in who quite frankly, don't care about discord bots at all. Which would be annoying.
okay
TL;DR think of it as a loud annoying kid running into the supermarket and screaming shit. Annoying as fuck.
Why would you want multi processing
You can create commands/ tasks that will install whatever file you want
hey, so im trying to make a bot like dank memer, where if you type "pls meme" a meme pops up
@lobby1.command()
async def start(ctx):
queue1 = client.get_channel(883963916915453962)
queue1_members = queue1.members
queue1_members_mention = []
for member in queue1_members:
queue1_members_mention.append(member.mention)
random.shuffle(queue1_members_mention)
global lobby1_team_a
global lobby1_team_b
lobby1_team_a = queue1_members[len(queue1_members) // 2:]
lobby1_team_b = queue1_members[:len(queue1_members) // 2]
global lobby1_team_a_mention
global lobby1_team_b_mention
lobby1_team_a_mention = []
for member in lobby1_team_a:
lobby1_team_a_mention.append(member.mention)
lobby1_team_b_mention = []
for member in lobby1_team_b:
lobby1_team_b_mention.append(member.mention)
embed_lobby1 = discord.Embed(title="Teams")
embed_lobby1.add_field(name="Team A",
value="\n".join(lobby1_team_a_mention),
inline=True)
embed_lobby1.add_field(name="Team B",
value="\n".join(lobby1_team_b_mention),
inline=True)
await ctx.send(embed=embed_lobby1)
@lobby1.command()
async def result(ctx, *, result):
db = sqlite3.connect('my_database.db')
cursor = db.cursor()
result = str(result)
global lobby1_team_a
global lobby1_team_b
lobby1_team_a_id = []
for member in lobby1_team_a:
lobby1_team_a_id.append(member.id)
lobby1_team_b_id = []
for member in lobby1_team_b:
lobby1_team_b_id.append(member.id)
error: name 'lobby1_team_a' is not defined --> why is this? i declared global on it
First of all, your on_message event will block your commands
As you are not processing it
now, i've got the meme part working, i just dont know how to make it so that the memes refresh every day
Wdym by refresh?
i have created an array with the urls of the memes, but i want those memes to yknow, not the be same
what i mean is, i want those memes to be different every day
@cyan bay how are you getting these memes to begin with?
Use @client.listen() instead of client.event
It's better
!d discord.ext.commands.Bot.listen
listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").
Example...
i get the url of the post in reddit
Hmm
so i find a meme in reddit, i copy the url of the picture, not the post, then i put it in the array
You could use an API
Make a background task
Or asyncpraw for it
how do i do that
Depends on the api you want to use
oh
Yes
help
You can use the reddit API itself
A vast majority have the same setup. But then it changes based on how the api is setup. In discord, it's weird with guilds and channels. Reddit has weird references. google has its own shit to deal with. etc etc
ok
If you dont wanna learn how to actually use an API and just want to use a library, there's a good library called PRAW
Or if you wanna be weird and be like me, figure out how to use an api and make your own reddit api connections /shrug
Make sure it is asynchronous
im kinda new to asyncpraw, so whats the code to refresh the memes?
Listen doesnt work
Okay good then
@cyan bay You'll need to figure that part out yourself.
But if I was going to do it based on reddit posts and every say 12 hours, I'd get a background task which waits every 6/12/18/24 hours or whatever. Which it then at those intervals checks the reddit memes page you specify via your reddit api and updates a list. Upon which you simply update your list and import random and randomize the memes.
I have 2 bot.event which one do u want me to change??
Listeners are better than events,
They are external listeners that will listen to your event asynchronously and respond accordingly, and won't block other listeners and commands
first or second??
You need to change the on_message one
You can change the on_ready one too
ahh it doesnt work
Wdym doesn't work
oh ok, thnx
Not you @heavy radish
ahh
Lol
We're helping some other kiddo get his meme on
So @untold token ??
Which i totes approve.
Yes you can do this and you should look at caching
You can cache memes and check if repeated memes are sent or not
No need
OK
I mean. it's reddit. Ofc they are being sent over and over and over again
Does it error? @heavy radish
Yeah
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.
nope not what i wanted
how do I make the bot give me info on background tasks ;-;
!d background tasks
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.
yeah na fuck u bot.
Define give me info @drifting arrow
#Check OVR
@client.command(pass_context=True)
async def check_stats(ctx, *, member: discord.Member):
user_ign = get_user_ign(member.id)
user_ovr = get_user_ovr(member.id)
user_elo = get_user_elo(member.id)
print(str(user_ovr))
if user_ovr in range(93, 100):
colour = discord.Colour(0xe91e63)
elif user_ovr in range(87, 93):
colour = discord.Colour(0x1abc9c)
elif user_ovr in range(81, 87):
colour = discord.Colour(0xf1c40f)
elif user_ovr in range(75, 81):
colour = discord.Colour(0x95a5a6)
elif user_ovr in range(0, 75):
colour = discord.Colour(0xc27c0e)
embed = discord.Embed(title=f"{user_ign}'S STATS", colour=colour)
embed.set_image(url=member.avatar_url)
embed.set_footer(text="Hive 4v4s",
icon_url="https://cdn.discordapp.com/embed/avatars/0.png")
embed.add_field(name="OVR", value=f'{user_ovr}', inline=True)
embed.add_field(name="ELO", value=f'{user_elo}', inline=True)
await ctx.send(embed=embed)
error: local variable 'colour' referenced before assignment
help.. ping on reply
It means that all of your if/elif where you're defining Colour never met their criteria and you're trying to use it without having it pre-defined
Just define it before if elif check
^
thats odd, the user_ovr is 95
it even prints 95
could it be that user_ovr isn't an int?
!charinfo โ
\u2705 : WHITE HEAVY CHECK MARK - โ
await client.change_presence(activity=discord.Game(name='Do &cmds'))
AttributeError: module 'discord.client' has no attribute 'change_presence'
Anyone?
Just finished moving all my commands into their own lil' cogs. accidentally overindented everything ;-;
but is work now ๐
Hey @fallow anchor!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
await bot.change_presence(status=discord.Status.idle, activity=discord.Game('Doing gnome things'))
This is my change presence command.
File "C:\Users\HP\Desktop\dc bot\cogs\events.py", line 16, in on_ready
await bot.change_presence(status=discord.Status.idle, activity=discord.Game('&cmds'))
AttributeError: module 'discord.ext.commands.bot' has no attribute 'change_presence'
Is it in a cog?
My presence code was working but i put it in a cog and now it doesnt
yes
you have to use self
self.client
self.bot.change_presence
i c thanks
oh
i didnt know it was in a cog xD
How do I give all these commands a description whenever I type $help?
@client.command(help='')
best to create ur own cmd for it ._.
client = commands.Bot(command_prefix = '&', intents=intents, case_insensitive= True, help_command=None)``` im doing this and then i created an embed for the help cmd ._.
- Serving Flask app '' (lazy loading)
- Environment: production
Traceback (most recent call last):
File "main.py", line 28, in <module>
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead. - Debug mode: off
client.run(os.getenv('TOKEN'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 665, in start - Serving Flask app '' (lazy loading)
- Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead. - Debug mode: off
Traceback (most recent call last):
File "main.py", line 28, in <module>
client.run(os.getenv('TOKEN'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 665, in start
await self.login(*args, bot=bot) - Serving Flask app '' (lazy loading)
- Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead. - Debug mode: off
Traceback (most recent call last):
File "main.py", line 28, in <module>
client.run(os.getenv('TOKEN'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 665, in start
await self.login(*args, bot=bot)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
Traceback (most recent call last):
File "main.py", line 3, in <module>
from keep_alive import keep_alive
File "/home/runner/ASFR-BOT/keep_alive.py", line 18
ot make any noises or troll using your mic. Trolling would include anything from playing music with your microphone to screaming at the top of your lungs for now apparent reason. Voice changers like voice mod are prohibited within ASFR. Rule 16: โฅ You may not ping any role.โขThis rule regards to mass pinging individuals that have a specific ')
^
SyntaxError: 'await' outside async function
dude wtf show the code
thats a huge error message
the code is 4k+ words
k sec
!paste
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.pydis.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.
wut
Just like this
...
Neato ๐
You miss close bracket
wut
If you want change line use \n
wut
Yep
post the entire code for the command
Yea maybe want write rules i guess
but your error shows you used a coroutine outside of an async func
https://paste.pythondiscord.com/lekefiyiri.sql @boreal ravine
Use \n for new line
what
As you already got told
wait
or just type out the rules yk
a rules channel usually works yeah
alr, ty
Dude your PFP pic is sick! Whereโd you get it!
I donโt know, but my suggestion is to google it lol
Thanks lemme dm u the website i made it from
Google the error and I guarantee itโll tell you lol
Thank you!!! :D
yw
Please don't tell to Google
Can u paste the code here?
Yea
What's wrong with my code?
ok
No error, It joins the vc, sends the making audio message, it also saves the audio file but doesn't play it in vc and doesn't send the Played! text
My attitude is - Run the code. if shit breaks or deletes itself or I start a blackhole, consuming all of reality itself, then so be it.
@bot.event
async def on_message(message: discord.Message):
if message.guild is None and not message.author.bot:
print(message.content)
print(message.author)
embed = discord.Embed(title="Confirm Mail creation",description="This system is used for reporting bugs,reports concerning to the moderators.",color=0x3DFD1E)
a=await message.author.send(embed=embed)
await a.add_reaction('\u2705')
await a.add_reaction('\U0001f6ab')
def check(reaction, user):
return user == msg.author and str(reaction.emoji) in ["\u2705", "\U0001f6ab"]```
lol
you're trying to join an audio channel which youtube told discord no. naughty. and discord and youtube is stoping it.
What
Its not anything related to youtube
TL;DR - music bots not allowed. naughty. bad.
Audio bots*
text to speech command
Audio bots are allowed
Nto even using youtube at all
They are?
But earlier people were saying they werent ๐
this is not a music bot
If you have your own music saved in somewhere and doesn't include Youtube then you are ALLOWED to use it on discord bots
this is confusing. im going to take a shower.



