Discord-S.C.U.M icon indicating copy to clipboard operation
Discord-S.C.U.M copied to clipboard

Click button

Open KumaHugg opened this issue 2 years ago • 1 comments

from discum.utils.button import Buttoner
buts = Buttoner(message["components"])
bot.click(
    message["webhook_id"],
    channelID=message["channel_id"],
    guildID=message.get("guild_id"),
    messageID=message["id"],
    messageFlags=message["flags"],
    data=buts.getButton("First"),
)

What is First and how you get customId of button?

KumaHugg avatar Sep 02 '22 14:09 KumaHugg

Hi, the "First" thing specified is the custom ID from the button component in the example, however, I believe that example is outdated and won't work, an example that would work for button click is this one

message = bot.getMessage(channel_id, message_id)
try:
    data = message.json()[0]
    buts = Buttoner(data["components"])
    bot.click(
        data["author"]["id"],
        channelID=data["channel_id"],
        guildID=guild_id,
        messageID=data["id"],
        messageFlags=data["flags"],
        data=buts.getButton(customID="First"))
    )

If you don't know the custom ID of the button you need to make a function to fetch that ID

NeutronBlast avatar Sep 09 '22 15:09 NeutronBlast