httpserver

package
v0.0.0-...-3eedb2d Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesCache

type FilesCache map[string]string

FilesCache type for store files

type PhotosCache

type PhotosCache map[int64]string

PhotosCache type for store users photo filenames by id

type Server

type Server struct {
	Addr          string
	Bot           *tgbotapi.BotAPI
	PhotoCache    PhotosCache
	FileCache     FilesCache
	APIKey        string
	CensList      []string
	StaticDirPath string
}

Server is a main object

func (*Server) BanList

func (s *Server) BanList(msg *tgbotapi.Message)

BanList method returns ban list

func (*Server) BanUnbanUser

func (s *Server) BanUnbanUser(msg *tgbotapi.Message, ban bool)

BanUnbanUser method ban selected user

func (*Server) Cens

func (s *Server) Cens(msg *tgbotapi.Message)

Cens method for censore messages

func (*Server) ClearCens

func (s *Server) ClearCens(msg *tgbotapi.Message)

ClearCens command for clean censore level

func (*Server) CommandHandler

func (s *Server) CommandHandler(msg *tgbotapi.Message)

CommandHandler function for handle commands for bot

func (*Server) FillCens

func (s *Server) FillCens()

FillCens load censore database

func (*Server) GetCensLevel

func (s *Server) GetCensLevel(msg *tgbotapi.Message)

GetCensLevel send message with current censore level for user

func (*Server) GetFile

func (s *Server) GetFile(fileID string, chatID int64)

GetFile function for get file from telegram

func (*Server) GetFileNameByFileID

func (s *Server) GetFileNameByFileID(chatID int64, fileID string) (filename string)

GetFileNameByFileID returns file name by index

func (*Server) GetFileNameByFileIDURL

func (s *Server) GetFileNameByFileIDURL(chatID int64, fileID string) (filename string)

GetFileNameByFileIDURL returns file name by index

func (*Server) GetPhoto

func (s *Server) GetPhoto(chatID int64)

GetPhoto function download user photo and return file name for html tag img

func (*Server) GetPhotoFileName

func (s *Server) GetPhotoFileName(userID int64) (result string)

GetPhotoFileName returns name photo file

func (*Server) GetWarnLevel

func (s *Server) GetWarnLevel(msg *tgbotapi.Message)

GetWarnLevel send message with current warning level for user

func (*Server) SendError

func (s *Server) SendError(msgText string, msg *tgbotapi.Message)

SendError simple shell for SendMessage with error

func (*Server) SendHelp

func (s *Server) SendHelp(msg *tgbotapi.Message)

SendHelp sends help message to chat

func (*Server) SendMessage

func (s *Server) SendMessage(msgText string, chatID int64, replyID int)

SendMessage function send message to given user msgText - is the message text chatID - ID for chat (user id or chat id) user - User struct database store replyID - id messages for reply or 0

func (*Server) SendPing

func (s *Server) SendPing(msg *tgbotapi.Message)

SendPing sends joke ping to chat

func (*Server) Start

func (s *Server) Start()

Start method starts http server

func (*Server) UpdatePhotoCache

func (s *Server) UpdatePhotoCache()

UpdatePhotoCache function update photos cache of users

func (*Server) UserIsAdmin

func (s *Server) UserIsAdmin(userID int, chat *tgbotapi.Chat) (ok bool, err error)

UserIsAdmin returns user is admin or not

func (*Server) UserIsBanned

func (s *Server) UserIsBanned(userID int, chat *tgbotapi.Chat) (banned bool, err error)

UserIsBanned returns ban status user true or false

func (*Server) WarnAdd

func (s *Server) WarnAdd(msg *tgbotapi.Message)

func (*Server) WarnClear

func (s *Server) WarnClear(msg *tgbotapi.Message)

Jump to

Keyboard shortcuts

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