Version: v0.0.4 Latest Latest

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 17 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) TwitterConfig

func (b *Bot) TwitterConfig() *BotConfig

func (*Bot) TwitterV2Client added in v0.0.3

func (b *Bot) TwitterV2Client() *twitterv2.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"`
	ClientId      string `json:"clientId"`
	ClientSecret  string `json:"clientSecret"`

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
y or Y : Canonical URL