Version: v0.0.0-...-337d5a4 Latest Latest

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 14 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Bot

type Bot struct {
	// contains filtered or unexported fields

Bot is a twitter bot

func NewBot

func NewBot(config *BotConfig) (*Bot, error)

NewBot returns new bot

func NewBotFromFile

func NewBotFromFile(credsFile string) (*Bot, error)

func (*Bot) DoRegistrationAndSubscribeBusiness

func (b *Bot) DoRegistrationAndSubscribeBusiness() error

DoRegistrationAndSubscribeBusiness registers the webhook for twitter bot

func (*Bot) HandleCRCResponse

func (b *Bot) HandleCRCResponse(w http.ResponseWriter, r *http.Request)

HandleCRCResponse handles the crc response

func (*Bot) TwitterClient

func (b *Bot) TwitterClient() *twitter.Client

func (*Bot) WebhookPath

func (b *Bot) WebhookPath() string

type BotConfig

type BotConfig struct {
	Tokens               Tokens `json:"tokens"`
	Environment          string `json:"environment"`
	WebhookHost          string `json:"webhook-host"`
	WebhookPath          string `json:"webhook-path"`
	OverrideRegistration bool   `json:"override-registration"`

BotConfig is config for initializing new twitter bot

type NotFoundError

type NotFoundError struct {
	Msg string

NotFoundError not found error

func (NotFoundError) Error

func (n NotFoundError) Error() string

type Tokens

type Tokens struct {
	ConsumerKey   string `json:"consumerKey"`
	ConsumerToken string `json:"consumerToken"`
	Token         string `json:"token"`
	TokenSecret   string `json:"tokenSecret"`

Tokens is for twitter tokens

type WebhookConfig

type WebhookConfig struct {
	ID               string `json:"id"`
	URL              string `json:"url"`
	Valid            bool   `json:"valid"`
	CreatedTimestamp string `json:"created_timestamp"`

WebhookConfig from twitter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL