Skip to content

OnSticker handler

Arius Bronte edited this page Feb 23, 2020 · 3 revisions

Basic usage

Triggers on a sticker with ID 163 and responds with the word "orejas".

commands.OnSticker(163, "orejas");

Triggers on a sticker with ID 163 and sends randomly from the array word.

commands.OnSticker(163, new[] {"orejas", "sticker", "triggered"});

*applies to all triggers.

Triggered on all incoming messages or if no command is found. Is not required.

commands.OnSticker("sticker triggered");
// or
commands.OnSticker(new[] {"it`s sticker!", "sticker triggered"});

Options

You can configure the logic for a specific conversation.

commands.OnSticker((2_000_000_000 + 1, 163), "orejas");
commands.OnSticker((2_000_000_000 + 2, 163), "rightfully");
commands.OnSticker((2_000_000_000 + 3, 63), "ha-ha like!");

Extended

You can set your own trigger processing logic.

commands.OnSticker(163, async (api, message, token) =>
{
    await api.Messages.SendAsync(new MessagesSendParams
    {
        PeerId = message.Message.PeerId.Value,
        StickerId = 163U,
        RandomId = random.Next(int.MinValue, int.MaxValue)
    });
});

*applies to all triggers.

Clone this wiki locally