Skip to content

Sticker API

unreg edited this page Oct 29, 2016 · 4 revisions

Sticker API

CreateStickerPack

from actorbot.api import stikers
from actorbot.bots import Conversation

class ExampleConversation(Conversation):
    def sample(self):
        creatorUserId = '2529523898'
        out_msg = stickers.CreateStickerPack(self._get_id(),
                                             creatorUserId=creatorUserId)
        self.send(out_msg)

AddSticker

from actorbot.api import stikers
from actorbot.bots import Conversation

class ExampleConversation(Conversation):
    def sample(self):
        ownerUserId = '2529523898'
        packId = '686811916'

        with open(path_to_small_webp, 'rb') as f:
            small_image = f.read()
        with open(path_to_medium_webp, 'rb') as f:
            medium_image = f.read()
        with open(path_to_large_webp, 'rb') as f:
            large_image = f.read()

        out_msg = stickers.AddSticker(
                self._get_id(), ownerUserId=ownerUserId, packId=packId,
                emoji=[''],
                small=list(small_image), smallW=128, smallH=128,
                medium=list(medium_image), mediumW=256, mediumH=256,
                large=list(large_image), largeW=512, largeH=512)
        self.send(out_msg)

ShowStickers

from actorbot.api import stikers
from actorbot.bots import Conversation

class ExampleConversation(Conversation):
    def sample(self):
        ownerUserId = '2529523898'
        packId = '686811916'

        out_msg = stickers.ShowStickers(self._get_id(),
            ownerUserId=ownerUserId, packId=packId)
        self.send(out_msg)

DeleteSticker

from actorbot.api import stikers
from actorbot.bots import Conversation

class ExampleConversation(Conversation):
    def sample(self):
        ownerUserId = '2529523898'
        packId = '686811916'
        stickerId = '1019731503'

        out_msg = stickers.DeleteSticker(self._get_id(),
            ownerUserId=ownerUserId, packId=packId, stickerId=stickerId)
        self.send(out_msg)

MakeStickerPackDefault

from actorbot.api import stikers
from actorbot.bots import Conversation

class ExampleConversation(Conversation):
    def sample(self):
        userId = '2529523898'
        packId = '686811916'

        out_msg = stickers.MakeStickerPackDefault(self._get_id(),
            userId=userId, packId=packId)
        self.send(out_msg)

Clone this wiki locally