Tourmaline::Persistence
Abstract class meant to be a base for other persistence classes. The point of persistence (currently) is to allow Users and Chats to be saved as they're seen, and then provide a way for both to be fetched by either id or username.
Example:
bot = MyBot.new(API_KEY, persistence: Tourmaline::JsonPersistence.new)
# ... do some things
if user = bot.persistence.get_user?("foobar")
pp user
end
Constructors
Instance methods
Returns true if the chat with the provided username exists.
Fetches a chat by chat_id. Returns nil if the chat is not found.
Fetches a chat by username. Returns nil if the chat is not found.
Fetches a user by user_id. Returns nil if the user is not found.
Fetches a user by username. Returns nil if the user is not found.
Takes an Update object, pulls out all unique Chats and Users,
and uses update_user and update_chat on each of them respectively.
Gets called when the bot is initialized. This can be used for setup if you need access to the bot instance.