#discord-bots
1 messages Β· Page 1001 of 1
btw do I need a web interface or something to make it public? Or can I just use it as the old commands? (like !test) or something.
for slash commands?
you would just need to do /command_name
since its a slash command
so like the old commands too?
yes but without the prefix
wdym?
yes that is correct
Tried to import my old command and just change it π but isnt working
all commands would be slash commands so no custom prefix only /
like:
@slash.slash(name="clear")
async def clear(ctx, amount=100):
mention = ctx.author.mention
await ctx.channel.purge(limit=amount)
my_embed = discord.Embed(title=f'{amount} Messages Delete', description=f'\n\n **message have been successfully delete β
**' f'\n\n **π±οΈ By :** {mention}', colour = 0x87FF00)
my_embed.set_thumbnail(
url = ctx.author.avatar_url)
my_embed.set_footer(text=f"\n\n{ctx.author.name}" , icon_url=ctx.author.avatar_url)
await ctx.send(embed=my_embed)
await member.send(embed=my_embed)
But it isnt working
defined not working and slash commands dont quite have Context
so ctx isnt working?
- what library are you using?
cause it doesn't seem like any fork, are you using discord_slash?
no no it does its just being satisfied by context and im not quite sure if the class thats satisfying the argument has those methods and attrs
bro do I seem like a pro in it?
well i cant really answer that question
Im still trying to figure it out.
I just do whatever the tutorials say xd
neither am i a pro
Im a designer and try to get back into programming atm
ah well tutorials arent great they mostly just show syntax
wow thats quite nice!
I know now.
But how else im supposed to learn it ?
here this can help you with everything related to dpy and its forks https://vcokltfre.dev/
A tutorial to help you make better Discord bots.
its very straight forward and quite nice
I just want to know how commands like clear, ping, and everything else work
thats my problem.
With the old commands I know how to but not with slash
well they should work the same really
as u see, it doesnt
any errors ?
nope
well i cant really help because i havent used that library π
im actually gonna try to make a library thats better than that lib so ill probably see their implementation next week or so, im not sure how i will because the lib is quite done wellπ
Not even this is working : , )
@slash.slash(name="ping")
async def ping(ctx):
embed = discord.Embed(title=f"Pong **{round(bot.latency * 1000)}ms**")
await ctx.send(embeds=[embed])```
xd im crying
eh.. which lib you're using btw?
-.
wow.. you've like 4 discord libs installed lmao
pip uninstall <library name>
wha should I uninstall
where lib name is the lib name that u want to uninstal
π useless libs
uhm..
idk if this is the best way
but u can do it like..
Did but still whats the prob that text commands are working but things like clear, ping latency doesnt?
if 'https://' in message.content:
''' shit goes here '''
``` something like this
like.. ik this isn't the most effective way.. but yeh...
may i know from where u got the hint to make slash commands like that in discord.py?
:")
just opened my old bot, create a new one like always and then Idk
wow idk LMAO
lol
@silver agate just use this lib its all the same as discord.py and it has slash commands -> https://github.com/DisnakeDev/disnake/tree/master/examples/slash_commands
all you need to do is change discord to disnake
or u can use py-cord too....... if u want... :'''/
no
u hate it? lmao
pycords impl is garbage
lmao, py-cord surely getting some hate lol
welp, alright that's ok
because its garbage
okay, not gonna argue :")
eito is a good guy :")
impl of what?
LMAO, well whatever just tell your errors so we can help :")
SyncWarning: Failed to overwrite commands in <Guild id=12345> due to 403 Forbidden (error code: 50001): Missing Access
warnings.warn(
import disnake
from disnake.ext import commands
bot = commands.Bot(command_prefix=">", test_guilds=[12345])
@bot.slash_command()
async def ping(inter):
await inter.response.send_message("Pong!")
did the install too π
your bot was not invited with application commands scope for that command
ill not blame pycord for this but look at the file, the one who made pr cant even decide if he wants to mention the return types explicitly or not
https://github.com/Pycord-Development/pycord/blob/master/discord/ui/modal.py
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/modal.py at master Β· Pycord-Development/pycord
and its like 20 days old.
I did but isnt working either
may i see the invite link you invited the bot with, with bot's id removed
- inconsistent annotations
- horrible file organization
- horrible class organization
- everything is just smashed together and nothing is really clean
- confusing even to find something its dirs are just weird
hm weird
Still the Sync Warning
wait you need to mention your guild id there
I did what @slate swan send
not the one given in docs
I dont want to mention my guild in that
your server's id instead of 12345
I want to make it public one day or for my friends dcs and there friends...
for globalchat etc.
ah, remove the guild_ids frim there then
it will take around 1 hr for the command to get addrd ( this is a discord limitation, not related to discord.py/disnake)
your python version?
3.9
or 3.8 wait π but new enough for that
o.o
so pip uninstall disnake
and now ? install disnake again?
those aren't implementations
so
hi hi, ive been good and how have you not seen me ive been here since today and yesterday
π
implementations for most of the forks remains same for things other than slash commands
bot is running now but haha the slash doesnt work anymore
and what are they?
before the test worked.
nah pycord like changed its core and its horrible
should I wait or just re invite or what?
@silver agate
I mean it worked before with the test what I tried before, but I made the disnake with a new file
discord.command ποΈββοΈ
so just let it run
makes me wanna cry
aight
discord.bot
π³cause hun hun was here
so Ill gonna fvck u up again later guys π
noo π₯Ίππ
Hey folks, I recently made the switch from discord.py to 2.0 via git. Ive confirmed that installation is correct by testing out some button references, but now all of my previously working on_message events are not being triggered. It looks like it may be intent related, but Im finding conflicting documentation. Am I correct in my understanding that 2.0 requires intents (specifically messages) to be explicitly set defined in the code?
you should have message_intents yes and do you have listeners?
you need message_content intents to be turned on explicitly
!d discord.Intents.message_content
Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:
β’ The message was sent by the client
β’ The message was sent in direct messages
β’ The message mentions the client
This applies to the following events...
thanks folks I'll take a look! and @slate swan listeners = cogs in this context right? If so, I do not.
no no listeners by bot listeners and cog listeners
!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/master/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.10)").
Example...
i don't know man, i should be asking you that
got it, so that would only be necessary if I wanted to reference events from a different class/event within the on_message event, right? Sorry python is not my main programming language.
also I appreciate the help on this probably more than you know lol. Im always down to read documentation but sometimes its difficult to find the right documentation to reference.
no no listeners just makes so your on_message blocks all your commands etc i.e you can have many events of the same type
ohhh got it
thanks for explaining! I'll read the linked docs and see if I can get this working
i.e you can have 2 listeners in different places like one in cogs and the other one in your bot file where you bot class instance is defined
π€
you glorious son of a gun, we are up and running again!
thats lovelyπ€
bot = discord.Client(intents=intents) ``` did the trick
ts is my main language I work in so I kind of always (often wrongly) assume anything can be passed that way in python lol
ah lol
whats that disnake btw? its weird
incase anyone doesnt know: https://cog-creators.github.io/discord-embed-sandbox/
hey, is there any isinstance event error for a ValueError ?
so lets say I use
?help test
but the function is
async def(self, ctx, number: int):
and that throws a ValueError, is there a way I can send something like "Incorrect Usage"?
is there a way to make it so where if the function throws ANY errors, it does a ctx.send?
replace the ValueError with Exception
Converting to "int" failed for parameter "amount".
it threw this error
without sending any errror
do you know where I should put the try and except?
show code
async def spoof(self, ctx, amount: int = None):
show the whole function
then show the part where u used try and except
oh I just put it at the start and at the end
just have an error handler for that function then
@spoof.error
async def handler(self, ctx, error):
...
u can check the instance of error and do what u want with it
bro I have the module whats wrong
I did
...still
bro
I did kinda 1000 times
You are not receiving any errors because of improper error handler I think
It should have
else:
raise error # or do something else with the error just to see it```
where did u run it
I got the problem
hm
there it showes me the problem
hm
cant figure it out either?
You decorate the function with this
There can't be just a random decorator
I just want to get the ping command working
when I try it on another way its not working either
You need to write the command code for it to work lmao
Currently you only have a decorator and no actual function
I did
And yeah for god's sake use better lib for slash commands like dpy 2.0 or disnake
@decorator
async def func(...):
stuff()```
I don't see such construction
Before 5head
How wasn't it working
Nothing was working
You were probably doing something wrong and there just were no people who are experienced enough to help you
Try it again
The person who told me to install it didnt helped.
Cause you are most likely using discord_slash or some other random 3rd party lib
pip install disnake it's not that hard if your python is configured in a right way otherwise there might be issues that are resolvable however
And yeah in pycharm you do have an integrated terminal so there won't be issues at all
I know
So did you install it
Authorise the bot with applications.commands scope
And yeah wtf is 12345 id
I dont fucking know?1
Search for its occurences probably you have wrong test guilds or something
https://pypi.org/project/disnake/
thats all I did
Tf
π
Could you send the whole code
xD
import disnake
from disnake.ext import commands
bot = commands.Bot(command_prefix=">")
@bot.slash_command()
async def ping(inter):
await inter.response.send_message("Pong!")```
Print disnake._version_

i have my bot hosted on AWS but after a white i get Connection reset by etc etc
how do i keep it active?
refresh your ide
install it from cmd not console in ide
pip install discord
in cmd
yea thats not cmd
can someone help me about thus
too*
whats wrong with it
Hey @frigid flame!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
where am gonna put the comma here
what comma? your code looks weird
i just copied it on lucas tutorial
and im just begginer about this thingy
Any errors? And you just leaked your bots token..
you need to put a prefix i think
No.
ohhhh
oof
will reset it
you tried to index a list with a string, python doesn't allow that
[SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
and how can i fix that?
will try it once...
thx
don't index it with a string?
THANK U!!!!!
got it
owo
Is it possible to have a slash command only visible to certain users? I have a set of user ids as a bot attribute and was wondering if you can only see the command if you are in said set... Any help is appreciated :) (Also, just incase I need to mention this, I am using disnake)
Not that I know of, might be coming with the new permission system of slash commands.
.snip fortnite, fortnite being the name in the json file. how could I do this?
name as in key?
which side is the key again?
the left side
then yes.
load the JSON file, index the dictionary you get
how do I take in the name though?
add another parameter to the command
has anyone seen any clever ways of keeping some text visible just above the message input field in a discord channel? Input formatting guidelines for example. Not a programming question, just more of a "have you seen anything" kind of question.
near here is where I mean
hm?
not suited for this channel, ask somewhere else
is there a better channel? Its bot UX design that I will be coding in python
Perhaps use modals?
being what?
so the paramter will just be whatever i put after .snip ?
like it'll auto set the variable to that
yes, but they're called arguments
just index the dictionary.. searching will only make the command slower
that could work, good call.
how do I index it?
dict = {1: 2, '3': 4}
dict[1] # 2
dict['3'] # 4
even if im uisng a json file?
you have to load it first ```py
from json import load
data = load(open('file.json', 'r'))
Iβm trying to make reaction roles but I donβt understand what this error means
snippets = get_config("snippets")
d = json.load(file)
this will make it a dict which u can use
data is a dictionary, only lists have an append method
u can't append to a dict
Ok
Oh
So what could I do?
by the looks of things, maybe replace {} with [] , then u can use it as a list and append to it
Just a heads up, replit = bad for discord bots
what does this mean?
<discord.ext.commands.context.Context object at 0x0000017EBA39DF30>
it's where the command object is stored
@client.command()
async def snip(ctx, snip):
snippets = get_config("snippets")
if snip in snippets:
await ctx.send(snip)
else:
await ctx.send(f"No snippets found for ``{snip}``")
Ok, so instead of it returning the snip how would I make it return the value of it?
snippets[snip]
where I send the message?
in the if statement
yes
how.?
call the lower method in snip using dot notation and make all the keys inside of snippets lowercase
@client.command()
async def poll(ctx,*,message):
author = message.author
emb=discord.Embed(title=" POLL ", description= (author + ' asks if '+ f"{message}"))
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('π')
await msg.add_reaction('π')
author name is not visible
sorry, I do not know how to do that.
from folder import file```
or u can also do this
from folder.file import some-object
if snip.lower() in snippets:
any suggestions
correct?
thanks
!d try except
for snippet in snippets:
if snippet.lower() == snip.lower():
...
even better, use list comprehension
try:
#normal code
except KeyError:
#outputs error
```is this how try except block works?
yes
thanks
hm I see.
#try here
@bot.command(name='hunt')
@commands.cooldown(1, 60, commands.BucketType.user)
async def hunt(ctx):
#or here
stats = Stats(ctx)
num1 = random.randint(0, 100)
num2 = random.randint(0, 100)
down right?
@boreal ravine if the key contains a number will it still work?
@client.command()
async def poll(ctx,*,message):
author = message.author
emb=discord.Embed(title=" POLL ", description= f"{author,' asks if ', message}")
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('π')
await msg.add_reaction('π')
not working
cant see the wuthor
@client.command()
async def poll(ctx,*,message):
author = message.author
emb=discord.Embed(title=" POLL ", description= f"{author,' asks if ', message}")
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('π')
await msg.add_reaction('π')
```do it like this
what do u want to catch?
do ctx.author
if error occurs on that msg it outputs it
ya but what error?
keyerror
where?
inside then
inside your command
@bot.command(name='hunt')
@commands.cooldown(1, 60, commands.BucketType.user)
async def hunt(ctx):
try:
stats = Stats(ctx)
num1 = random.randint(0, 100)
num2 = random.randint(0, 100)
except keyError:
ctx.send('error')
```like this?
f"{ctx.author,' asks if ', message}''??
just to make sure i dont wanna mess up this one
hey is there an easy way of getting a list of users who reacted with a specific reaction
big brain
f"{ctx.author}, asks if , {message}''
stats = Stats(ctx)
num1 = random.randint(0, 100)
num2 = random.randint(0, 100)
how would these lines cause keyerr?
oo
u wan the full code?
yea
probably because of Stats getting data from a dictionary
i mean @paper sluice
oh
please don't
Hey @loud junco!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
just make sure that there is a chance of KeyError happening in the try block, other wise its useless
100% they will be this error
why are there a million if statements
im trying to use switch case
but not now
after i fix this stupid error handler then i will change to switch case
@client.command()
async def poll(ctx,*,message):
author = ctx.author
emb=discord.Embed(title=" POLL ", description= f"{author} asks if {message}")
msg = await ctx.channel.send(embed=emb)
await msg.add_reaction('π')
await msg.add_reaction('π')
three messages
msg = await ctx.channel.send(embed=emb)
and ctx.send will do
no need ctx.channel.send
multiple instances of your bot are running
solution?
just restart it a few times i guess
reset your bots token, use the new one you generated
noice
bot is not responding when i use prefix ? but it is working when got mentioned
bot = commands.Bot(command_prefix=when_mentioned_or("?"), case_insensitive=True, intents=intents)
what are intents and do u have msg intents enabled?
@client.event
async def on_ready():
await client.change_presence(game=discord.Game(name='test'))
print ('You have logged in as {0.user}'.format(client))
Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/Users/nagarajukanike/Documents/Python Codes/rps.py", line 17, in on_ready
await client.change_presence(game=discord.Game(name='test'))
TypeError: Client.change_presence() got an unexpected keyword argument 'game'
@boreal ravine it's spamming no snippets found for
because it's not taking the whole title
just first word
!d discord.Client.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the clientβs presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter...
it's the activity kwarg ^
hey, how can I add a argument that doesn't only take the first word?
I just added an all argument, *
use the break keyword
fixed the problem haha
@client.command()
async def snip(ctx, *, snip):
snippets = get_config("snippets")
snip = snip.lower()
if snip == snip.lower():
await ctx.send(snippets[snip])
else:
await ctx.send(f"No snippets found for ``{snip}``")
seems to be working.
in the future, is there any way to add multiple values to one key? @boreal ravine
you didn't fix it
it works as it should when I do the command
json file yes
if it gets the job done?
exactly!
thats what I want to happen
and replace it with what
if user does capitals it will not show up in the json
@slate swan how do you make a snippet?
what do you mean
snippet, just a short portion of a song
hm I see. I like keeping it more spread out if that makes sense
And you can throw off or how to create where you can send me a link or application + I'm on the phone @slate swan
Would raise an error if there was a KeyError
also dont name ur function and parameter the same, it creates alot of confusion
yes u are right my bad
send only takes one positional argument
when I do a invalid name the except doesn't send.
Command raised an exception: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given
ya change it to f"No snippets found for {snip}"
Wtf?
await ctx.send(f"No snippets found for {snip)")
^
SyntaxError: f-string: unmatched ')'
Ohh thanks βΊοΈπ
it's clearly there?
!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.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
mismatched brackets
u used ) instead of }
omg Im way to tired for this
Why does my button say "interaction failed" when it worked before with the same script and the bot has not restarted
timed out?
you can get only persistent views ( views with custom ids and None timeout) to work after a restart
does anyone know how to disable a select menu after its been timed out (pycord)
class HelpView(discord.ui.View):
def __init__(self, mapping: dict, ctx: commands.Context):
super().__init__(timeout=180)
self.add_item(HelpDropdown(mapping, ctx))
``` this is how i timeout
Ahh thanks
!d discord.ext.ui.View.on_timeout
!d discord.ui.View.on_timeout
await on_timeout()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when a viewβs timeout elapses without being explicitly stopped.
you would have to attach a message attribute to the view for editing the select menu
the timeout is working
how do i disable the menu after its been timed out
oh wait
this is for buttons?
how do i try except for this error
People will answer when someone can, simply be patient :D
lol
can u help me with this?
try:
#your stuff
except MissingReaquiredArgument as e:
print(e)
sorry
Required*
i have one
To access the exception attributes etc.
i have this keep alive thing that i didnt write or anything, it works well for replit, but i need to use it for AWS, and i have no idea where the link i need to put into uptime robot would be for AWS. on replit it just comes up in the top right when you run it, but since AWS is just a console window idk how to get the link. this is what i mean by link: https://name.name.repl.co but what would it look like on AWS?
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
also wouldn't mind if there was a more simple way of getting it to not sleep after 20 minutes but yea
commands.MissingPermissions
Would be your exception
Considering you've imported from discord.ext import commands
!d discord.ext.commands.MissingRequiredArgument
exception discord.ext.commands.MissingRequiredArgument(param)```
Exception raised when parsing a command and a parameter
that is required is not encountered.
This inherits from [`UserInputError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.UserInputError "discord.ext.commands.UserInputError")
Can I send content as txt file without saving the file ?
can i add view to a message later, like i send a normal message first then add a view to it
Is there anyway for me to track who invited somebody?
error: AttrError: list obj has no attr 'disabled'
code:
class HelpView(discord.ui.View):
def __init__(self, mapping: dict, ctx: commands.Context):
super().__init__(timeout=30)
self.add_item(HelpDropdown(mapping, ctx))
async def on_timeout(self):
self.children.disabled[0] = True
await self.message.edit(view=self)
await client.send_message(author, embed=embed)
AttributeError: 'Bot' object has no attribute 'send_message'
its .send() not .send_message()
also u just need embed=embed, no need author
i need to dm the message
then it'll be user.send()
Then you have to define who is author
!d discord.User
class discord.User```
Represents a Discord user.
x == y Checks if two users are equal.
x != y Checks if two users are not equal.
hash(x) Return the userβs hash.
str(x) Returns the userβs name with discriminator.
author = ctx.message.author
ctx.author is also enough..
What the problem coming?
Is there anyway for me to track who invited somebody?
You are using ctx ryt?
yea
how do i encript?
They why are you sending message using send_message use ctx
await ctx.send(author, embed=embed)```
What happened@frigid flame

its self.children[0].disabled
you placed the index brackets wrong
async def verify1(ctx):
channel = client.get_channel(967788019526561822)
e = discord.Embed()
e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281")
await ctx.send_file(channel, "verificationd.png", content="...", filename="...")
file = discord.File("verificationd.png", filename="...")
await channel.send("content", file=file)``` is this right?
Is there anyway for me to get a user ID from username and discriminator?
!d discord.utils.get
discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Changed in version 2.0: The `iterable` parameter is now positional-only.
Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
use this, with bot.users as iterable and name and discriminator as attrs
btw still its not working
async def verify1(ctx):
channel = client.get_channel(967788019526561822)
e = discord.Embed()
e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281")
await ctx.send_file(channel, "verificationd.png", content="...", filename="...")
file = discord.("verificationd.png", filename="...")
await channel.send("content", file=file)``` is this right?
that should work after 30 seconds
Are you trying to send the file outside the embed
No inside the embed
Then for what are you using await ctx.send_file @jade tartan
client.send_file?
No i am not saying that, i am saying you want file inside the embed using embed.set_image@jade tartan
Maybe this may not work
Yeah it didnt work
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 227, in verify1
await client.send_file(channel, "verificationd.png", content="...", filename="...")
AttributeError: 'Bot' object has no attribute 'send_file'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'send_file'
@client.command()
async def verify1(ctx):
channel = client.get_channel(967788019526561822)
e = discord.Embed()
e.set_image(url="your-link")
await channel.send(embed=e)```
Try this
He just said he wasn't saying that
Use dark theme
How?
i mean whats the hex code for dark theme if that make sense
this is the color code for it 2F3136
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 226, in verify1
e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281", color=0x36393F)
TypeError: Embed.set_image() got an unexpected keyword argument 'color'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Embed.set_image() got an unexpected keyword argument 'color'```
async def verify1(ctx):
channel = client.get_channel(967788019526561822)
e = discord.Embed()
e.set_image(url="https://media.discordapp.net/attachments/762780334458011679/945068984380850286/verificationd.png?width=1440&height=281", color=0x36393F)
await channel.send(embed=e)
I find how make this
Not really this one, it's actually 0x2f3136
Inspecting the embed element will give you that color as background, more specifically the background-secondary variable. Which is --background-secondary: #2f3136;
I got it from docs sorry i was not knowing
even after running pip install -U nextcord im getting an error. please help me
still
What is the error?
bro
Does the error occur aswell when you try to run the code?
show code
ive just imported till now
show code
Wouldn't make a difference, does it?
Just try to run it
alr wait
use nextcord somewhere
"nextcord" is not accessed
does that mean its in someother directory?
yes
ok
are u following any tutorial
no
wdym?
i am gonna use it
import random
print("Hi!")
random is not accessed here... (aka useless import)
use it then the error will not come
oh alright got you
thanks guys
^
ye
alright
whatever
ty
Code will run without it, it's just saying that it'd be better if you did what it's telling you
yes
oh
yeah
nice
yes
does that mean that anything with a yellow line under it isnt exactly an error?
yellow line means it is not defined
Red = error (code will not run because major problem), yellow = warning (code will run fine, just it's dead-weight/could be better)
alr ty
@bot.command()
async def check(ctx, *, msg=None):
if not msg:
await ctx.send('Kindly enter msg!')
return
else:
try:
fetchedchannel = []
all_data = list(channels.find())
for i in all_data:
fetchedchannel.append(i['ids'])
embed=discord.Embed(color=discord.Color.red())
embed.set_author(name=f"{msg}")
coroutines = [channel.send(embed=embed) for channel in fetchedchannel]
await asyncio.gather(*coroutines)
except Exception as e:
print(e)```
```'Int64' object has no attribute 'send'```
How to fix it?
Show whats int64
channel id stored are int64
coroutines = [channel.send(embed=embed) for channel in fetchedchannel]
Isn't there meant to be some get_channel stuff going on? (I haven't worked with this in a long time, sorry can't be specific)
You're getting the id, not the channel object
yup there is but It will reduce my process of sending message!
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
Well, you can't send to an int object
yup what if i stored that
get_channel
& then send message!
Sure
@brisk dune i completed some of the code and am trying to run it, but its saying "ModuleNotFoundError: No module named 'nextcord'"
you didn't install nextcord
i ran pip install -U nextcord and imported it
really?
yes
what ide are you using?
im using vs code
try to do py -m pip uninstall nextcord then py -m pip install nextcord
then restart your ide
alr wait
ah okay
restarting it now
yeh it worked ty @quaint epoch
np
show config(w/ a place holder for the token)
wdym
config is a file no?
yes
so show the contents of the file, and replace the token with "TOKEN"
wdym show the contents
would this work
Is there way to send message fast to every channel of server because for in loop takes a long time to send messages!
Most likely not possible faster due the discord ratelimiting
yup
Sounds very sus.
How?
1 min
if you had 5 channels yes
the ratelimit is 5/5s its dynamic so it can change as well
<user object>.id
Using multitreading?
oh wait nvm lmao
its a discord api limitation?
user = discord.utils.get(guild.members, name="test", discriminator="0011")
print(user)
^
ohk!
is the value of user the ID? Or do I have to do user.id?
it returns a user object
The userβs unique ID.
Ok
@slate swan
async def sendallchannel(self, embed):
coroutines = [channel.send(embed=embed) for channel in fetchedchannel]
await asyncio.gather(*coroutines)
what the use of this then?
seems like a list of coros which are quite useless
So will need to use For in loop only?
im saying its useless by you would probably get ratelimited
for channel in fetchedchannel:
channel = bot.get_channel(channel)
await channel.send("Text")

and here if the channel is cache it would scream a nonetype error lol
it would scream that NoneType class doesnt have such an attr lol
Wouldn't that just work
for channel in ctx.guild.channels:
await channel.send("hi")
hey i am making bot using code of sir lancebot. so where should i add my bots token?
yes it would but youll get ratelimited lol
ye ofc, but there's no way to prevent that
that is correct.
that's what they wanna do tho ig
i wouldnt really use that bot
hmm any others?
its quite advance and just copying the repo and pasting your token isnt the best idea
make your own
i know
much more fun
lmao
Hello, good day.
How do I get the plain username without discriminator from an ID?
!d discord.ext.commands.Bot.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID.
You do not have to share any guilds with the user to get this information,
however many operations do require that you do...
i know we can add watch together in python. but how we add other like fishing.io games?
Last time I heard from this it was against the ToS
what?
As I said, last time I heard from these integrations there was an announcement in the official Games Lab server about being against ToS and bots being flagged by Discord. So I would beware when doing it and get informed to make sure it's no longer against ToS.
Just get the ID of the other game if you really want to do it.
they are not against TOS.. they won't verify public bots which have these
if it's a private bot it's fine
That gets the username with tag
Not if you take a look at the attributes the User object has.
!d discord.User.name # Specifically this one
The userβs username.
AttributeError: 'coroutine' object has no attribute 'name'
embed = discord.Embed(
title=name + " Server Information",
description=description,
color=0x00FFFF
)
how to add hex in this code?
anyone?
user = await ...
print(user.name)
Basic coroutine and Python.
And as I said; I would first try to get from cache instead of directly making an API call with fetch_.
color=0xHEX replace HEX with your hex value
@slate swan check now
correct?
color=00FFFF // color=0xHEX
Doesn't look like the same
means?
Hi
00FFFF = cyan hex
You skipped this
| Command raised an exception: AttributeError: 'Embed' object has no attribute 'add_footer'
Without code - can't help
it's set_footer
!d discord.Embed.set_footer # Might help though
!d discord.Embed.set_footer
set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
What
what?
nothing lmao
AttributeError: 'User' object has no attribute 'username'```
bot there is error
You have another issue
name, not username
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the memberβs hash.
str(x) Returns the memberβs name with the discriminator.
The userβs username.
Would be that one for 1.x
I did that already
AttributeError: 'coroutine' object has no attribute 'name'
What was the answer?
Again
^
x = await bot.fetch_user(id)
print(x.name)
?
hi sparky
yo
hello π
hi okimii
(await bot.fetch_user(id)).name
π³
doing homework + sql + discord
hi hi
one liner 
o
π©
Worx
embed.add_field(name="Roles:", value=(ctx.message.guild.roles), inline=True)
is that correct?
okimii entering in esoteric python ig
Thanks
No hate, but instead of asking if it's correct, try it out
cuz 1 liner = #esoteric-python mostly
Len the roles
what u want
role count ig
@@slate swan
@slate swan
ok?
u need list compe
Also, I suggest using .title() for the Region looks much better
ok
!roles
huh?
nt
@slate swan i ghost ping u by mistake
lol
what u want count or name
@slate swan how to solve this roles menu and my code is correct or not?
what
Be more specific
how to slow roles wtf?
no
Do you want the roles Show one by one, or every role counted up together?
huh?
confusion
its fine
π³
solve*
!e
list = [41242531525,12565,2425425,254,36,346,346]
a = [users for users in list]
print(a)
yaya les go
this is a list of role objects... idk what you want from that
why iterate through a list to make a list?
Why
That's useless
Iterate over the list of roles and get the attribute you need, simple for loop.
lol
oh
a = [role.mention for role in ctx.guild.roles]
idk
map(lambda r: r.mention, guild.roles) 
len(ctx.guild.roles)
Simply get the length of the list of roles if you mean getting the number of roles in the guild.
!e
a = [1,2,24,4,35,35,235,236,236,2356,236,25,235,2367,346]
print(len(a))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
15
you have to makw it a list or else its a map object π³
[*]
EXENIFIX.lower() is typing....
!d str.capitalize
!e ```py
from random import randint
from time import time
class E:
def init(self, num):
self.num = num
arr = [E(randint(0, 500)) for _ in range(100)]
t = time()
a = [i.num for i in arr]
print(time() - t)
del a
t = time()
a = map(lambda i: i.num, arr)
print(time() - t)```
str.capitalize()```
Return a copy of the string with its first character capitalized and the rest lowercased.
Changed in version 3.8: The first character is now put into titlecase rather than uppercase. This means that characters like digraphs will only have their first letter capitalized, instead of the full character.
*[*]π³
embed.add_field(name="Roles", value=len(ctx.guild.roles)
correct?@slate swan
L
try
you're missing a parenthesis
@vale wing :white_check_mark: Your eval job has completed with return code 0.
001 | 1.1444091796875e-05
002 | 2.6226043701171875e-06
Map is faster confirmed
?
ok
not working
embed.add_field(name="Roles", value=len(ctx.guild.roles)
^ Missing )
)
You opened twice ( but closed only once )
embed.add_field(name="Roles", value=len(ctx.guild.roles))
like this?
Try it and see
ok
You might need to cast it to str
done working
um yea, its implemented in c and utilizes lazy loading
Amazon
same π
Does digitalocean become angry if I create a new account with same card
Just create one with a new card π€·
wow... pls try & lemme know :>
Yes but it's trash
Oh ic
I can't cause they block russian cards π₯²
I dont even have a card
πππ
π oh gawd wtf..
same LMFAOO
Amazon requires a card as well
good luck
My parents wont give me their card cuz i've done something b4
imagine finding a free hosting service & getting a "good" one
Tnx
y'all gotta learn that nothing's free in life
"Imagine"
Purchased 5k robux or smth
yeah imagine
Ikr
yes, air is also not free :'/
Well i used to play a game (not roblox) and i spent 300$π
But python IDLE is

no
But
ong i wish doe
Railway supports discord bots
Amazon is the minimum
selfhost
imagine buying replit premium service
electricity bills
Matter of fact my net is kinda sucks so thats a bad idea π
still not free lmao, u want to me use my resources 24/7? instead i'll spend $10 a month for a good host lmfao
Btw I am gonna build own server soon (if I figure out how to install ubuntu on it)
free is without cc in my eyes
if that ppl can self host why will he say i need a hosting
what a beautiful eyes :")
@olive osprey Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!
Just use railway π§ββοΈ
a eyes
if u have cc ur free hosting gates are open
hide it in the basement of your neighbours
Bruh
station
lmao
π
imagine elec cut off
that's why i would rather prefer to spend $10 or some on a host
Imagine
btw idk why heroku doesnt work with me nomo π when i tried to connect it with my github it says "internal server error" something like that
I'd only spend money on hosting if the service you're hosting is lucrative
same
Because heroku broke
cant even imagine. it ACTUALLY happens like AT LEAST once a month here
Is there a problem? Im about to spam their support gmailπ‘
well that issue just came up recently
ye lol ig
True
some shit fucked up with github auth token... idk exactly
I mean heroku is fine doe π€·πΎatleast its freeππ i have like 30+ accs
bad word = 69%
When my dynos ran out i use the other acc etc
replying to that deleted msg
nah it didn't fuck me... my bot still working fine lmao
YEAHHH ME TOO LMFAOO
dynos??/
i lost too many braincells
they're just sharing how bad hosts suck etc
ππmy bot is offline for like 4h
Same
we just got no money :") to spend
AttributeError
async with braincells():
await createnew()
π
Yes heroku has something called dynos π
ohh
ofc you do, you currently have access to the internet, seems like you're not that broke after all
yeah dyno hours
πππi need some tbh
π bruh, internet is cheap asf
!pypi amogus
So are some vps
still more expensive than a hosting service
current = 0
while True:
if chat == #discord-bots :
current-=1
else:
current+=1
simple
(no comments)
Not defined
eh what?
kek
host bots on sockets
I think its free
luckly everyone here has
LMAOO




