#discord-bots
1 messages · Page 395 of 1
You have to do it yourself, nobody will give you the work already done. Read the documentation of the library you are using and if you have problems or questions you can send it here.
ik but i have error with unban
Please send the error and the relevant code so that someone can help you.
guys, how you handle errors with nextcord api?
okay wait
are you guys using try except or on_error or what? Please with example
I don't use the nextcord library but I usually have a try-except in each command, it helps me to have a more specific error handling in each command
ok, you using it with logging?
Yep
ok, sounds good
any free bot hosting service
When I try to unban someone, I see a red message above the command saying "Enter an integer," even though I provided the user ID, which is an integer.
It is worth noting that the discord client has native banning and unbanning functionality. By implementing it in your bot, you are stripping your server of accurate audit logs and proper 2FA controls (possibly among other things). Up to you if those things are worth sacrificing for what is probably minimal or no gain
gownohost.xyz
?
what
im broke $
me too
then theres no point in making discord bots tbh
!hosting
Using free hosting options like repl.it or Heroku for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.
See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.
You may also use #965291480992321536 to discuss different discord bot hosting options.
its a polish best free hosting but its have close rules
vex, you can get a vps for really cheap
fr
for how much?
like 0.99 euro
got that $
send you that hosting?
yeah
you must pay one time installation fee probably
@wispy falcon
please use the links nightmare has sent to you
datalix eu
!trace
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
~~~~^~~
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
@scarlet tiger do you have any discord robots online?
I have one
where do you host it?
GalaxyGate
you get along with the price ? is it ok for you?
affordable?
For me it's fine but there are surely services with better prices.
I want make a discord bot and want to learn how to code
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
after that, then i can continue hosting my bot without paying?
There is a base level cost (internet, electricity, datacenter maintenance) when running a vps. If someone is charging you less than that or nothing, you should be suspicious and concerned with where that money is coming from
People aren't running charities
the amount of people that don't even get information about coding a bot, aka that it requires a vps which isn't free, is astonishing
(Hint: they're selling your data or trying to farm your token)
then they want to have it 24/7 and they wonder why they gotta pay
ive never used a hosting service
@wispy falcon when it says lets say 3 euros monthly you must also pay a one time installation fee of lets say 30 euros
it's like a second pc, so it obviously won't be free
alr
installation fees are a joke imo but yeah
ok
or just get a vps without an installation fee
whoever charges you installation fees, don't get it 👍
If you don't want to pay for a VPS you can use your computer
yeah but your computer must be 24/7 on then
i was js saying because @slate swan expects people to know everything
But the electricity bill will go up in price and it can be more expensive than a VPS lol
not everything, but at least the bare minim of research would be something ideal
ok
jeez people get upset pretty fast in 2024
your edited message clearly showed you are
"mr smarty pants" isnt that a good thing
upset
guys, nothing is free in this world, there is always a catch to it. Servers are just pcs that run 24/7 to serve you etc. If you want to host it on your on just use a raspberry pi
honestly electricity fees probably aren't that high for a rpi running 24/7
maybe i seem upset to you but im not
someone some day made the calculations and wasn't higher than the cost of a vps
depends your bot etc. obviously, same for the vps - there are $15 vps or $3 vps
You need to use a string input for discord IDs. Discord IDs are too long to be considered numbers in some programing languages.
But on a VPS you don't have the responsibility of hardware maintenance.
let's be honest, i have a rpi running for 5-6 years
hardware "maintenance" == 0
choose your intents wisely aka don't enable unnecessary intents, setup proper caching and you won't need a super expensive vps
Hardware maintenance includes protecting against power outage downtime and such
As well as internet downtime
Yeah, I have a VPS with 1GB of RAM and it works pretty well and it's not expensive.
works thank you
❤️
can you elaborate on what you want, you're a bit vague
Time to buy some ltc since people are apparently making discord bots to auto buy
Question:
Is t possible to make a bot (or use some api) to search some specific keywords in this "Python" server? (same as in the top right corner)
Or there are some antispam/security policy preventing this?
I cannot find any info either.
You would need have your bot invited here, which is never going to happen
Also bots aren't given access to the search endpoint
any ideas what kind of discord bot to make?
Depends entirely what your goals are
Not set
What bot?
hey guys
I have worked with them in the past.
What is your issue, can you share your code?
answer my dm when you see this
so we can get into a call
im working on a somewhat simple discord bot but im pretty noob - is anyone available to review the code and make suggestions ?
just share your issue here in this channel, it's made for that... currently everyone is wasting time unnecessarily
Need help with this bot - please see below:
Summary of Command Flow:
Start Boss Voting (/bossvoting): Users select up to 4 bosses they want to vote for.
Vote for Items (/itemvote): Users vote for items for each of the top voted bosses.
End Boss Voting (/endbossvote): Admins can finalize the boss voting and display the top bosses.
End Item Voting (/enditemvote): Admins can finalize the item voting and display the top voted items for each boss.
Clear Votes (/clearvotes): Admins can clear all voting data from the database.
Need help
What do you need help with? What's the error? What's the unexpected behavior?
We won't guess or run your code
My apologies. So the issue I am coming across is the clear votes command is not actually showing up in discord. All others show fine.
Have you synced the command tree after creating the command?
async def on_ready():
logger.info(f"Bot is ready. Logged in as {bot.user}")
await bot.change_presence(activity=discord.Game(name="Playing Throne and Liberty"))
# Re-sync commands manually
await bot.tree.sync()
this is what im using
might want to delete that screenshot and reset your token
then read https://realpython.com/run-python-scripts/#using-the-python-command and not that discord bots are for advanced python users, so you should learn how to use python in the first place
Don't sync in an on_ready event - either make a command for it or overwrite the setup_hook function
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Are you facilitating money transfers for a fee?
yes thats my bot exchange bot
but the problem is the emoji works on most panels
but on some panels they come up like this :Eth:
That is against the discord monetization policy
Also dont change presence in on_ready
I belive you can pass the activity kwarg to the bot constructor. It might have a different name though.
Im not saying that it is not against some discord policy, but I think the monetization policy only applies to people using discords monetization features.
Beginning on October 7, 2024, in regions where Discord supports monetization through its Premium Apps products, all developers who offer paid features or capabilities for their Application will be required to:
(i) support purchase of such features or capabilities through Discord’s Premium Apps products; and,
(ii) offer such features or capabilities at prices on Discord that are no higher than the prices at which they are offered through other payment options.
And given that venmo only operates in the US, it's pretty reasonable to assume that this applies
You've mixed up indents in your code
what that mean
The short answer is that indentation (the number of tabs/spaces at the beginning of a line) matter for python. Things on the same indentation level signal that a grouping of code is being maintained. By moving your two embed lines to a 0 indentation level, you're telling python that your help function is ended (which isn't what you want)
!indents
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
tldr ^
Hey it seems like the spaces are not correct. Pls be sure that your instructions are inside the func help
WHAT THE SIGMA
does anyone have a source code for a working modmail
i am occuring an issue in hoisting bot on pannel
This is not a code sharing platform. We help you with issues with your code
there's literally a modmail bot in the server
Your post has been removed for violating rules 9 and 6
why does my bot just stop working
all of the commands stopped working
doesnt even raise any error
does nothing
nvm
forgot to process commands in the on message event
Generally that's a sign you should be using a listener and not an event override
hey guys, I am experimenting now with UI in nextcord. You guys approve? ```py
test_button.callback = self.callback
view = nextcord.ui.View()
view.add_item(test_button) # Sending view via send method with param view=
Usually, it's recommended to subclass View instead of creating, and adding items like this ^^
yeah, that is true. You mean like ```py
class TestView(nextcord.ui.View)
........
Yes
do you usually make a button with the decorator inside TestView or a seperate class subclassing button?
It depends, if all of your buttons do different things, I'd argue it's okay to keep them in the View subclass.
Then if you need, let's say, 5 of the same button, you can subclass Button and add 5 of the subclasses to your View
sounds great.
what place is the best to write dev commands such as sync command? a cog?
yeah you can do it in a cog. but if you have commands like reloading cogs or disabling certain commands you may want to exclude those. also of course limit who can use it
and excluding it from help commands
you forgot the @, it should be @bot.command()
oh
@sick birch how do i make the bot send a invite link to a channel so they click it and it opens up that channel
!d discord.TextChannel.create_invite
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite) to do this.
assuming channel is an instance of TextChannel: invite = await channel.create_invite()
do i put tha under the command text
can you send the whole command so i can copy it and paste it in dont know how to import that command
i dont write code for people
but i can point you towards documentation and help you understand
yes
plz do
i did. see the above embed for the create_invite function which will generate an invite
no
How do i do this
which channel do you want to create an invite for, relative to ctx?
which channel do you want to create an invite for, relative to ctx?
explain
im slow when it come to coding
which channel do you want to create an invite for?
no, i just want to know what the channel is. will it always be the same channel? will it be the channel the user sent the command in? something else?
a text channel
i wanna send the command in any channel
so it gets them to this channel
@sick birch
always to the same channel? it wont change?
okay, you can get the channel object like so
channel = bot.get_channel(CHANNEL_ID)
then you can create an invite like so
invite = await channel.create_invite()
note that invite doesn't actually return a string of the invite, but it returns a discord.Invite instance, of which you can use the url property
so altogether you could do like
channel = bot.get_channel(CHANNEL_ID)
invite = await channel.create_invite()
await ctx.send(invite.url)
@sick birch
first argument should be ctx
async def links(ctx):
...
Hope I can ask this here, do you think there’s a possibility to make some money writing code for discord bots without providing hosting for the bot? Like will people be interested generally
Not really, Fiverr is an example of how it failed - people did that in the past, now it's just pointless. Especially when people realized most of these guys on Fiverr were just pasting off GitHub and cloning open source bots (especially moderation like modmail bots)
hey guys, if someone is interested on how to update a view in nextcord, because just removing it from a list doesnt actually update the view. You can use interaction.response.edit_message(....) The method response will return InteractionResponse which is the originated message that the interaction com from.
so guys, I want to hear your opinion. Is another ban/kick command necessary if you have discords ban/kick commands? /ban arg arg /kick arg
in my opinion, it's not useful to make another ban or kick command when discord is literally providing you a better one
finally!!!!!!!!!!!!!
finallyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Wrapping existing functionality is not only useless, it's actively harmful as it removes security features
So guys, we have the answer now and it is a clear answer!
People will disagree but people also like writing a two line command as an easy win to seem useful despite harming servers
guys, making a quiz/trivia command with the help of an api. Y'all approve? What are those quotes in the question?
huh what is this for a reaction?
can you explain SolsticeShard why you gave me this reaction or you gave the answer?
it's the answer to the trivia question
ok, what is this for a video game, need to google it
I think that might be a hard one. What yall think?
HTML character entity
!d discord.Invite
class discord.Invite```
Represents a Discord [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild) or [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel) invite.
Depending on the way this object was created, some of the attributes can have a value of `None`.
x \=\= y Checks if two invites are equal.
x !\= y Checks if two invites are not equal.
hash(x) Returns the invite hash.
str(x) Returns the invite URL...
What does your app do?
So it doesn't really have an identity? Do you know what problem you're trying to solve?
FWIW slash commands natively let servers do that
But IMO these "multipurpose" bots which don't have a stated purpose just become a pile of random things and are hard to develop on because there really isn't a goal
"hard to develop on" meaning "what are you going to build when your bot does literally anything", not a statement of organization
And this is still natively supported by slash commands
You could ask your users what they would find useful and actually use
People on their server can go in and choose which commands they would like to appear or not
🤨
Might want to review the monetization policy if you're not using the built in app subscriptions
It is also natively supported to have premium commands
More directly: if people are paying you for bot functionality, you are required by discord to expose that through discord's monetization at the same price. And they already have a vastly simpler way of marking commands as paid.
okay...? Not sure how that changes what I said
- If people are paying you for things on your bot, you have to use discord's system to accept that money
- Discord already gives people a way of enabling or disabling commands without your bot doing that. It also gives you a way of noting a command as premium. Your bot does not have to manage any of this
Who then is deciding which servers get which commands and how

it is not up to me
I decide
Very weird line playing god deciding which servers get which functionality of your bot but you do you man
Earlier you were talking about people paying you and now it's "advanced"
weirdly specific example but sure
The initial question was around what commands you should add, and with a bot that has no real stated purpose that's a hard question to answer. It's a completely subjective question, people could throw a million ideas at you and you could use whatever criteria you wanted to determine if they were good or not.
This server is also very specifically about python and how to implement things in python, IMO you'll also get better answers in a more general discord development focused community. My advice is to talk to the people who will be using your bot to understand what they want, vs building what random people on the internet say is cool. You'll get a lot of recycled, uninspired ideas that have already been implemented by 8537439 other multipurpose bots
Let the man cook
He wants to learn
I’m not sure if his application will last long but ye
I'm not saying anyone can't do anything lol, I'm giving honest opinions on how to make good/useable things. If you want to build random stuff just to play around with the api then go bonkers
Anyone know how to set a buttons style based on a value?
not possible if you mean like css customization
Not what I meant, but I found a solution.
reject is that you 
No
hows ur bot
Started a new team.
Bro remembered me? 😭
me?

or him
You remembering me
yeah id o

i mean not like i was thinking of you that much but if i see you with the same pfp and name and see that your bio is about a bot its not that hard to remember xd
Real
question do you know any good normal but not some "ai realistic human" shit text to voice websites or engines?
Google TTS?
or you asking sum else?
Google TTS might be to AI though, I have no clue
google tts isnt that good really
this is like an example of what i need but i cant find the voice
just a snippet of some video
Nah ion
oof alr
Im just a website n bot developer 😭
yeah ik
Yeah, sorry pimp
!d discord.Role.members
property members```
Returns all the members with this role.
hey guys, if someone is interested on how to implement that a view can be modified just for the author who invoked a command, just override the method interaction_check(.......), it is in the view class
be sure to respond with param ephemeral=True because that makes the response just visible for the one who performed an interaction
I hope you guys understand, if not, please ask
guys, I wanna hear you opinion about robot making in discord, since discord has thousands of robots that have all sort commands. Is it "lucrative" or not? I mean there are so many
If you want to make money, do something else
This is an extremely saturated space, where the vast vast majority of users are not spending money. You have to make something very unique and niche targeted at the few people on this platform willing to spend money.
If you want the good feeling of making something useful, there's plenty to be done but it doesn't live in any of these "multipurpose" use cases
exactly I agree
Anything living solely within discord ("moderation", "ticket", etc) has been done a thousand times over. Really the only useful stuff is integrating with other systems in useful and novel ways
have a look on a discord bot list and you see thousand of them
90% of them saw dyno or yagpdb or something of the like and just thought "I'll do that again and for some reason people will choose my bot"
There some people who make a discord bot for their one dc server which has its advantages and disadvantages
Yeah custom things, fully understand that especially if it has elevated permissions
I personally think that there is room to grow in some of the common bot features. For example I think there are probably a lot of cool things you can do with ticket bots that no one has done. The question is will the general userbase care about those cool things
Yeah any meaningful disruption should come from talking to end users and gathering patterns, which takes time and connections. Things most bot devs I see don't invest, and instead they just brainstorm or make different combinations of already existing features
what steps do i need to take in order to make cooldowns like this
u can use the cooldown decorator
A hands-on guide to Discord.py
https://fallendeity.github.io/discord.py-masterclass/error-handling/#full-bot-with-more-errors u also need to check if a cooldown error occurred which happens if someone uses the command while its on cooldown and u can format the message and send it
A hands-on guide to Discord.py
Just included gemini ai into my dc robot, how creative. omg I am now ai expert hohohohohoho
solsticeshard it was meant sarcastic
look into application commands that gives by default such functionality
/ commands its a system discord has to allow bot commands for particular guilds/servers, perms, users etc.
this is for a singular / command 😭
the command is only visible to the people meeting those criteria which are set when defining the commands or to be more specific syncing them (informing discord who is allowed to see these commands)
Server's can also manually choose which roles/people can use specific commands by using intergrations in server settings.
thats a modal not an application command
I'm aware.
This file only produces one command.
Which is a /setup command
yeah just going through a basic explanation
might be misleading to show that as en example picture to a beginner then 🙂
Yeah.
https://fallendeity.github.io/discord.py-masterclass/slash-commands/ check this out once
and this
https://github.com/Rapptz/discord.py/tree/master/examples/app_commands
A hands-on guide to Discord.py
Does anyone know when discord made it so any bot could be verified just by verifying their ID?
Personally I think it's pointless as you still have to apply for privellaged intents.
it was always the case you needed both id related to the user and special intents you apply for, also a few questions regarding user data iirc
Oh never knew that, I always thought your bot got verified when you applied for privellaged intents.
its to make sure ur 18 or legal age afaik
I'm pretty sure it's 16
u mean commands restricted to a specific set of servers?
@bot.tree.command()
@app_commands.guilds(discord.Object(id=1234567890), ...)
async def echo(inter: discord.Interaction, message: str):
"""
Echoes a message
Parameters
----------
inter: discord.Interaction
The interaction object
message: str
The message to echo
"""
await interaction.response.send_message(message)
an example if u had a hardcoded guild.
Another way to have it dynamic is to do it when you are syncing you change the available guilds= params as u see above and resync all the commands i.e let discord know that the commands are updated
so its hardcoded?
shouldn't the whitelist be changing
i would imagine a database somewhere in the process as well and not a simple list object
then do you re sync all the commands everytime it changes?
cool, just make sure u don't resync too much there is a limit to that afaik i dont remember the exact numbers
i dont think updates/patches have a limit but command creation deletion have a few limits
yeah 200 creates per day, rest all updates and deletes dont have limits
stringified data lol
what is this? What do you mean by stringified data in sqlite
sqlite dosent allow strings lists or dictionaries so u basically stringify them (json.dumps) and then deserialize them when u need it again
thats whats happening above
mhh ok I ve never used sqlite
I am only familiar with pymongo
mongodb
almost all sql databases are like this few might have arrays like pgsql but most maps are usually stringifed
yep so thats a document based db, non relational, altho u can like embed documents in a document
it is easy to learn I mean just "dictionaries"
but has its disadvantage
if you are a discord engineer which database you using to store billions of messages?
discord started of with mongodb lol, then they switched to cassandra now finally then are using scylladb
What language do you not understand @shrewd apex
tons lol, go, dart ruby haskell etc its not understanding the language thats roughly easy once you have some basic concepts down its mastering or understanding a language in depth that goes hard
I would assume that scylladb is nosql
i would say out of most langs i have used python is the one i understand the best and use as basis to transition to other langs
no sql, columnar afaik
Yeah, do you know if DiscordRb has been updated recently?
discord ruby?
Yep.
Just looked at the github page, untouched since July 2023, but has some updates since then
https://github.com/shardlab/discordrb says last month
Yeah.
It's alright but it's just not maintained like DiscordPy or DiscordJs
last release of artifacts or build was on 2023
Yeah.
hmm yeah the gem build also says 2023
so i think latest stuff like polls etc are prolly missing
I don't think slash commands are implemented in Discord Ruby yet.
yikes
Last time I tried it that was true unsure of now tho.
It is probably so that discord has your information in the event of a legal issue
Well this server will almost always recommend python. But for discord bots you should use the language you know best.
https://libs.advaith.io/ good comparison between libs
i would recommend python but if u need something perfomant without going into languages such c,c++,rust c# is prolly the better choice however only place i ever needed c# was when building native windows app for win10 and 11
wow thats nifty
Eh. They've done some questionable stuff in the past
yeah u need to perform localizations (happens before command syncing)
A hands-on guide to Discord.py
or if u trust some google translate that works too
its this post on today-i-teach
which does the samething but like translations need to be done manually once and recorded in pot files
A guide to internationalization with Python and discord.py. - thegamecracks/discord.py-i18n-demo
It is an open source website. How can it be questionable?
hi
is the implication here that open source can't ever be questionable? 
They would unfairly list libraries as missing features when those features weren't stable or documented
The fact that you could open a PR to fix it.
As far as I know most of the data is from 3rd party PRs and not collected by Advaith
RIP.
ok guys I need help on this one. How can I edit a view when it is timeoutet. I use the given timout method to override it cand the method self.clear_items but in order to udpate the view I need to edit it but how? I am using nextcord.
Need to make the view have a reference to the message you want to edit
I thought of save the message and give it to the view in order to edit it when timeoutet
sounds right
is there any way to track if a channel is inactive or not using discord.py?
Well depends on how you define "inactive"
hey guys, have free trial from upcloud , is it good?
organized everything on the debian server with python venv and the packages
oh and tmux
Never heard of them, though a cursory google search yields some questionable interactions. Use at your risk I guess
what you mean questionable interactions? against the users?
Yes, just run a Google search for reviews and come to your own conclusions
😠
guys, implemented gemini to my discord bot for fun. I am now a certified AI expert and can now create my own model hihihihihii
I made a discord bot, the slash command works perfectly in my test server, but in other servers its not working, I have made it so when a user executes the command and they don't have admin perms, it will say that they don't have perms, using @app_commands.checks.has_role(), when a user without perms tries to execute the command in the other server, it works, but if they have the permission, it says that interaction didnt respond, I don't see any errors in my error log too
can someone help me with this
can it be a issue because I am using GroupCogs instead of Cogs
I recommend you don't use this check in code
slash commands have a native ui for limiting commands
I fixed the issue
and I hate discord for this
discord should make it so it returns the url for the server icon which is created by default
that was the main issue, and for some reason, it wasn't showing the errors
can you explain a bit more on this please
how to create a command from a existing emote or url
eg:
emote create :kaze:
emote create kaze
emote create https://cdn.discordapp.com/emojis/637715282995183636.png
no need to spoonfeed me just tell how to go about making it
what are you having trouble with, which part?
making it
previous attempts the url part didn’t work
Gonna have to be more specific than that
what is the code you have, and what in it isn't working?
I tried adding my bot to my server and it said this
What url are you hitting? Where are you getting it from?
https://discordapi.com/permissions.html ? so i used this website to generate authencation invite links for the bot, so that im able to add the bot to my server and give it the required permissions it needs to operate in my discord server, i did that on this website, and i use the link thats generated from the site but after i add it to my discord server it gives me the "missing redirect uri in request" @fast osprey @uneven ravine
A small calculator that generates Discord OAuth invite links
dont use that
go to the applications portal and press installation
and turn on guild instal turn off user install and do it like this
and copy the link i scratched out
Is there a way to make a slash command prefilled by a link?
bro i did that and it stil aint working please help @shell adder
made it work somehow isk
but hey is there a way i can have attachment option as well as url option is the slash version of my hybrid commands
sure yeah
I mean make two parameters, one a string and one an attachment?
then i have no clue what to tell you because ive never had an issue like that before
did you make it a bot user yet?
what do you mean?
does user install need to be off overall?
this is a stupid question I feel, when making my own custom discord bot. I copy the token from the Dev Portal and import it into my VSC Code. Eachtime I run the code - it returns this error
discord.errors.LoginFailure: Improper token has been passed.
I have reset the token multiple times to try it, can anyone advise what im doing wrong?
Are you passing the token as an str using: "this?"
When coping the token, are you double clicking the text? If so, don't xd, it may not be copying the end of the token
I found the issue, I double click copied and it added a space to the end - got it now thank you though ❤️
Oh, good luck then! :D
i did that and its showing me this
does anyone else know the fix
im trying to add my own bot but its not letting me
How are you getting this url
I just told you. From the discord authentication developer portal they generate a link for authentication
Can you show that along with the other settings you have there?
then go to oauth and enabled bot and applications commands scope and give the administrator perms and then copy the link it gives you and open it in your browser
Anyways, you probably have this setting turned on, which you don't want if you're not using oauth and just want a simple bot.
(You also should never give bots admin, never, there's no reason to need it and several reasons to not grant it)
People just do that because its time consuming to actually give every perm to it
@merry cliff https://discord.com/channels/267624335836053506/1312643681198800976 still dont do any thing. though i did notice i type clans instead of clan. but sadly . it still didnt work once i typed it correctly
did you save and restart the bot?
Hello, do you can share your idea about discord bot - what he can do. I am admin of one of Anime translator site, but i dont have idea what new idea can implmenet in bot to create my channel more interesting.
Any idea is good idea if you share with me 🙂
As a personal opinion, this server is focused on implementation, not idea generation. You will get far better ideas from communities focused on the thing your bot caters to
I don't know how socially engaged you are. But people these days:
- They don't share ideas
- They don't know what a "bot" can do. And as we know, it can do a lot.
- I'm looking for ideas from people who have an open mind and they're usually programmers.
Nevertheless. Thank you for your opinion. I'm writing here because the main problem is probably point 1 on typical forums/ chats.
I'm pretty "socially engaged". It was friendly advice that this community wasn't designed for what you're asking and that you'd get better more grounded answers in one that is.
catch phrases, gifs, meme generation from certain anime scenes and cuts?
depends on your audience of your server too
Yep
Since your in to anime what abot a bot that's pulls info off of fandom. Or bot that does quotes of your fav animes characters.
I mean my bot is simple real. It's going to have info of vtm like clans discipline marits and flaws loresheet. Problem simple just time consuming. Just need it to be able to read them print out the info what I will be putting in strings. Once that then I'll worry about have it pop up in the type bar with different things.
What's your code now? Are you trying to make native / commands?
from discord.ext import commands
class Utility(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
"""Hört auf Nachrichten, in denen der Bot erwähnt wird und antwortet mit dem aktuellen Prefix."""
if message.author == self.bot.user:
return
if self.bot.user.mentioned_in(message):
prefix = await self.bot.get_prefix(message)
embed = discord.Embed(
title="Aktuelles Bot Prefix",
description=f"Der aktuelle Prefix für diesen Server ist `{prefix}`.",
color=discord.Color.blue()
)
await message.channel.send(embed=embed)
if not message.content.startswith(await self.bot.get_prefix(message)):
await self.bot.process_commands(message)
@commands.command(name="userinfo")
async def userinfo(self, ctx, member: discord.Member = None):
"""Zeigt Informationen über einen Benutzer."""
member = member or ctx.author
embed = discord.Embed(
title="Benutzerinfo",
description=f"Informationen über {member.mention}",
color=discord.Color.blue()
)
embed.add_field(name="Name", value=member.name, inline=True)
embed.add_field(name="ID", value=member.id, inline=True)
embed.add_field(name="Beigetreten", value=member.joined_at.strftime("%d.%m.%Y"), inline=False)
embed.set_thumbnail(url=member.avatar.url if member.avatar else member.default_avatar.url)
await ctx.send(embed=embed)
async def setup(bot):
await bot.add_cog(Utility(bot))``` Whats wrong here? I use the same setup function for every cog but here it wont work. Any ideas?
are you positive that this is the code you're running, and that you've saved this?
you guys find my embed cool?
it works with the help of an api, gosh I love apis
solsticeshard you approve? What can be improved in context of displaying information?
Looks fine, I don't really have opinions on ux
Thanks, but there is one problem and it is my freeplan for apis. All have a limit, but nothing is free in thsi world
That's to be expected, running the machines that power that api costs money and it's unlikely someone will pay out of their pocket just for the joy of doing so
😭
This could be better; things like the temperature can be in one combined field, and maybe the other stuff in the description
And maybe add some matching emojis for the conditions
ok, thanks for your feedback. Love it!
unfortunate, where are you stuck
note that we won't code for you, we help you with your code
also note that an advanced knowledge of python is required before making a bot, even a simple bot
also note that streaming music from youtube/spotify/whatever else is against their tos hence against discord's tos, and will get your discord account terminated/banned - so we won't help for such music bots
anyone any good with discord bots. I coded a bot that has some simple slash commands but when running the command bot.py - it just gets stuck after it initiates the static token. I have got it to track when the bot is ready and logged on but just wont enable
Code?
sorry for the wait to reply. I got it fixed - seems when i was running the code, it wasnt registering my slash commands so i had to update and refresh connection points
If you're syncing slash commands during startup, you probably shouldn't be
is it recommended to not do the auto-sync?
I normally just hvae to resync my bot eachtime I add a new function/feature onto it
You only need to sync if you're adding or removing entire commands, or changing their signature. Which isn't every time your bot starts. This endpoint is also aggressively rate limited so there are real consequences for repeatedly syncing when you don't need to
Speaking of which, for my sync command, does it have to be an app command or prefix command?
Anyone here professional devloper who's now about Netflix and python language want to one bot
What?
@teal delta dm
prefix is preferred
so i have added a resync command but like lets say I add a new command/function to the bot, will I need to manually restart the bot via terminal and then rerun it?
pip install -U discord.py
PS C:\Users\sammy\Desktop\Nueva carpeta> & C:/Users/sammy/AppData/Local/Programs/Python/Python310/python.exe "c:/Users/sammy/Desktop/Nueva carpeta/asd.py"
Traceback (most recent call last):
File "c:\Users\sammy\Desktop\Nueva carpeta\asd.py", line 107, in <module>
bot.run('imaginE the token here', bot=False)
TypeError: Client.run() got an unexpected keyword argument 'bot'
PS C:\Users\sammy\Desktop\Nueva carpeta>
What do you think bot=False is trying to do here
Also if you change the underlying code, by default those won't change in memory unless you reload the modules it lives in
Selfbot
yeah those are against tos
Bruh .-.

Help me please
We don't help with TOS breaking projects, it's in the rules
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
dms
downgrade discord.py version
which didnt had intent shi
i just installed it and double checked by installing it again whys it say this
pip uninstall discord
pip install discord
Make sure u select the right interpreter for python
Then restart vscode
May there be a way of dynamicaly add app_commands? Lets say the main bot loads "plugins" and these plugins just points the stuff to do by hooks, so far all events were easy to implement with importlib but now getting into app_commands may be hard to because they have to be declared in the scripts as is and i cant think on a method for loading them via a function, if want to see the old project is in github Mikk155/discord-bot
Yeah not possible with dpy's app commands
Don't see why it wouldn't be possible, but it wouldn't really make much sense too. App commands are meant to be discrete sets of logic, you really shouldn't make X commands that all do mostly the same thing
Dpy checks the function signature for parameters, etc.
While you can fake it by setting the signature yourself for one function for every command, that is just far too much effort.
Something I just thought of: since app commands only need to be registered on Discord, you can register them manually using the HTTP methods and catch them when invoked via the on_interaction event, parse it out, and do your thing.
sounds like on_message but for app commands 💀
Yeah I read over the repo and this really looks like an anti pattern. I can't see anything that this layer of abstraction gives you, and it makes the code actively less readable. There's no reason these "plugins" couldn't just be extensions with proper library code
Stop helping someone who is trying to make a self bot.
Also this is wrong. They need to reinstall whatever library they are using after uninstalling all other discord libraries. "Discord" is not the correct thing to install
where does one find clients who want a discord bot made for them
Fiverr and Upwork
oversaturated I've heard
can a newb still make it in those markets
Discord bots overall are dead, so will overall be hard to find clients - regardless of the platform - though if you do make yourself a good profile, maybe you will get a few requests
how to make a command that does this? put my avatar in a toaster gif like this? im stuckk
What are you stuck on specifically
knowing what to use
To do what?
generate the given image in a toaster like the first image….
So that's more of a question around image generation, not discord no?
I know most folks use PIL/pillow for this, though maybe #media-processing is a better shot
What is your python version?
Bc latest version is not optimised for discord.py, you need 1.11 or 1.10 for it
python 1.x??????
3.12 is fine
Yea but best optimised are this two
any up to 3.12 inclusive
just 3.13 isn't, though that will only fail when executing, it won't show errors in your ide, they either haven't installed it at all or they have multiple versions installed
@bot.command()
async def clans(ctx):
clans_embed=discord.Embed(title="clans",description="all the clans names",color=discord.Color.blue())
clans_embed.add_field(text=lsclans,value="value 1",inline=False)
await ctx.send(embed=clans_embed)```
lsclans is a string
!d discord.Embed.add_field
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent\-style chaining. Can only be up to 25 fields.
There's no text kwarg
so just use the string ?
bot outputing wrong
here the code@bot.command() async def lsclans(ctx): lsclans_embed=discord.Embed(title="clans",description="Banu Haqim Brujah Gangrel Hecata Lasombra Malkavian The Ministry Nosferatu Ravnos Salubri Toreador Tremere Tzimisce Ventrue .\n \n Clanless \n\n Caitiff Thin-blood ",color=discord.Color.blue()) await ctx.send(embed=lsclans_embed) async def help(ctx): help_embed=discord.Embed(title="help",descrption=".help=list the commands \n lsclans= list name of clan \n c=c followed by clan name with show clan descripter bane and discplines ex. cbanu-haqim cbrujah ...",color=discord.Color.blue()) await ctx.send(embed=help_embed)
.pan
i change it to pie and add @bot.commad() and it works
i removed @bot.command() cuz it was throwing and error
how does you typing .pie at all relate to the code you sent? 
What i thought
You can't
VPS are computing resources which is paid obviously
Closest you can get is buy a Raspberry Pi or similar and host it at home, though there are still electricity costs to keep in mind
!hosting
Using free hosting options like repl.it or Heroku for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.
See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.
You may also use #965291480992321536 to discuss different discord bot hosting options.
use #bot-commands for random commands
guys please stay away from free hosting. They can, I assume, steal the bot token perhaps
just like paid hosting can
if they do however, their reputation is ruined - paid or free doesn't matter
There are some free hosting I would 100% trust. GCP, AWS, Azure, etc... They make BILLIONS and use their free tier to suck you in to paying millions a month for their services. They would never risk anything for some dumb tokens.
Free "discord bot" hosts are usually ran by skids that'll pull the plug when they can't afford it anymore
They can see all your files; large companies like above can and will not
Ugg. I really should write up some terraform and scripts/docs to start a AWS account and setup everything for free tier lambda/ECS/EC2 for simple hosting.
uff
??
is this true? never used aws or that
Yes. I use AWS for work and personal. The issue is AWS is hard to get started with. That is why fly.io and vercel got started. They are (more or less) just a new UI on top of AWS, with a 2x price increase.
Til
not just that right vercel for example has a lot more pipelines and other infra cdns, serverless fns, and optimizations setup for their own frameworks such as next.js its far from as simple as just a ui around aws
For sure. But they don’t host their own hardware (as far as I know) they resell AWS
yeah true
At this point I’m starting to lean towards more basic services like hetzner. Just pay $5 per month for a VM and set up a basic sync with GitHub actions to deploy. Much cheaper for simple things that won’t fit into free tiers, and pretty easy.
yeah hetzner is good their arm services are pretty affordable
@broken sail the embed and await lines should be one space to the right
If you copy the code and paste it here I will fix it for you
!indent
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
@bot.command()
async def av(ctx, member: discord.Member = None):
if member == None:
member = ctx.author
embed = discord.Embed(title = member).set_image(url = member.avatar.url)
await ctx.send(embed = embed)
bot.run(***********)```
What do you mean?
Discord.member should have a capital M in member
discord.member != discord.Member
What error do you get?
made it a cap
Not all people have avatars
the default one isn't one
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar)
If the user has not uploaded a global avatar, None is returned. If you want the avatar that a user has displayed, consider
display_avatar
You can add a try / except clause so that if you raise that exception you do a different embed without the image
property display_avatar```
Returns the member’s display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2\.0\.
where do i put that into the code
You want to use discord.Member.display_avatar
look at where the error is telling you the problem is
someone fix the code
What do you exactly want to do?
Wait what is wrong with the existing code?
Don't copy paste code you don't understand. Especially not from a youtube video
Are you trying to fetch a user or Discord member?
It's a choice question, not a yes or no
can yall join vc 1
Do you want to grab an avatar from a guild member or any user?
Sorry I can't atm
You can use embed.set_image(url=member.display_avatar.url) for that
- member.avatar.url
+ member.display_avatar.url
Man spoonfeeding code isn't gonna help them
They'll just comeback for more, as they did for the error above
where i set that in the code
Read your code
where i replace it
After creating the embed
You need to define the embed first
embed = discord.Embed
# Create an embed
embed = discord.Embed(title=f"{member}'s Avatar", color=discord.Color.blue())
# Set the avatar image
embed.set_image(url=member.display_avatar.url)
# Send the embed
await ctx.send(embed=embed)
So we first create the embed, then set the avatar image and send the embed
member will grab the display_avatar.url from the member
From
async def av(ctx, member: discord.Member = None):
Which in this case is a discord.Member
I hope this will help you a little bit
Also you can use member = member or ctx.author
i am Going to Shit myself
how do i get my bot's commands to work in dms using the nextcord library
cause regular old slash comms don't work for me
no errors or logs to provide
code just looks like
yada yada imports
yada yada make bot we have all the intents
@bot.slash_command(yada metadata)
async def command(yada yada: nextcord.Interaction):
await yada.reply("hello!")
bot.run("No.")
https://docs.nextcord.dev/en/stable/ext/commands/api.html#nextcord.ext.commands.Bot.slash_command
try by doing @bot.slash_command(dm_permission=True)
Or even better:
member: discord.Member = commands.Author
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.discord.ext.commands.Author
Definitely not possible
That bot probably sends the ip as a separate message for mobile users to easily copy idk
thx
Solution:
You didn't define the embed in your code this is how you do it and it is must
embed = discord.Embed() #this is must everytime you want to use embed
embed.set_image(url=member.avatar)
Suggestion:
2 better ways to replace member with author
member = member or ctx.author
# if member is None it will automatically take author
async def av(ctx, member: discord.Member = commands.Author)
Example:
@bot.command(name="avatar", aliases=["av", "pfp"])
async def _avatar(ctx: commands.Context, member: discord.Member = commands.Author):
embed = discord.Embed(description=f"{member}'s avatar")
embed.set_image(url=member.avatar)
await ctx.send(embed=embed)
Double =
how can i make the bot status the mobile icon
This is not supported by discord
People doing it does not mean it's supported
it's an exploit and discord does not want you doing it
do you guys have in all of your commands a try-except for error handling to get a indiviudal error for each command? When you have for example a command that connects to an api via reuqests? How would you guys handle the error?
Depends on how you want to handle it and on what layer. Also you should never be using the requests library in an async application.
which then aiohttp I guess
you mean requests can be "blocking" since nextcord works async?
Yes precisely
mhh makes sense never thought of that
Yeah if you implement anything blocking at all your whole bot locks up 💀💀
Learnt this the hard way
is there a way i can show my site the bot status like "online" offline and stuff?
like a site page which says "bot it online" "bot is offline".
i want to use it to visualize the status of multiple bots at once... in my website
Sure. You could have some mechanism actually check the status of the bot users on discord. Or your mechanism could poll status from the bot processes themselves. Your call
You could use a discord api wrapper that's appropriate with the language you're using to login with each bot's token and get its status
Or - do almost the same thing but create a bot that's used just to fetch the user data of the bots in a single server instead of logging in with 3 different bots which would be almost impossible / resources consuming / get you ratelimited for repeated login calls on the same IP address
Does discord go off a set of rules for approving intents?
or does it depend on the person who is looking at your request?
Cuz atp, I have put in legit reasons, and they have been declined by many, and I truly don't know why... and back then, maybe 8 months ago, these same features would have been approved and they were allowed to go through intents.
But now they are either more strict on it, or it depends on the agent who reviews it..?
You may be operating under a different definition of "legit"
Ill go with the second option,thank you!
They state that the approve intents on a case by case basis but there are some things that will get you automatically denied. For example wanting the message content intent for prefix commands.
Of of the things they say is that they are only approving intents for unique features. So if there are a bunch of bots that have the feature already they may be less likely to approve the intent
with the expansion of AutoMod there is basically no legitimate need for message content. The members intent is a bit less sensitive but honestly requires a pretty novel use case to justify it
I actually disabled the message content intent for my verified app
I hope I made the right decision
I'm not sure if I'll even need the presence intent too
i hope this works
i'm waiting on itto register
WARNING discord.gateway Shard ID None heartbeat blocked for more than 10 seconds.
what exactly is this ?
You have blocking synchronous code that is prevention the bot from staying connected
how could i synchronize them ?
You don't. You use asynchronous code instead of whatever you have that's blocking.
These libraries are build on top of asyncio, and if you're unfamiliar it would be good to do some focused learning.
👍
im trying to use the twitter api to send tweets when a certain handle sends tweets however for the past 2 hours ive been getting these errors
Logged in as Yapper#2702
Error: 429 Too Many Requests
Too Many Requests
😭
Can you send the full traceback?
Also isnt the twitter API very expensive? Nvm there is a free tier that fits your needs
Your error should come with a traceback, otherwise you have no idea where it's happening
Idk, maybe I am. I am just wanting to understand discords standards maybe..?
I understand the standards on my end.
Nothing stupid, no reasons for like fetching info status or something
I know there is a limit from stupid and a good reason for needing it. But idk how they decide ig.
Oh, thats an exploit?? I thought it was allowed.. I have seen verified bots do many times. I also have seen it in dpy too. So I thought it was allowed.
Just curious, why is that not allowed by discord? Why is discord against it?
and, do you think discord would ever allow you to use the mobile status? or are they just fully against it right now?
Why would you need it anyways. It doesn't convey meaningful or even vaguely correct information
People just do it to feel special, not for any functional purpose
they have no reason to
^ yeah the mobile status is pretty much useless
Valid reason ig. I personally think it's cool. That's the only reason. But there is no true reason to release it.
Nah, I know that, it's just to look cool i would assume. It's nothing special though. It's just the mobile icon.. I kinda think it looks goofy for bots lol.
To answer this, most people come into this thinking they deserve these intents/data. Discord takes the opposite approach, that you never get it unless you prove absolutely that there's no way to do what your bot is stated to do without them. "I need message content so users can run commands" doesn't fit this need because slash commands exist. Same with AutoMod. It is on the developer to prove that a) what they're trying to do is novel and cannot be done with the systems in place currently and b) they need the particular intent to do it
they declined my members intents request even though I needed to add a "server specific" filter for some of my commands, like showing a list of book reviews from only the server members :/
I don't think there's any other way to do it without having members intent.
You don't need to know all members in a server to produce that. You can record the people in that server who choose to interact with your bot
You have no need to track people who do not choose to interact with your bot
okay but how do I go about doing that for the 50+ reviews that the people have already listed?
thanks though, I'll keep that in mind
You don't
. Modify your data model and start tracking it going forward I guess
Or have some migration story asking users to reverify once you have that in place
mm alright thanks
yep thats whats what im using
i sadly dont get a traceback which is another problem
Your app is eating it then
i will try to submit the code today
Which is the first thing to fix
it gives the too many requests error as soon as i run the code which from my understanding i failed to limit it
Alr, ty
hey guys, I have a small joke command and since nextcord is async I am using aiohttp with it. I have been reading the docs for hours and implemented this now: Is this kinda ok or what can I change?```py
async with self.session as session:
async with session.get(".......", headers={"xxxxxxxx": "xxxxxxxxx"}) as resp:
status_code = resp.status
result = await resp.json()
using context manager to properly close the sessions
ok perfect
Please help me, I got no clue of why the Slash Command isn't showing up. ```py
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix= ">>",intents=discord.Intents.all())
@bot.command()
async def repeat(ctx, message: str):
await ctx.send(f'{message}')
@bot.tree.command(name="hello", description="Sends a message!")
async def hello(ctx, message: str, channel: discord.TextChannel):
await channel.send(f'Here is your message: {message}')
await ctx.respond(f'Message was sent successfully!')
@bot.event
async def on_ready():
print("Logged in!")
with open("token.txt") as file:
token = file.read()
bot.run(token)```
if it works it works lol
Which library are you using?
Discord.py, why?
dpy requires you to sync your commands to discord. It doesn't do that for you
How to do that?
wild guess is it because of your ">>" is your prefix?
call .sync() on your command tree. preferably in some process you initiate manually, not automatically
I don't really think so...
(such as a gated prefix command)
Alright, thanks!
This is a good walkthrough: https://about.abstractumbra.dev/discord.py/2023/01/30/app-command-basics.html
Hey there, welcome to the examples and explanations of the discord.py application (or ‘slash’) command system.
mhh that is not how things work, what about efficiency etc?
you can write code that work but it is not efficient and is hard to read. That is why reviewing code is essential
especially for a company that has to serve customer with flexible and efficient service
it's common to abstract API calls behind methods so it's easier to read from caller functions
Got a little bit confused, where should I type that out?
Why does my command keep saying this when it works? Here is the command:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix= ">>",intents=discord.Intents.all())
@bot.command()
async def repeat(ctx, message: str):
await ctx.send(f'{message}')
@bot.tree.command(name="hello", description="Sends a message!")
async def hello(ctx, message: str, channel: discord.TextChannel):
await channel.send(f'Here is your message: {message}')
@bot.command()
async def sync(ctx):
print("Sync Command.")
if ctx.author.id == 1109142957866619013:
await bot.tree.sync()
await ctx.send('Comand Tree sycned!')
else:
await ctx.send('You must be the owner to run this command!')
@bot.event
async def on_ready():
print("Logged in!")
with open("token.txt") as file:
token = file.read()
bot.run(token)```
Anyone?
You need to respond to the interaction
All interactions must have one and exactly one response within 3 seconds of the interaction happening. This is via await interaction.response.x(...) where x is the type of response you want (ex send_message)
yo
can some1 help me in this every time i run this it doesnt work at all 😭..
import discord
class Client(discord.client):
async def on_ready(self):
print(f'Logged on as {self.user}!')
intents = discord.intents.default()
intents.message_contepythonue
Client = Client(intents=intents)
Client.run('')
i made it same as i saw in video now idk
every time i try run the bot it says file 'file name ' line 3 in <module>
I tried that but it says that interaction is undefined.
Because you're naming your interaction parameter "ctx"
Oh.
Slash commands don't get a context so this naming is misleading
Oh I didn't know that, thanks!
intents.message_contepythonue
Yep everything works, also, how do I specify a guild? And how to make my bot reply to the slash command? (Or to a normal command).
Specify what guild in what context?
In the slash command.
For what purpose
So that I can put the member option.
You can just add a parameter and typehint it with Member if you want the user to provide a member when running the command
(And then sync again after restarting)
Alright.
And how to make my bot reply to the slash command? (Or just to a message).
^
Unless you mean something else by reply
I mean like that the bot replies to a message.
Slash commands don't reply to messages though
You can call the raw api to reply to a message if you want, which works like any other component that would reply to a message. That doesn't change that you also have to respond to the interaction itself though
Alright, thanks!
Is there any way to detect forwarded messages from other guilds?
when they're done with it
probably soon tbh
What is the different between discord.MessageReferenceType.forward and discord.MessageFlags.forwarded?
hey so im making a discord bot using the coingecko api where it pulls a certain coins current_price and the trading volume however when i type the command it sadly doesnt respond with anything could someone tell me what im doing wrong?
import requests
import json
TOKEN = (not for you)
intents = discord.Intents.default()
intents.messages = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$crypto'):
# Call the CoinGecko API
coin = message.content.split(' ')[1] # Assumes the name of the coin is the second word in the command
response = requests.get(f'https://api.coingecko.com/api/v3/coins/{coin}')
data = json.loads(response.text)
# Extract the information you need from the data
current_price = data['market_data']['current_price']['usd'] # Get current price in USD
trading_volume = data['market_data']['total_volume']['usd'] # Get total trading volume in USD
await message.channel.send(f'Current price: ${current_price}\nTrading volume: ${trading_volume}')
client.run(TOKEN)```
One is a flag, the other one is the type of reference
Firstly that you should not be usings the requests module in an asyncio application. You are going to block your entire bot (including heartbeats) while you wait for that api to reply. Use aiohttp instead
Secondly, you are relying on message content without requesting the message_content intent
^
messages != message_content
That much I understand, but how can they be used in examples?
With the flag you know if it's been forwarded, with the reference type you know the type of reference
If you need to know if the reference type is a forwarded message, you have it
If you need to know if the message is a forwarded message, you can check the forwarded flag.
The reference is optional, hence checking for reference.type to know if the message is a forwarded message is not ideal, that's why flags exist
Gotcha. Do you know if it would be possible to check if the message was forwarded from another guild?
That's in the discord.Message.reference - reference.guild_id to be precise
works now thank you
And you're not using the commands extension
Something like this?
@bot.event
async def on_message(message):
if message.reference.guild_id != message.guild.id:
await message.delete()
how did this guy make such spaces between first 4
these are not fields because spaces between fields are much smaller
Is it just spaces or tabs?
idk
the thing is i tried doing spaces in visual studio
and it doesnt space up in discord
I recommend not trying to imitate it. On smaller screens such as phones it will look terrible.
I think it is better to just use fields
When you look at that message on mobile I think it will look like
Most popular
best deal
line under most popular
line under best deal
You can copy the top line you showed in the screenshot in the embed and see what charecters it is.
⠀i foudn out
about this invisible spacing ⠀⠀⠀ o
that's what they use i guess
bu thanks for trying to help tho appreciate it
!charinfo ⠀
\u2800 : BRAILLE PATTERN BLANK - ⠀
hm
i want to use slash command in dms
go for it 
can you give me a example code
slash commands by default work in dms
if they're declared as global
or do you mean in dms with other people?
?
what library are you using?
nextcord
https://github.com/nextcord/nextcord/blob/master/examples/application_commands/user_installed_command.py
You need the bot to be a user installed app to do that. Here is an example of the code. Note the integration_types and contexts arguments to the command decorator.
Oh yoink
Ping me if this implementation works
I’m gonna try tomorrow
You have to install (aka add) the app to your user as well.
024-12-06 00:23:01 ERROR discord.client Ignoring exception in on_message Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/discord/client.py", line 449, in _run_event await coro(*args, **kwargs) File "/cogs/events.py", line 527, in on_message if await self.message_checks(message): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/cogs/events.py", line 184, in message_checks elif message.reference.guild_id != message.guild.id: ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'guild_id'
# Check if the referenced message comes from a different guild
elif message.reference.guild_id != message.guild.id:
modlog_message = "Message is from another guild"
Aha
Not every message will have a reference?
most won't
elif message.reference and message.reference.guild_id != message.guild.id:
modal = PurchaseModal(category_id=self.category_id)
modal.view = self
Modal.timeout = None```
can i disable timeout like that?
Sure
Make sure to correct the variable name tho
But, you may not want to disable the timeout, since you cannot check whether the user has canceled the modal; thus, it will stay in memory until you stop it.
Oh that was from 6 hours ago lmao
@craggy anvil ^ if you still need it
Ye i dont and u cant remove timeout like that i guess anyways i was focusing on different timeout since i was really tired. I wanted to disable button timeou
hey folks, im using pycord cause slash commands but i have heard you can write slash commands with discord.py again ? just wondering if it worth the change over ?
Up to you which library you like more
oh well im used to pycord so im guessing best just to continue with it then
It's the same but with different implementation, but in my opinion creating application commands is easier in py-cord
pycord does not use tree.commands, it directly uses a decorator called slash_command
yeah its a bit easier, *even when i started and got confused between tree and slash *
For what it's worth, app commands is the actual terminology used by discord in their api docs. Context menus are also included in that command tree
how it feels to attempt to run this code on my (supposedly latest) version of next code and it doesn't have integration_types
Br these fucking symbols don't exist at all
this code is a Lie 💀
this whole code snippet is a lie
nextcord have played us for fools
looks like it is only on master branch right now
Nextcord 2.6.1 was released last year and the user app stuff was only added 3 months ago
mine is 2.6.0 and won't update lmfao
how are you installing it?
with pip
according to the github's installation tutorial
is there a specific branch i have to point to?
slash can i install the library from github lmfao
what command are you using?
py -3.9 -m pip install nextcord
pip install -U git+https://github.com/nextcord/nextcord will give you the master branch (sometimes called the development branch)
The master branch currently has breaking changes since it's a major version update (2 > 3)
Where should i show you?
where exactlty should i click
@fast osprey sory for the late reply
i do enable admin perms but i dont get a link
weird out put
async def clan(ctx,*arg):
if arg=="ls":
lsclans_embed=discord.Embed(title="clans",description="Banu Haqim Brujah Gangrel Hecata Lasombra Malkavian The Ministry Nosferatu Ravnos Salubri Toreador Tremere Tzimisce Ventrue .\n \n Clanless \n\n Caitiff Thin-blood ",color=discord.Color.blue())
await ctx.send(embed=lsclans_embed)
else:
await ctx.send(arg)```
I even tried change in to
If arg== "('ls',)":
And it didn't fix it and ideals
figured it out
async def clan(ctx,arg:str):
You also should never give bots admin, never, ...
I do enable admin perms...
if "ls" in arg because *arg is tuple
do list is good more
arg = list(arg)
In this case there is not much reason to change the tuple to a list. Ideally you should not be modifying the args so a tuple is fine.
Also while you are correct in your answer I think the solution they found themselves is a better one as it does not look like they know what *args means and were probably only want 1 argument.
if you guys were starting over learning discord bots where would u start any websites or videos would be great
The official docs for whatever library you choose and that's it
so something like this
that’s what i’ve been using so far
just trying to understand allat
yup
Hi
hey i dont know much about coding
i was given a src to a bot that i want in my server but when i run the bot it gives me this code.
i can send the src if it will help.
yea always do that when sending errors
hey does anyone have achess bot
ye i just need to figure out how to fix this
can I ask why would you chose a chess bot over the chess activity?
because im too lazy to get good
I have no idea how skill is related to the interface of chess
Can anyone help me run figure out whats wrong with this discord bot?
Any particular reason why the person who wrote it can't fix it? Depending on your skill level, its going to be hard for you to understand and maintain this
I assume self is missing from the function
Idk how pycord processes it
Also "check stocks of nitro tokens .." sounds very sus and not like a chess bot lmao
two different people, but yeah storing tokens is definitely sus
oh whoops
guys, how do i retrieve contents from coded embed
like, an embed that you created back before?
i wanna retrieve content from the description
Message.embeds will have a list of embeds
you can then use the attributes of embeds to get the correct fields
If you're trying to use logic based off a message, you're probably vastly better off putting this in a database rather than trying to scrape it off a message
what is my typo? cuz all but all is working so it has to be a typo
thin_blood_all_embed=discord.Embed(title="thin_blood",description=thin_blood_Info+"\n \n"+thin_blood_Disciplines+"\n \n" +thin_blood_Bane+"\n \n"+thin_blood_Compulsion,color=discord.Color.blue())
await ctx.send(embed=thin_blood_all_embed)
elif (arg2=="info")or(arg2=="i"):
thin_blood_embed=discord.Embed(title="thin_blood",description=thin_blood_Info,color=discord.Color.blue())
await ctx.send(embed=thin_blood_embed)
elif (arg2=="disciplines") or(arg2=="d"):
thin_blood_Disciplines_embed=discord.Embed(title="thin_blood Disciplines",description=thin_blood_Disciplines,color=discord.Color.blue())
await ctx.send(embed=thin_blood_Disciplines_embed)
elif (arg2=="bane") or(arg2=="b"):
thin_blood_Bane_embed=discord.Embed(title="thin_blood Bane",description=thin_blood_Bane,color=discord.Color.blue())
await ctx.send(embed=thin_blood_Bane_embed)
elif (arg2=="compulsion") or(arg2=="c"):
thin_blood_Compulsion_embed=discord.Embed(title="thin_blood compulsion",description=thin_blood_Compulsion,color=discord.Color.blue())
await ctx.send(embed=thin_blood_Compulsion_embed)```
here the error but it looks fine
await ctx.send(embed=thin_blood_all_embed)```
That's not the error. That's one small part of it
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
~~~~^~~
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
I dont know what library you use but this is how you do it in pycord and it may be similar in other libraries
https://docs.pycord.dev/en/stable/api/models.html#discord.TextChannel.create_thread If you just dont pass a message or type it will be a private thread.
Then with a Thread object you can archive and set the locked argument to true
Same for dpy
You don't, if it's private the people in the thread deserve to be alerted that someone has been added to it. Why are you adding people to locked threads anyways?
I dont have it set up, but can you delete that message? If you can than just delete the message, otherwise discord has blocked it
Is it a private thread?
There are multiple ways people could be "added". Is their name showing up explicitly on the members list of the thread without there being a message? Also, is this just a vanity thing or is there a need to not inform people of who is on the thread?
It depends precisely what you mean by added. There is a visible list of people who have commented on the thread or been added directly, but that is not all of the people who could see that thread, read its messages, and join themselves if that's what you mean
Is that what this other bot does?
Skeptical. There's not like a magical option when adding someone to a thread to decide not to announce it afaik
Either they're not being added directly (inheriting perms to see it), you are lacking the perms to see the message history of them being added, or the bot is actively removing those messages
A thread creating using a message cannot be a private thread as far as I am aware
There's that, too. Spawning a thread off a message makes it public
Threads inherit permissions from the channel they're in
A thread in a "private" channel is not itself automatically "private", in as far as the setting on the thread is concerned
You probably shouldn't be spawning channels for individual folks in the first place IMO
And just have private threads in a public channel
does it ping the members, I think this automatically adds them to the thread
If it's spawned off a message, it's not a private thread. Anyone who can see that channel can see the thread, regardless if they're added to it or not (either by someone/bot or by sending a message in it themselves)
So if it's a public thread, you have no need to add people to it at all as they can already see it. Pinging them will bring their attention to it, but just adding them doesn't really accomplish anything in that scenario
I'm personally suggesting you don't do this, have a single public channel and make private threads in it. But however you want to architect this is up to you
- private/public is a true/false flag on each individual thread
- if it is public, then everyone who can read messages on the parent channel can see that thread. Adding people to the thread doesn't really do anything. threads spawned off of a message must be public.
- if it is private, only people who are added to the thread (and can see the channel) OR people with
manage_threadspermission on the parent channel can see that thread. You may choose to make a thread private when creating it on a channel and not on a specific message
Is there any way to have forum posts be private to only mods? If only I could use the forum feature as a ticket system.
No, if users can create/see any forum post they can see all of them
Dang
Your token is not valid
Go back to the discord dev website and get a new token for your bot
That has absolutely nothing to do with discord bots
Ask off topic questions in #1035199133436354600
is there a way to make app commands DM only

