hooks

package module
v0.0.0-...-5df3447 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 13 Imported by: 0

README

BookHook

A simple function that will bookmark tweet that containts #toread hashtag to Telegram channel

Why?

  • I've been using private Telegram channel as a way to keep any interesting links or reading that I could find
  • I used Twitter a lot and I tend to find my reading materials from my Twitter circles
  • To automate a part of my daily workflow

How it works?

Demo

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindHashtag

func FindHashtag(slice []Hashtag, val string) (int, bool)

FindHashtag takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

func FindUrl

func FindUrl(slice []URL) (int, bool)

FindUrl takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

func TwitterWebhook

func TwitterWebhook(w http.ResponseWriter, r *http.Request)

Types

type CRC

type CRC struct {
	ResponseToken string `json:"response_token"`
}

type Entities

type Entities struct {
	Hashtags     []Hashtag     `json:"hashtags"`
	Urls         []URL         `json:"urls"`
	UserMentions []interface{} `json:"user_mentions"`
	Symbols      []interface{} `json:"symbols"`
}

type ExtendedTweet

type ExtendedTweet struct {
	FullText         string   `json:"full_text"`
	DisplayTextRange []int64  `json:"display_text_range"`
	Entities         Entities `json:"entities"`
}

type Hashtag

type Hashtag struct {
	Text    string  `json:"text"`
	Indices []int64 `json:"indices"`
}

type QuotedStatus

type QuotedStatus struct {
	CreatedAt     string         `json:"created_at"`
	ID            float64        `json:"id"`
	IDStr         string         `json:"id_str"`
	Text          string         `json:"text"`
	Truncated     bool           `json:"truncated"`
	IsQuoteStatus bool           `json:"is_quote_status"`
	QuoteCount    int64          `json:"quote_count"`
	ReplyCount    int64          `json:"reply_count"`
	RetweetCount  int64          `json:"retweet_count"`
	FavoriteCount int64          `json:"favorite_count"`
	Entities      Entities       `json:"entities"`
	ExtendedTweet *ExtendedTweet `json:"extended_tweet,omitempty"`
}
type QuotedStatusPermalink struct {
	URL      string `json:"url"`
	Expanded string `json:"expanded"`
	Display  string `json:"display"`
}

type SendMessage

type SendMessage struct {
	ChatID                string `json:"chat_id"`
	Text                  string `json:"text"`
	DisableWebPagePreview bool   `json:"disable_web_page_preview"`
	DisableNotification   bool   `json:"disable_notification"`
	ParseMode             string `json:"parse_mode"`
}

type Tweet

type Tweet struct {
	ForUserID         string             `json:"for_user_id"`
	TweetCreateEvents []TweetCreateEvent `json:"tweet_create_events"`
}

type TweetCreateEvent

type TweetCreateEvent struct {
	CreatedAt             string                `json:"created_at"`
	ID                    float64               `json:"id"`
	IDStr                 string                `json:"id_str"`
	Text                  string                `json:"text"`
	Truncated             bool                  `json:"truncated"`
	QuotedStatusID        float64               `json:"quoted_status_id"`
	QuotedStatusIDStr     string                `json:"quoted_status_id_str"`
	QuotedStatus          QuotedStatus          `json:"quoted_status"`
	QuotedStatusPermalink QuotedStatusPermalink `json:"quoted_status_permalink"`
	Entities              Entities              `json:"entities"`
	Favorited             bool                  `json:"favorited"`
	Retweeted             bool                  `json:"retweeted"`
	TimestampMS           string                `json:"timestamp_ms"`
}

type URL

type URL struct {
	URL         string  `json:"url"`
	ExpandedURL string  `json:"expanded_url"`
	DisplayURL  string  `json:"display_url"`
	Indices     []int64 `json:"indices"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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