class PrivateParlorXT::SQLiteRobot9000

Overview

An implementation of Robot9000 using the Database to store unique text and media IDs

Defined in:

private-parlor-xt/robot9000/sqlite_r9k.cr

Constructors

Instance Method Summary

Instance methods inherited from class PrivateParlorXT::Robot9000

add_file_id(id : String) : Nil add_file_id, add_line(text : String) : Nil add_line, allow_text?(text : String) : Bool allow_text?, check_forwards? : Bool | Nil check_forwards?, check_media? : Bool | Nil check_media?, check_text? : Bool | Nil check_text?, cooldown : Int32 cooldown, media_file_id(message : Tourmaline::Message) : String | Nil media_file_id, remove_links(text : String, entities : Array(Tourmaline::MessageEntity)) : String remove_links, strip_text(text : String, entities : Array(Tourmaline::MessageEntity)) : String strip_text, unique_media(user : User, message : Tourmaline::Message, services : Services, file_id : String) : String | Nil unique_media, unique_message?(user : User, message : Tourmaline::Message, services : Services, text : String | Nil = nil) : Bool unique_message?, unique_text(user : User, message : Tourmaline::Message, services : Services, text : String) : String | Nil unique_text, unoriginal_media?(id : String) : Bool | Nil unoriginal_media?, unoriginal_message(user : User, message : Tourmaline::Message, services : Services) : Nil unoriginal_message, unoriginal_text?(text : String) : Bool | Nil unoriginal_text?, warn_user? : Bool | Nil warn_user?

Constructor Detail

def self.new(connection : DB::Database, valid_codepoints : Array(Range(Int32, Int32)) = [(0..127)], check_text : Bool | Nil = nil, check_media : Bool | Nil = nil, check_forwards : Bool | Nil = nil, warn_user : Bool | Nil = nil, cooldown : Int32 = 0) #

Generally this should use the same connection that was used for the database


[View source]

Instance Method Detail

def add_file_id(id : String) : Nil #

Stores the file id to be referenced later


[View source]
def add_line(text : String) : Nil #

Stores the stripped line of text to be referenced later


[View source]
def ensure_schema : Nil #

Ensures that both the text table and file_id table are created in the Database, according to the values of check_text and check_media


[View source]
def unoriginal_media?(id : String) : Bool | Nil #

Returns true if the given file id has been sent before Returns false otherwise


[View source]
def unoriginal_text?(text : String) : Bool | Nil #

Returns true if the given text has been sent before Returns false otherwise


[View source]