helpers

package
v0.0.0-...-728e8f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DATABASE_URI = os.Getenv("DATABASE_URI")

Functions

func AddSlapSticker

func AddSlapSticker(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

AddSlapSticker adds slap sticker to db

func AddSlapStickerToDb

func AddSlapStickerToDb(fileID string) error

AddSlapStickerToDb Adds a slap string to database

func AddSlapToDB

func AddSlapToDB(slapString string)

AddSlapToDB adds a slap string format to the mongodb database

func BatchSave

func BatchSave(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

BatchSave handler adds the command to the user session

func DadJoke

func DadJoke(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

DadJoke fetches a dadjoke from icanhazdadjoke.com

func DelTag

func DelTag(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

func DeleteNote

func DeleteNote(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

DeleteNote deletes a note

func DeleteSlapFromDb

func DeleteSlapFromDb(documentID string) error

DeleteSlapFromDb removes a slap string with a given ID from the database

func DeleteSlapString

func DeleteSlapString(bot *tgbotapi.BotAPI, update *tgbotapi.Update, documentID string)

DeleteSlapString deletes a slap string from database

func ExtractTag

func ExtractTag(message string) string

Extracts the hash tag from the message

func GenerateUUID

func GenerateUUID() string

GenerateUUID generates a unique ID string

func GetAllTags

func GetAllTags(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

func GetMessage

func GetMessage(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

GetMessage gets message from the bot and replies to the user

func GetNotes

func GetNotes(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

GetNotes is used to get all notes of a subject

func GetSlapStickers

func GetSlapStickers() (string, error)

GetSlapStickers gets a random slap sticker from document

func GetSlapStrings

func GetSlapStrings() (string, error)

GetSlapStrings gets a random slap string from document

func InitReminderService

func InitReminderService(bot *tgbotapi.BotAPI)

func MakePDF

func MakePDF(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

func ParseDate

func ParseDate(inputString string) (time.Time, error)

ParseDate parses string to date

func Pin

func Pin(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

Pin function pins a message

func Remind

func Remind(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

Remind handles the /remind command

func SaveNote

func SaveNote(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

SaveNote saves a note

func Search(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

func Sed

func Sed(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

func SendMessage

func SendMessage(message string)

SendMessage sends a message to the bot to store

func ShowSlapStrings

func ShowSlapStrings(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

ShowSlapStrings returns widgets showing all slap strings and giving user an option to delete any

func Slap

func Slap(user1 string, user2 string) string

Slap takes two users as argument and slaps one

func SlapWithSticker

func SlapWithSticker(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

SlapWithSticker slaps a person with a sticker

func Timer

func Timer(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

Timer starts a timer

func Unpin

func Unpin(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

Types

type BatchSaveType

type BatchSaveType struct {
	Data data
}

func (*BatchSaveType) Continue

func (b *BatchSaveType) Continue(bot *tgbotapi.BotAPI, update *tgbotapi.Update, session *middleware.UserSession)

Continue function adds the document to the session

func (*BatchSaveType) Done

func (b *BatchSaveType) Done(bot *tgbotapi.BotAPI, update *tgbotapi.Update, session *middleware.UserSession)

Done saves the notes and then indexes them all

func (*BatchSaveType) Start

func (b *BatchSaveType) Start(bot *tgbotapi.BotAPI, update *tgbotapi.Update)

Start function checks whether tag is present or not and then sets the data in the session

type SlapSticker

type SlapSticker struct {
	ID     primitive.ObjectID `bson:"_id,omitempty"`
	FileID string             `bson:"fileid,omitempty"`
}

SlapSticker denotes a sticker in the database

type SlapString

type SlapString struct {
	ID   primitive.ObjectID `bson:"_id,omitempty"`
	Text string             `bson:"text,omitempty"`
}

SlapString is this

func GetAllSlapStrings

func GetAllSlapStrings() ([]SlapString, error)

GetAllSlapStrings returns a list of all the slap documents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL