gobotapi

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: GPL-3.0 Imports: 14 Imported by: 2

README

gopher logo

AutoGenerated Telegram BotAPI Framework for GoLang
Examples Documentation Sources

GoBotAPI

pkg.go.dev GO Version GitHub OS Architectures

An elegant and modern BotAPI Framework for GoLang

package main

import "github.com/Squirrel-Network/gobotapi"
import "github.com/Squirrel-Network/gobotapi/types"
import "github.com/Squirrel-Network/gobotapi/methods"

func main() {
    client := gobotapi.NewClient("YOUR_TOKEN")
    client.OnMessage(func(message types.Message) {
        client.Invoke(&methods.SendMessage{
            ChatID: message.Chat.ID,
            Text:   "Hello World!",
        })
    })
    client.Run()
}

GoBotAPI is a modern and elegant AutoGenerated BotAPI Framework. This Framework provides a pure Go implementation without any external libs

In addition to the official API, this Framework also provides some high-level functions that make it easier to use the API.

The Telegram API scheme depends on your build, but if you don't want to compile by your self you can use the package compiled from pkg.go.dev/github.com/Squirrel-Network/gobotapi.

How to install?

Here's how to add the GoBotApi Framework to your project, the command are given below:

go get -u github.com/Squirrel-Network/gobotapi

gopher logo

Releases Sources

GoBotAPI Generator

GO Version GitHub OS Architectures

GoBotAPI Generator is the generator for the GoBotAPI Framework. It generates a new BotAPI Framework from the given BotAPI schema.

How to use?

Just run the binary file from releases and choose the binary file you want to use on your operating system.

Credits

Big thanks to @Laky-64 for making this project possible, special thanks to @geiccobs for his own package as starting point for this project, also thanks to @empijei for help about the project design and to @LucaTheHacker for optimizations.

Just because the thanks aren't enough... Huge thanks to @MikiMleam for the cool logo and to @BluLupo for helping to fix some stuff.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PollingTimeout time.Duration
	BotApiConfig   Config
	Token          string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) Client

func (*Client) Invoke

func (ctx *Client) Invoke(method rawTypes.Method) (*rawTypes.Result, error)

func (*Client) OnCallbackQuery

func (ctx *Client) OnCallbackQuery(handler func(update types.CallbackQuery))

func (*Client) OnChannelPost

func (ctx *Client) OnChannelPost(handler func(update types.Message))

func (*Client) OnChatJoinRequest

func (ctx *Client) OnChatJoinRequest(handler func(update types.ChatJoinRequest))

func (*Client) OnChatMember

func (ctx *Client) OnChatMember(handler func(update types.ChatMemberUpdated))

func (*Client) OnChosenInlineResult

func (ctx *Client) OnChosenInlineResult(handler func(update types.ChosenInlineResult))

func (*Client) OnCommand

func (ctx *Client) OnCommand(command string, aliasList []string, handler func(update types.Message))

func (*Client) OnEditedChannelPost

func (ctx *Client) OnEditedChannelPost(handler func(update types.Message))

func (*Client) OnEditedMessage

func (ctx *Client) OnEditedMessage(handler func(update types.Message))

func (*Client) OnInlineQuery

func (ctx *Client) OnInlineQuery(handler func(update types.InlineQuery))

func (*Client) OnMessage

func (ctx *Client) OnMessage(handler func(update types.Message))

func (*Client) OnMyChatMember

func (ctx *Client) OnMyChatMember(handler func(update types.ChatMemberUpdated))

func (*Client) OnPoll

func (ctx *Client) OnPoll(handler func(update types.Poll))

func (*Client) OnPollAnswer

func (ctx *Client) OnPollAnswer(handler func(update types.PollAnswer))

func (*Client) OnPreCheckoutQuery

func (ctx *Client) OnPreCheckoutQuery(handler func(update types.PreCheckoutQuery))

func (*Client) OnRawUpdate

func (ctx *Client) OnRawUpdate(handler func(update types.Update))

func (*Client) OnShippingQuery

func (ctx *Client) OnShippingQuery(handler func(update types.ShippingQuery))

func (*Client) Run

func (ctx *Client) Run()

func (*Client) Start

func (ctx *Client) Start()

func (*Client) Stop

func (ctx *Client) Stop()

type Config

type Config struct {
	HostName string
	Port     int
	Https    bool
}

Directories

Path Synopsis
raw

Jump to

Keyboard shortcuts

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