mentioning users with commands
One of my uses for the starboard bot is on results of slash command used by other users. However when the messages show in the starboard, it mentions the bot instead of the user who used the command. It's there any way to change this?
I am hosting the bot myself, but I have minimal experience with the discord API and barely enough experience with rust to stub out premium checks.
Also, is there a way to restrict usage of the bot to specific users? I searched this server and found mention of blocking users from using commands entirely in a server, but I can't do this because we've got other bots...
20 Replies
For your first question, I'm not really sure what you mean. Maybe a screenshot would help?
For the second, you can use discord's command permissions to lock commands to certain roles.


Ah. Discord must have either added that recently or not added it on mobile yet. I don't use desktop client much, but I'll check. 👍
As for the first question:
Using a command:

Message gets starred, is associated with the bot, not with myself:

The bot is at the top of the leaderboard, because ~3/4 of messages that would be starred are responses from the bot

ah, gotcha
Since you're hosting the bot, I can give you instructions to modify the code, but I can't help much beyond that
assuming it's simple; give me a second to check
@Efreak how comfortable are you with rust?
Not very, unfortunately. I can stub things out. Also, I think the project might not complete with current rust binaries, though I might be thinking of a different discord bot
no that's this bot, I remember you opened an issue for it
I don't really feel up to modifying the bot right now, and to make the changes you want would require a moderate amount of work (even with a hacky solution). And there's not a solution to this problem with the current bot either
Sorry
I can still provide the steps if you'd like though, but it would require some rust knowledge
Would appreciate it. If I can't do it, hopefully someone else is interested. If there's something I can do inline, I might be able to do that, as long as there's populated data structures. But I'm not even that familiar with rust syntax lol.
IIRC in the js API there's just a different property to check for the message's command user instead of the message author
k, well, here's a hacky solution that should be simple enough (and should work)
Basically, you want to replace the author of the
CachedMessage
to be the user who invoked the command, rather than the bot user. So mayb esomething like
link
This solution will basically replace the author of every bot message with the person who invoked the command; If you want to limit it to the one bot, you can add a check for the author ID
This is a lot simpler than I expected it to be lol
also, you'll have to fix the compile issue. Try just running cargo update
, see if that fixes the compilation problem
(and feel free to ping me if you have problems)Building is so slow on my underpowered vps 😢
Hah, yeah I bet
... It's doing lto, that's why it's taking so long 🤦
lto?
Link time optimization
Ah
If it's not something you have set up with rust, then it's either a release default or one of my environment variables
I build everything with add much optimization as I can, my server has one vcpu and the tradeoff on some software has been worth it, while for simpler programs the build time increase is negligible
Yeah. For rust, the difference between debug and release is massive by default
Wrong reply lol
And then I've got half a dozen node things running too 😡
I used to run a steam bot, and I'd run six of them under the same process for less heap overhead, but the stuff I'm running now isn't multiple instances of the same thing anymore
Now I just need to backup my database for the bot so someone else can host if necessary
I've verified that this works as intended, if you have any thoughts of adding it to the main bot (or gating it behind a feature/config setting). I didn't bother to clear my database, but the bot hasn't gained any XP since then (the mentions are correct as well)
awesome, glad it worked