telegram

package
v1.0.2 Latest Latest
Warning

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

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

README

如何使用telegram bot来接收通知

  • 创建telegram bot 点击telegram bot father,发送指令/newbot,然后会提示让输入bot的名称,发送你想创建bot的name,注意这个名字是bot显示的名称,发送之后还会提示让发送一个bot的username,这个username必须是不能重复的,因为使用这个名字才可以关注到这个bot,发送成功之后会给你发送一个token

  • 如何发送给指定用户消息 ··

  • Example

func Send() {
    token := "929493383:AA..."
	telegram, err := NewTelegram(token)
	if err != nil {
		t.Fatal(err)
	}
	telegram.Send([]string{"chatid"}, "测试标题", "测试内容")

	time.Sleep(time.Second * 2)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTelegram

func NewTelegram(token string) (notify.Sender, error)

NewTelegram init telegram

Types

type Telegram

type Telegram struct {
	// contains filtered or unexported fields
}

Telegram conf

func (*Telegram) Send

func (t *Telegram) Send(tos []string, title string, content string) error

Send will send notify to channel

Jump to

Keyboard shortcuts

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