Carousel
Carousel is a component which can scroll(re render) item
import { Carousel } from "@tlgr/carousel";
const carousel = new Carousel(options);
Events described at events page
extends​
constructor(bot, options)
​
options
- <Object>. Carousel options.type
- <string>. can be the one of the next items:'photo' | 'audio' | 'animation' | 'video' | 'document'
items
- <object | string> - Carousel item. Usually it is a url to content. E.g.https://example.com/path/to/image
mode
- <string>. Reply mode.new
- sends new message.edit
- edit first sended message. Default isedit
loop
- <boolean>. Loop mode. Starts over again when end item is reach out. Default isfalse
startFrom
- <number> - Index which carousel will start. Default is0
.controls
- <object>. Controls decoration object. Override prev and next button behavior.
methods​
send(context)​
added in 1.1.0Sends carousel from bot to user
render()​
added in 1.1.0Note: this method are come from inheritance. This method returns prev
and next
buttons. Use send
method instead.
properties​
item​
Return current render item.
index​
return current render item index in array which starts from 0
.
length​
Carousel items length.