bot

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 10 Imported by: 0

README

reddit irc bot

GoDoc Go Report Card Donate

posts newest posts from reddit's rss feeds

example

package main

import (
    "time"

    bot "github.com/ugjka/ircrssreddit"
)

func main() {
    settings := &bot.Bot{
        Nick:     "examplenick",
        Server:   "chat.freenode.net:6697",
        Channels: []string{"#test"},
        SSL:      true,
        Subreddits: []string{
            "/r/testsub/new/",
            "/r/testsub2/new/",
            "/r/testsub3/new/",
            },
        CheckInterval: time.Minute * 5,
        RoundInterval: time.Minute * 5,
        UserAgent:     "freenode #test personal irc reddit bot",
        PrintSub:      true,
    }
    instance := bot.New(settings)
    instance.Start()
}

Documentation

Overview

Package bot is an IRC bot that posts latest entries from Reddit communities

Index

Constants

This section is empty.

Variables

View Source
var Client = &http.Client{}

Client let's you customize the underlying http client

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// IRC server
	Server string
	// IRC nick
	Nick string
	// IRC channels
	Channels []string
	// Use SSL for IRC
	SSL bool
	// IRC password
	Password string
	// Subreddits to track
	// Format: "/r/SomeSubreddit/new"
	// Multireddit: "/user/someuser/m/some_multi_reddit/new/"
	Subreddits []string
	// Subreddit polling interval
	CheckInterval time.Duration
	// Round polling to nearest duration
	RoundInterval time.Duration
	// Custom user agent so that reddit doesn't ban us
	// Essential!
	UserAgent string
	// Print subreddit's name in output
	PrintSub bool
	// contains filtered or unexported fields
}

Bot contains bot's settings

func New

func New(bot *Bot) *Bot

New creates a new bot instance

func (*Bot) Start added in v1.3.0

func (bot *Bot) Start()

Start starts the bot

Jump to

Keyboard shortcuts

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