wotoUD

package
v0.0.0-...-f800b22 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PV_FLAG      = "pv"      // won't work if message is replied
	HENTAI_FLAG  = "hentai"  // it works only for sudo people
	PRIVATE_FLAG = "private" // won't work if message is replied
	DEL_FLAG     = "del"     // won't work if message is not replied
	DELETE_FLAG  = "delete"  // won't work if message is not replied
	MSG_FLAG     = "msg"     // is there any messages for caption?
	MESSAGE_FLAG = "message" // is there any messages for caption?
	SINGLE_FLAG  = "single"  // use zero index of ud def list
)

the flags for the wotoUD plugin. please notice that all flags should begin with prefex `--`, but in the pTools, this prefex will be removed.

Variables

This section is empty.

Functions

func GetSimilarWords

func GetSimilarWords(word string) (str []string, err error)

func QUdHanler

func QUdHanler(query *tg.CallbackQuery, q *wq.QueryBase)

func UdHandler

func UdHandler(message *tg.Message, args pTools.Arg)

Types

type UrbanCollection

type UrbanCollection struct {
	List []UrbanDictionary `json:"list"`
}

UrbanCollection is a collection (array) of Urban dictionary values.

func Define

func Define(word string) (ud *UrbanCollection, err error)

Define, will define the word, using urban dictionary public API, version 0? :/ It will return a pointer to an urban collection.

func (*UrbanCollection) Found

func (c *UrbanCollection) Found() bool

Found will give you a boolean indicating whether the word is found or not.

func (*UrbanCollection) GetDef

func (c *UrbanCollection) GetDef(page uint8) string

GetDef will give you the definition in the specified page, using wotoMD. WARNING: page arg is zero indexed.

func (*UrbanCollection) GetVoiceUrls

func (c *UrbanCollection) GetVoiceUrls(page uint8) []string

GetVoiceUrl will give you a random voice from available voices.

func (*UrbanCollection) HasVoice

func (c *UrbanCollection) HasVoice(page uint8) bool

Found will give you a boolean indicating whether the word in the specified page has at least one correct voice url or not.

type UrbanDictionary

type UrbanDictionary struct {
	Def        string   `json:"definition"`
	PermLink   string   `json:"permalink"`
	ThumbsUp   int      `json:"thumbs_up"`
	Voices     []string `json:"sound_urls"`
	Author     string   `json:"author"`
	Word       string   `json:"word"`
	DefID      int      `json:"defid"`
	Vote       string   `json:"current_vote"`
	Date       string   `json:"written_on"`
	Example    string   `json:"example"`
	ThumbsDown int      `json:"thumbs_down"`
}

the main structure for interacting with urban dictionary public API.

func (*UrbanDictionary) GetVoiceUrls

func (d *UrbanDictionary) GetVoiceUrls() []string

func (*UrbanDictionary) HasVoice

func (d *UrbanDictionary) HasVoice() bool

Jump to

Keyboard shortcuts

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