class Tourmaline::NilPersistence

Overview

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.

Defined in:

tourmaline/persistence/nil_persistence.cr

Instance Method Summary

Instance methods inherited from class Tourmaline::Persistence

chat_exists?(chat_id : Int) : Bool
chat_exists?(username : String) : Bool
chat_exists?
, cleanup cleanup, get_chat(chat_id : Int) : Chat | Nil
get_chat(username : String) : Chat | Nil
get_chat
, get_user(user_id : Int) : User | Nil
get_user(username : String) : User | Nil
get_user
, handle_update(update : Update) handle_update, init init, update_chat(chat : Chat) : Chat update_chat, update_user(user : User) : User update_user, user_exists?(user_id : Int) : Bool
user_exists?(username : String) : Bool
user_exists?

Constructor methods inherited from class Tourmaline::Persistence

new new

Instance Method Detail

def chat_exists?(chat_id : Int) : Bool #
Description copied from class Tourmaline::Persistence

Returns true if the chat with the provided chat_id exists.


[View source]
def chat_exists?(username : String) : Bool #
Description copied from class Tourmaline::Persistence

Returns true if the chat with the provided username exists.


[View source]
def cleanup #
Description copied from class Tourmaline::Persistence

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


[View source]
def get_chat(chat_id : Int) : Chat | Nil #
Description copied from class Tourmaline::Persistence

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


[View source]
def get_chat(username : String) : Chat | Nil #
Description copied from class Tourmaline::Persistence

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


[View source]
def get_user(user_id : Int) : User | Nil #
Description copied from class Tourmaline::Persistence

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


[View source]
def get_user(username : String) : User | Nil #
Description copied from class Tourmaline::Persistence

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


[View source]
def handle_update(update : Update) #
Description copied from class Tourmaline::Persistence

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]
def init #
Description copied from class Tourmaline::Persistence

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


[View source]
def update_chat(chat : Chat) : Chat #
Description copied from class Tourmaline::Persistence

Create or update the provided Chat.


[View source]
def update_user(user : User) : User #
Description copied from class Tourmaline::Persistence

Create or update the provided User.


[View source]
def user_exists?(user_id : Int) : Bool #
Description copied from class Tourmaline::Persistence

Returns true if the user with the provided user_id exists.


[View source]
def user_exists?(username : String) : Bool #
Description copied from class Tourmaline::Persistence

Returns true if the user with the provided username exists.


[View source]