#discord-bots

1 messages · Page 395 of 1

umbral halo
#

hi can anyone have discord bot who have ban,unban? if yes ping me (of course with code)

#

and when ban dm guy who get banned

scarlet tiger
scarlet tiger
open cobalt
#

guys, how you handle errors with nextcord api?

open cobalt
#

are you guys using try except or on_error or what? Please with example

scarlet tiger
scarlet tiger
open cobalt
#

ok, sounds good

wispy falcon
#

any free bot hosting service

umbral halo
#

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.

fast osprey
#

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

umbral halo
wispy falcon
wispy falcon
open cobalt
#

please guys, dont use free hosting I guess

#

It has always a catch

wispy falcon
open cobalt
wispy falcon
scarlet tiger
unkempt canyonBOT
#
Discord Bot 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.

umbral halo
open cobalt
#

vex, you can get a vps for really cheap

umbral halo
wispy falcon
umbral halo
wispy falcon
#

got that $

umbral halo
#

send you that hosting?

wispy falcon
#

yeah

open cobalt
#

you must pay one time installation fee probably

#

@wispy falcon

#

please use the links nightmare has sent to you

umbral halo
unkempt canyonBOT
#
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.

open cobalt
#

@scarlet tiger do you have any discord robots online?

open cobalt
scarlet tiger
open cobalt
#

affordable?

scarlet tiger
plush thistle
#

I want make a discord bot and want to learn how to code

scarlet tiger
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

wispy falcon
fast osprey
#

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

slate swan
#

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

fast osprey
#

(Hint: they're selling your data or trying to farm your token)

slate swan
#

then they want to have it 24/7 and they wonder why they gotta pay

wispy falcon
open cobalt
#

@wispy falcon when it says lets say 3 euros monthly you must also pay a one time installation fee of lets say 30 euros

slate swan
#

it's like a second pc, so it obviously won't be free

slate swan
#

installation fees are a joke imo but yeah

wanton current
#

or just get a vps without an installation fee

slate swan
#

whoever charges you installation fees, don't get it 👍

scarlet tiger
open cobalt
#

yeah but your computer must be 24/7 on then

wispy falcon
scarlet tiger
slate swan
#

not everything, but at least the bare minim of research would be something ideal

wispy falcon
#

ok

slate swan
#

jeez people get upset pretty fast in 2024

wispy falcon
#

im not upset

#

youre buggin

slate swan
#

your edited message clearly showed you are

wispy falcon
slate swan
#

upset

open cobalt
#

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

slate swan
#

honestly electricity fees probably aren't that high for a rpi running 24/7

wispy falcon
slate swan
#

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

stark ingot
scarlet tiger
#

But on a VPS you don't have the responsibility of hardware maintenance.

slate swan
#

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

stark ingot
#

Hardware maintenance includes protecting against power outage downtime and such

#

As well as internet downtime

scarlet tiger
wispy falcon
umbral halo
wanton cosmos
#

huh

#

im finding a working ltc sender function do anyone have?

uneven trail
#

can you elaborate on what you want, you're a bit vague

timber dragon
#

Time to buy some ltc since people are apparently making discord bots to auto buy

hearty sentinel
#

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.

sand imp
fast osprey
#

Also bots aren't given access to the search endpoint

wispy falcon
#

any ideas what kind of discord bot to make?

fast osprey
#

Depends entirely what your goals are

wispy falcon
broken sail
#

i dont know how to get the bot up and running

#

@sand imp

sand imp
broken sail
#

my bot

#

do you work on discord bots

#

@sand imp

open cobalt
#

hey guys

sand imp
broken sail
#

im tryna get it running

#

@sand imp

#

can we get in a call

broken sail
#

so we can get into a call

white plume
#

im working on a somewhat simple discord bot but im pretty noob - is anyone available to review the code and make suggestions ?

slate swan
white plume
#

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.

https://paste.pythondiscord.com/KMOQ

slate swan
#

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

white plume
#

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.

slate swan
#

Have you synced the command tree after creating the command?

white plume
#

this is what im using

slate swan
slate swan
smoky lava
#

!res

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

stark locust
#

how to fix such logic error

#

is this common?

#

emojis come up as :venmo: for eg

fast osprey
#

Are you facilitating money transfers for a fee?

stark locust
#

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:

fast osprey
#

That is against the discord monetization policy

stark ingot
stark ingot
fast osprey
#

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

broken sail
#

help

#

ctx and embedd dont work

fast osprey
#

You've mixed up indents in your code

broken sail
#

what that mean

fast osprey
#

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)

slate swan
#

!indents

unkempt canyonBOT
#
Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

tldr ^

open cobalt
# broken sail help

Hey it seems like the spaces are not correct. Pls be sure that your instructions are inside the func help

slim bloom
#

WHAT THE SIGMA

tough lichen
#

does anyone have a source code for a working modmail

plush thistle
#

i am occuring an issue in hoisting bot on pannel

slate swan
viscid hornet
velvet compass
#

Your post has been removed for violating rules 9 and 6

wispy falcon
#

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

fast osprey
#

Generally that's a sign you should be using a listener and not an event override

young dagger
open cobalt
#

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=

wanton current
#

Usually, it's recommended to subclass View instead of creating, and adding items like this ^^

open cobalt
wanton current
#

Yes

open cobalt
# wanton current Yes

do you usually make a button with the decorator inside TestView or a seperate class subclassing button?

wanton current
#

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

mint pecan
#

what place is the best to write dev commands such as sync command? a cog?

sick birch
#

and excluding it from help commands

broken sail
#

why dont this work

sick birch
broken sail
#

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

sick birch
#

!d discord.TextChannel.create_invite

unkempt canyonBOT
#

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.
sick birch
#

assuming channel is an instance of TextChannel: invite = await channel.create_invite()

broken sail
#

do i put tha under the command text

broken sail
sick birch
#

but i can point you towards documentation and help you understand

broken sail
#

yes

sick birch
# broken sail plz do

i did. see the above embed for the create_invite function which will generate an invite

broken sail
#

@sick birch

#

can we get in a discord call @sick birch

sick birch
#

no

broken sail
#

How do i do this

sick birch
broken sail
#

@sick birch

#

it say channel is not defined in problems

sick birch
broken sail
#

what

#

does that mean

broken sail
#

im slow when it come to coding

sick birch
broken sail
#

do you want the link

#

do i send the link

#

or id

#

@sick birch

sick birch
# broken sail do you want the link

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?

broken sail
#

a text channel

#

i wanna send the command in any channel

#

so it gets them to this channel

#

@sick birch

sick birch
broken sail
#

yes

#

always to the same channel

sick birch
#

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)
broken sail
#

@sick birch

sick birch
broken sail
#

thinks youuu

#

thank youuu]

spring flax
#

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

slate swan
open cobalt
#

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.

open cobalt
#

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

quick gust
#

in my opinion, it's not useful to make another ban or kick command when discord is literally providing you a better one

open cobalt
#

finallyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

fast osprey
#

Wrapping existing functionality is not only useless, it's actively harmful as it removes security features

open cobalt
#

So guys, we have the answer now and it is a clear answer!

fast osprey
#

People will disagree but people also like writing a two line command as an easy win to seem useful despite harming servers

open cobalt
#

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?

blissful crane
#

it's the answer to the trivia question

open cobalt
#

ok, what is this for a video game, need to google it

#

I think that might be a hard one. What yall think?

slate swan
#

!d discord.Invite

unkempt canyonBOT
#

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...
fast osprey
#

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

fast osprey
#

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

teal delta
#

He wants to learn

#

I’m not sure if his application will last long but ye

fast osprey
#

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

vapid parcel
#

Anyone know how to set a buttons style based on a value?

brazen tapir
vapid parcel
#

Not what I meant, but I found a solution.

upbeat mason
upbeat mason
#

hows ur bot

vapid parcel
#

Started a new team.

upbeat mason
#

nice

#

i tbh didnt think it'd go on for this long

vapid parcel
#

Why is that? 😭

#

Kox is still doing Combat masters GoofySkull

upbeat mason
#

bruh no way

#

i forgot about him

vapid parcel
#

Bro remembered me? 😭

upbeat mason
#

me?

vapid parcel
upbeat mason
#

or him

vapid parcel
#

You remembering me

upbeat mason
#

yeah id o

vapid parcel
upbeat mason
#

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

vapid parcel
#

Real

upbeat mason
# vapid parcel Real

question do you know any good normal but not some "ai realistic human" shit text to voice websites or engines?

vapid parcel
#

Google TTS?

#

or you asking sum else?

#

Google TTS might be to AI though, I have no clue

upbeat mason
#

google tts isnt that good really

upbeat mason
#

just a snippet of some video

vapid parcel
#

Nah ion

upbeat mason
#

oof alr

vapid parcel
#

Im just a website n bot developer 😭

upbeat mason
#

yeah ik

vapid parcel
#

Yeah, sorry pimp

fast osprey
#

!d discord.Role.members

unkempt canyonBOT
open cobalt
#

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

fast osprey
#

If you want to make money, do something else

open cobalt
#

It is a general question

#

No intention to make money etc

fast osprey
#

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

open cobalt
#

exactly I agree

fast osprey
#

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

open cobalt
#

have a look on a discord bot list and you see thousand of them

fast osprey
#

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"

open cobalt
#

There some people who make a discord bot for their one dc server which has its advantages and disadvantages

fast osprey
#

Yeah custom things, fully understand that especially if it has elevated permissions

stark ingot
#

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

fast osprey
#

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

slate swan
#

what steps do i need to take in order to make cooldowns like this

shrewd apex
open cobalt
#

Just included gemini ai into my dc robot, how creative. omg I am now ai expert hohohohohoho

#

solsticeshard it was meant sarcastic

shrewd apex
#

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.

slate swan
#

this is for a singular / command 😭

shrewd apex
#

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)

slate swan
shrewd apex
slate swan
#

This file only produces one command.

#

Which is a /setup command

shrewd apex
shrewd apex
shrewd apex
slate swan
#

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.

shrewd apex
#

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

slate swan
shrewd apex
#

its to make sure ur 18 or legal age afaik

slate swan
shrewd apex
#

u mean commands restricted to a specific set of servers?

slate swan
#

i know it's just bot user id but yeah

shrewd apex
#
@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

open cobalt
#

do you use a relational or no relational database and which one?

#

ok, so relational

shrewd apex
open cobalt
shrewd apex
#

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

open cobalt
#

I am only familiar with pymongo

#

mongodb

shrewd apex
#

almost all sql databases are like this few might have arrays like pgsql but most maps are usually stringifed

shrewd apex
# open cobalt mongodb

yep so thats a document based db, non relational, altho u can like embed documents in a document

open cobalt
#

but has its disadvantage

shrewd apex
#

yep both have its pros and cons

#

and particular use case

open cobalt
shrewd apex
#

discord started of with mongodb lol, then they switched to cassandra now finally then are using scylladb

slate swan
#

What language do you not understand @shrewd apex

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

open cobalt
shrewd apex
#

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

shrewd apex
slate swan
#

Yeah, do you know if DiscordRb has been updated recently?

shrewd apex
#

discord ruby?

slate swan
#

Just looked at the github page, untouched since July 2023, but has some updates since then

shrewd apex
slate swan
#

It's alright but it's just not maintained like DiscordPy or DiscordJs

shrewd apex
#

last release of artifacts or build was on 2023

slate swan
#

Yeah.

shrewd apex
#

hmm yeah the gem build also says 2023

#

so i think latest stuff like polls etc are prolly missing

slate swan
shrewd apex
#

yikes

slate swan
stark ingot
#

Well this server will almost always recommend python. But for discord bots you should use the language you know best.

shrewd apex
#

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

shrewd apex
fast osprey
#

Eh. They've done some questionable stuff in the past

shrewd apex
#

yeah u need to perform localizations (happens before command syncing)

#

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

stark ingot
eternal walrus
#

hi

fast osprey
#

They would unfairly list libraries as missing features when those features weren't stable or documented

stark ingot
#

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

slate swan
open cobalt
#

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.

fast osprey
#

Need to make the view have a reference to the message you want to edit

open cobalt
fast osprey
#

sounds right

rose narwhal
#

is there any way to track if a channel is inactive or not using discord.py?

fast osprey
#

Well depends on how you define "inactive"

open cobalt
#

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

fast osprey
#

Never heard of them, though a cursory google search yields some questionable interactions. Use at your risk I guess

open cobalt
fast osprey
#

Yes, just run a Google search for reviews and come to your own conclusions

open cobalt
#

guys, implemented gemini to my discord bot for fun. I am now a certified AI expert and can now create my own model hihihihihii

rose narwhal
#

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

fast osprey
#

I recommend you don't use this check in code

#

slash commands have a native ui for limiting commands

rose narwhal
#

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

rose narwhal
fast osprey
#

guilds settings -> integrations

#

you can limit commands per role

slate swan
#

no need to spoonfeed me just tell how to go about making it

fast osprey
#

what are you having trouble with, which part?

slate swan
#

previous attempts the url part didn’t work

fast osprey
#

Gonna have to be more specific than that

#

what is the code you have, and what in it isn't working?

hot gorge
#

I tried adding my bot to my server and it said this

fast osprey
#

What url are you hitting? Where are you getting it from?

hot gorge
# fast osprey 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

shell adder
#

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

sleek cedar
#

Is there a way to make a slash command prefilled by a link?

hot gorge
slate swan
#

but hey is there a way i can have attachment option as well as url option is the slash version of my hybrid commands

fast osprey
#

sure yeah

slate swan
#

how

fast osprey
#

I mean make two parameters, one a string and one an attachment?

shell adder
#

did you make it a bot user yet?

hot gorge
hot gorge
shell adder
#

go thwre

#

and fill out the forms

honest quest
#

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?

midnight oracle
honest quest
hot gorge
#

does anyone else know the fix

#

im trying to add my own bot but its not letting me

fast osprey
#

How are you getting this url

shell adder
#

@hot gorge turn off requires oauth2

#

then reinvite it

hot gorge
fast osprey
#

Can you show that along with the other settings you have there?

shell adder
fast osprey
#

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)

slate swan
merry magnet
merry cliff
severe spire
#

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 🙂

fast osprey
#

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

severe spire
#

I don't know how socially engaged you are. But people these days:

  1. They don't share ideas
  2. They don't know what a "bot" can do. And as we know, it can do a lot.
  3. 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.

fast osprey
#

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.

shrewd apex
#

depends on your audience of your server too

merry magnet
merry magnet
#

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.

fast osprey
#

What's your code now? Are you trying to make native / commands?

polar plinth
#
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?
fast osprey
#

are you positive that this is the code you're running, and that you've saved this?

open cobalt
#

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?

fast osprey
#

Looks fine, I don't really have opinions on ux

open cobalt
fast osprey
#

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

open cobalt
#

😭

timber dragon
#

And maybe add some matching emojis for the conditions

open cobalt
plush thistle
#

i want to make music bot

#

but i am not able to make

slate swan
#

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

honest quest
#

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

fast osprey
#

Code?

honest quest
# fast osprey 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

fast osprey
#

If you're syncing slash commands during startup, you probably shouldn't be

honest quest
#

I normally just hvae to resync my bot eachtime I add a new function/feature onto it

fast osprey
#

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

teal delta
#

Speaking of which, for my sync command, does it have to be an app command or prefix command?

dusty niche
#

Anyone here professional devloper who's now about Netflix and python language want to one bot

dusty niche
#

@teal delta dm

honest quest
slate swan
#

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>

fast osprey
#

What do you think bot=False is trying to do here

fast osprey
slate swan
fast osprey
#

yeah those are against tos

slate swan
fast osprey
slate swan
fast osprey
#

We don't help with TOS breaking projects, it's in the rules

scarlet tiger
unkempt canyonBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

karmic stream
orchid swallow
#

which didnt had intent shi

robust surge
#

i just installed it and double checked by installing it again whys it say this

orchid swallow
fiery girder
still wigeon
#

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

timber dragon
#

Yeah not possible with dpy's app commands

fast osprey
#

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

timber dragon
#

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.

shrewd apex
#

sounds like on_message but for app commands 💀

fast osprey
#

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

stark ingot
stark ingot
left wing
#

where does one find clients who want a discord bot made for them

left wing
#

can a newb still make it in those markets

slate swan
#

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

slate swan
#

how to make a command that does this? put my avatar in a toaster gif like this? im stuckk

fast osprey
#

What are you stuck on specifically

slate swan
fast osprey
#

To do what?

slate swan
fast osprey
#

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

sudden lichen
#

Bc latest version is not optimised for discord.py, you need 1.11 or 1.10 for it

slate swan
#

python 1.x??????

sudden lichen
#

Srry mb

#

3.11 or 3.10

slate swan
#

3.12 is fine

sudden lichen
#

Yea but best optimised are this two

slate swan
#

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

sudden lichen
#

Yea that's true

#

I told that in another way

#

Lol

merry magnet
#
@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

slate swan
#

!d discord.Embed.add_field

unkempt canyonBOT
#

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.
slate swan
#

There's no text kwarg

merry magnet
#

so just use the string ?

slate swan
sinful galleon
timber dragon
merry magnet
#

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

merry magnet
#

i change it to pie and add @bot.commad() and it works

#

i removed @bot.command() cuz it was throwing and error

fast osprey
#

how does you typing .pie at all relate to the code you sent? what

slate swan
#

What i thought

rapid python
#

Do anyone know how can I host my bot for free?

#

Discord bot

#

Tb specific

slate swan
#

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

fast osprey
#

!hosting

unkempt canyonBOT
#
Discord Bot 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.

orchid swallow
#

.pie

#

.hello

#

.hel

slate swan
#

use #bot-commands for random commands

open cobalt
#

guys please stay away from free hosting. They can, I assume, steal the bot token perhaps

slate swan
#

just like paid hosting can

#

if they do however, their reputation is ruined - paid or free doesn't matter

slate swan
timber dragon
#

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

slate swan
#

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.

slate swan
open cobalt
#

is this true? never used aws or that

slate swan
timber dragon
#

Til

shrewd apex
slate swan
shrewd apex
#

yeah true

slate swan
#

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.

shrewd apex
#

yeah hetzner is good their arm services are pretty affordable

broken sail
#

help

feral carbon
#

@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

slate swan
unkempt canyonBOT
#
Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

feral carbon
#
@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(***********)```
broken sail
#

@feral carbon it dont let me @ no one

#

and show theyre avatar

feral carbon
#

What do you mean?

stark ingot
#

Discord.member should have a capital M in member

slate swan
#

discord.member != discord.Member

feral carbon
#

yup

#

my bad

broken sail
#

still dont work

feral carbon
#

What error do you get?

broken sail
#

made it a cap

fast osprey
#

Not all people have avatars

broken sail
#

oh so they have to have a avatar

#

not just a default one

fast osprey
#

the default one isn't one

slate swan
#

!d discord.Member.avatar

unkempt canyonBOT
#

property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar)
slate swan
#

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

feral carbon
#

You can add a try / except clause so that if you raise that exception you do a different embed without the image

fast osprey
#

See also

#

!d discord.Member.display_avatar

unkempt canyonBOT
#

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\.
broken sail
#

where do i put that into the code

young dagger
#

You want to use discord.Member.display_avatar

broken sail
#

this

fast osprey
#

look at where the error is telling you the problem is

broken sail
#

someone fix the code

fast osprey
#

That someone is you

#

this is your code

young dagger
#

What do you exactly want to do?

young dagger
#

Wait what is wrong with the existing code?

fast osprey
#

Don't copy paste code you don't understand. Especially not from a youtube video

young dagger
#

Are you trying to fetch a user or Discord member?

broken sail
#

yes

#

theyre av

slate swan
#

It's a choice question, not a yes or no

broken sail
#

can yall join vc 1

young dagger
#

Do you want to grab an avatar from a guild member or any user?

broken sail
#

user from my server

#

@young dagger can we get into a vc

young dagger
#

Sorry I can't atm

young dagger
timber dragon
#
- 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

broken sail
#

where i set that in the code

timber dragon
#

Read your code

young dagger
#

After creating the embed

broken sail
young dagger
#

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

raven bolt
#

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.")
timber dragon
#

Definitely not possible

#

That bot probably sends the ip as a separate message for mobile users to easily copy idk

winged bridge
#

thx

hasty pike
# broken sail

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)
slate swan
#

Double =

slate swan
#

how can i make the bot status the mobile icon

fast osprey
#

This is not supported by discord

slate swan
#

i saw some bots doing it

fast osprey
#

People doing it does not mean it's supported

#

it's an exploit and discord does not want you doing it

open cobalt
#

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?

fast osprey
#

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.

open cobalt
fast osprey
#

Yes precisely

open cobalt
#

mhh makes sense never thought of that

raven bolt
#

Learnt this the hard way

cold flicker
#

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

fast osprey
#

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

dapper cobalt
# cold flicker is there a way i can show my site the bot status like "online" offline and stuff...

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

vapid parcel
#

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..?

fast osprey
#

You may be operating under a different definition of "legit"

cold flicker
stark ingot
#

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

fast osprey
#

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

teal delta
#

I hope I made the right decision

#

I'm not sure if I'll even need the presence intent too

raven bolt
#

i'm waiting on itto register

tulip sand
#

WARNING discord.gateway Shard ID None heartbeat blocked for more than 10 seconds.

what exactly is this ?

fast osprey
#

You have blocking synchronous code that is prevention the bot from staying connected

tulip sand
#

how could i synchronize them ?

fast osprey
#

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.

tulip sand
stark ingot
#

Can you send the full traceback?
Also isnt the twitter API very expensive? Nvm there is a free tier that fits your needs

fast osprey
#

Your error should come with a traceback, otherwise you have no idea where it's happening

vapid parcel
#

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.

vapid parcel
#

Just curious, why is that not allowed by discord? Why is discord against it?

vapid parcel
fast osprey
#

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

sick birch
#

^ yeah the mobile status is pretty much useless

vapid parcel
vapid parcel
fast osprey
# vapid parcel Idk, maybe I am. I am just wanting to understand discords standards maybe..?

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

quick gust
#

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.

fast osprey
#

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

quick gust
#

okay but how do I go about doing that for the 50+ reviews that the people have already listed?

quick gust
fast osprey
#

You don't shrug . 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

quick gust
#

mm alright thanks

tulip sand
fast osprey
#

Your app is eating it then

tulip sand
#

i will try to submit the code today

fast osprey
#

Which is the first thing to fix

tulip sand
#

it gives the too many requests error as soon as i run the code which from my understanding i failed to limit it

fast osprey
#

Not necessarily

#

But until you get a traceback you're just guessing

open cobalt
#

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

slate swan
#

pretty much what the faq tells you to use

#

so nothing to change

open cobalt
#

ok perfect

wheat summit
#

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)```

wheat summit
fast osprey
#

dpy requires you to sync your commands to discord. It doesn't do that for you

karmic trellis
fast osprey
#

call .sync() on your command tree. preferably in some process you initiate manually, not automatically

wheat summit
fast osprey
#

(such as a gated prefix command)

fast osprey
open cobalt
#

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

sick birch
#

it's common to abstract API calls behind methods so it's easier to read from caller functions

wheat summit
wheat summit
#

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?

fast osprey
#

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)

wintry moon
#

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>

wheat summit
fast osprey
#

Because you're naming your interaction parameter "ctx"

fast osprey
#

Slash commands don't get a context so this naming is misleading

wheat summit
fast osprey
wheat summit
fast osprey
#

Specify what guild in what context?

wheat summit
fast osprey
#

For what purpose

wheat summit
#

So that I can put the member option.

fast osprey
#

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)

wheat summit
wheat summit
fast osprey
#

Unless you mean something else by reply

wheat summit
fast osprey
#

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

young dagger
#

Is there any way to detect forwarded messages from other guilds?

young dagger
#

When is version 2.5 coming out?

unkempt canyonBOT
fast osprey
#

when they're done with it

slate swan
#

probably soon tbh

young dagger
#

What is the different between discord.MessageReferenceType.forward and discord.MessageFlags.forwarded?

tulip sand
#

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)```
slate swan
fast osprey
#

Secondly, you are relying on message content without requesting the message_content intent

stark ingot
#

^
messages != message_content

young dagger
slate swan
#

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

young dagger
#

Gotcha. Do you know if it would be possible to check if the message was forwarded from another guild?

slate swan
#

That's in the discord.Message.reference - reference.guild_id to be precise

slate swan
#

And you're not using the commands extension

young dagger
craggy anvil
#

how did this guy make such spaces between first 4

#

these are not fields because spaces between fields are much smaller

stark ingot
#

Is it just spaces or tabs?

craggy anvil
#

the thing is i tried doing spaces in visual studio

#

and it doesnt space up in discord

stark ingot
#

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

craggy anvil
#

but these are not fields

#

i wont use fields bc they look horrible

stark ingot
#

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.

craggy anvil
#

⠀i foudn out

#

about this invisible spacing ⠀⠀⠀ o

#

that's what they use i guess

#

bu thanks for trying to help tho appreciate it

stark ingot
#

!charinfo ⠀

unkempt canyonBOT
craggy anvil
#

hm

polar thistle
#

i want to use slash command in dms

fast osprey
#

go for it prettythumbsup

polar thistle
fast osprey
#

slash commands by default work in dms

#

if they're declared as global

#

or do you mean in dms with other people?

polar thistle
fast osprey
#

?

stark ingot
#

what library are you using?

polar thistle
stark ingot
raven bolt
#

It’s this again

#

I also have this issue, nothing I tried worked

raven bolt
#

Ping me if this implementation works

#

I’m gonna try tomorrow

stark ingot
#

You have to install (aka add) the app to your user as well.

young dagger
#

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?

fast osprey
#

most won't

young dagger
#
elif message.reference and message.reference.guild_id != message.guild.id:
craggy anvil
#
modal = PurchaseModal(category_id=self.category_id)
        modal.view = self
        Modal.timeout = None```

can i disable timeout like that?
timber dragon
#

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

craggy anvil
frank osprey
#

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 ?

fast osprey
#

Up to you which library you like more

frank osprey
#

oh well im used to pycord so im guessing best just to continue with it then

scarlet tiger
#

pycord does not use tree.commands, it directly uses a decorator called slash_command

frank osprey
#

yeah its a bit easier, *even when i started and got confused between tree and slash *

fast osprey
#

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

raven bolt
#

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

stark ingot
raven bolt
stark ingot
#

how are you installing it?

raven bolt
#

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

stark ingot
#

what command are you using?

raven bolt
#

py -3.9 -m pip install nextcord

stark ingot
#

pip install -U git+https://github.com/nextcord/nextcord will give you the master branch (sometimes called the development branch)

timber dragon
#

The master branch currently has breaking changes since it's a major version update (2 > 3)

hot gorge
#

where exactlty should i click

#

@fast osprey sory for the late reply

#

i do enable admin perms but i dont get a link

merry magnet
#

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):

fast osprey
sterile inlet
#

do list is good more
arg = list(arg)

stark ingot
#

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.

frail coyote
#

if you guys were starting over learning discord bots where would u start any websites or videos would be great

fast osprey
#

The official docs for whatever library you choose and that's it

frail coyote
#

so something like this

#

that’s what i’ve been using so far

#

just trying to understand allat

fast osprey
#

yup

hoary shore
#

Hi

sharp oxide
#

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.

shadow vigil
quasi bramble
#

hey does anyone have achess bot

sharp oxide
#

ye i just need to figure out how to fix this

shadow vigil
quasi bramble
#

because im too lazy to get good

shadow vigil
#

I have no idea how skill is related to the interface of chess

quasi bramble
#

huh

#

i just asked for a chess bot

sharp oxide
#

Can anyone help me run figure out whats wrong with this discord bot?

fast osprey
#

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

timber dragon
#

Also "check stocks of nitro tokens .." sounds very sus and not like a chess bot lmao

fast osprey
#

two different people, but yeah storing tokens is definitely sus

timber dragon
#

oh whoops

severe sonnet
#

guys, how do i retrieve contents from coded embed

#

like, an embed that you created back before?

#

i wanna retrieve content from the description

stark ingot
#

Message.embeds will have a list of embeds

#

you can then use the attributes of embeds to get the correct fields

fast osprey
#

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

merry magnet
#

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)```
slate swan
#

!traceback

unkempt canyonBOT
#
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.

stark ingot
timber dragon
#

Same for dpy

fast osprey
#

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?

stark ingot
#

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

stark ingot
#

Is it a private thread?

fast osprey
#

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

stark ingot
#

A thread creating using a message cannot be a private thread as far as I am aware

fast osprey
#

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

stark ingot
#

does it ping the members, I think this automatically adds them to the thread

fast osprey
#

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_threads permission 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
sleek cedar
#

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.

stark ingot
#

No, if users can create/see any forum post they can see all of them

sleek cedar
#

Dang

feral carbon
#

Your token is not valid

#

Go back to the discord dev website and get a new token for your bot

slate swan
#

That has absolutely nothing to do with discord bots

finite salmon
#

is there a way to make app commands DM only