#GitHub issue 886

1 messages · Page 1 of 1 (latest)

wintry sorrel
#

I have been working on making the /tags entries clickable, but I ran into a problem that I am not able to find a way how to include the id option.

frank oysterBOT
#

Helper please have a look, thanks.

#

Changed the category to Together Java Bot.

#

<@&987246924425994290> please have a look, thanks.

wintry sorrel
#

I can just mention the /tag command in the answer like this.

normal gyro
#

/tag id:++

#

it should be smth like that

#

where ++ is the id

wintry sorrel
#

but how do I use that in the syntax <tag: 1151517199920537669> ?

normal gyro
#

how do you currently make the /tag reference in the code?

wintry sorrel
#

There is a method called mentionGlobalSlashCommand in MessageUtils

normal gyro
#

show me your code

wintry sorrel
#

it returns me the syntax <tag_name: tag_id> that makes it clickable

normal gyro
#

it got another parameter

#

you can use

#
public static RestAction<String> mentionGuildSlashCommand(
  Guild guild, String commandName, String... subCommands) {
#

but I am not sure if subCommands is for parameters

#

let me check the code

wintry sorrel
normal gyro
#

try it out ig

#
mentionGuildSlashCommand(..., "tag", "id: ++")
#

worth a try

#

or just:

mentionGuildSlashCommand(..., "tag", "++")
wintry sorrel
#

it doesnt work :/

normal gyro
#

hm

#

then idk

#

</tag id: ++:911187149125206030>

#

sad

wintry sorrel
#

So what should I do ?

#

Should I at least keep there the /tag at the top and make a pull request ?

normal gyro
#

wait for Zabu pepekek

wintry sorrel
#

fine, how do I summon him xd ?

normal gyro
#

wait for him

#

he will see this and answer if he got time

wintry sorrel
#

will he look at this chat, or should I write him a dm ?

wintry sorrel
alpine trout
#

waddup

#

for starters, its mentionGuildSlashCommand(guild, "tags", "xy")

#

however, if u call that on each of them, it will take forever

#

cause each time u call that method, it sends around rest requests to the discord api to fetch all commands and whatever

#

even though the command id is always the same

#

so a single fetch of the command id would be enough

#

ull have to create a new helper method

#

extracting the part out of mentionGuildSlashCommand that fetches the command id

#

and in another helper method, extracting the part that puts the id and the subcommands together into the magic string

#

then u can use those helpers instead

#

and later also refactor mentionGuildSlashCommand to use them instead

#

but step by step

#

start with mentionGuildSlashCommand(guild, "tag", "xy")

normal gyro
alpine trout
#

but dunno

normal gyro
#

I tested it

#

</tag ++:911187149125206030>

alpine trout
#

easiest is to just put a breakpoint into the code and see urself what it does

#

but it also doesnt really matter, the code exists already

#

just move it around

#

like, the existing mention method looks like this:

#
  1. fetch id
  2. build string
#

OP needs both isolated

#

to reuse the id and build the string without fetching the id again

#

so we put both functionalities into 2 separate helpers

#

refactor the mention method to use that instead

#

and then OP can use the 2 helpers individually

wintry sorrel
alpine trout
wintry sorrel
#

The syntax itself

alpine trout
#

why do u think it doesnt work

#

how does ur code look like

wintry sorrel
#

the xy stands for the id of the tag, right ?

alpine trout
#

ur likely just doing sth incorrect

normal gyro
#

</tag ++:911187149125206033>

#

somehow no

wintry sorrel
alpine trout
wintry sorrel
#

</tag:911187149125206030>

alpine trout
#

there u go

wintry sorrel
#

but still there is no id specifying the actual tag

#

if I write </"command_name" "id_of_tag":"command_id"> it doesnt work

alpine trout
#

if the bot does it or if u do it?

wintry sorrel
#

the result then looks like this

normal gyro
alpine trout
#

please share ur code

#

i have the feeling ur hardcoding it

#

instead of using the method

normal gyro
#

its about using it here with our account

normal gyro
wintry sorrel
normal gyro
#

why doesnt it work if we use it?

alpine trout
#

ever thought about discord removing the perms for users but keeping it for bots?

#

please try it with the bot

#

with the existing mention method

wintry sorrel
#

fine

normal gyro
alpine trout
#

the existing method in the bot works (or at least worked when it was written)

#

so we start with that as starting point

#

cause we know that it works

wintry sorrel
#

it works without the id argument

alpine trout
#

ill just wait until u finally share the code

#

tired of asking for the fifth time

normal gyro
wintry sorrel
wintry sorrel
alpine trout
#

aha. now things connect for me

#

oh wait

#

ur trying to fill an argument/parameter

#

not a subcommand

#

im not sure that ever worked

normal gyro
#

yeah thats the question

alpine trout
#

subcommands have entirely different IDs

#

this one for example /help-thread close

#

thats a subcommand, not a parameter

wintry sorrel
alpine trout
#

well, then ask the issue creator if there is a way to get it working. otherwise the issue is dead

normal gyro
#

its me

wintry sorrel
#

xd

normal gyro
#

and idk

alpine trout
#

then rip that feature

wintry sorrel
#

I have not found anywhere on internet that it should be possible

normal gyro
#

ok big rip

wintry sorrel
#

So is there anything else I could do xd ?

normal gyro
#

close the issue and mark it that its not possible as of now lmao

wintry sorrel
#

can I do it ?

normal gyro
#

or write discord an email to ask about this lmao

normal gyro
#

but I am going in a sec

#

see ya and thanks for your attempt peepo_heart

wintry sorrel
#

byee

frank oysterBOT
#

Closed the thread.