Skip to content

class Tourmaline::NilPersistence
inherits Tourmaline::Persistence #

The default persistence, which is no persistence. This is basically just a placeholder class that does absolutely nothing, but still allows persistence methods to be accessed.

Methods#

#chat_exists?(chat_id : Int) : Bool #

Returns true if the chat with the provided chat_id exists.

View source

#chat_exists?(username : String) : Bool #

Returns true if the chat with the provided username exists.

View source

#cleanup #

Gets called upon exit. It can be used to perform any necessary cleanup.

View source

#get_chat(chat_id : Int) : Chat? #

Fetches a chat by chat_id. Returns nil if the chat is not found.

View source

#get_chat(username : String) : Chat? #

Fetches a chat by username. Returns nil if the chat is not found.

View source

#get_user(user_id : Int) : User? #

Fetches a user by user_id. Returns nil if the user is not found.

View source

#get_user(username : String) : User? #

Fetches a user by username. Returns nil if the user is not found.

View source

#handle_update(update : Update) #

Takes an Update object, pulls out all unique Chats and Users, and uses update_user and update_chat on each of them respectively.

View source

#init #

Gets called when the bot is initialized. This can be used for setup if you need access to the bot instance.

View source

#update_chat(chat : Chat) : Chat #

Create or update the provided Chat.

View source

#update_user(user : User) : User #

Create or update the provided User.

View source

#user_exists?(user_id : Int) : Bool #

Returns true if the user with the provided user_id exists.

View source

#user_exists?(username : String) : Bool #

Returns true if the user with the provided username exists.

View source