Giter VIP home page Giter VIP logo

otto's Introduction

Otto

Coverage

Otto is a bot designed to help you stay up-to-date with the latest news by monitoring RSS feeds and sending notifications via Telegram.

Table of Contents

Getting Started

To get started with Otto, clone the repository to your local machine:

git clone https://github.com/Vico1993/Otto.git
cd Otto

Prerequisites

Make sure you have the following tools installed on your machine:

  • Go (at least version 1.20)
  • A valid Telegram bot:
  • Setup an .env file
# Bot token given by the @BotFather
TELEGRAM_BOT_TOKEN=<TELEGRAM_BOT>
# Used by the bot to know which chat to interact with
TELEGRAM_USER_CHAT_ID=<CHAT_ID>

#MONGO srv url you want to use with username + password for the connection
MONGO_URI=<URI>

Installing

To install Otto, run the following command:

make ensure_deps

Running Tests

To run tests, use the following command:

make test

Usage

To use Otto, run the following command:

make build && ./bin/bot

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for more information.

License

This project is licensed under the LICENSE file in the root directory of this repository.

otto's People

Contributors

actions-user avatar dependabot[bot] avatar vico1993 avatar

Watchers

 avatar

otto's Issues

Maybe find a better way ?

Line: 80

func (r sChatRep) SetLastTimeCheckForUrl(url string, chat *database.Chat) bool {
// Find the correct feed
// Update the last time parsed
// TODO: Maybe find a better way ?
for k, feed := range chat.Feeds {
if feed.Url == url {
feed.LastTimeParsed = time.Now()
chat.Feeds[k] = feed
}
}

Refactor the way I connect and interact with telegram api

Line: 12

var telegramBaseURL = "https://api.telegram.org/bot<TOKEN>"
// TODO: Refactor the way I connect and interact with telegram api
// Post a message in the telegram chat
func TelegramPostMessage(text string) {
uri := strings.Replace(telegramBaseURL+"/sendMessage", "<TOKEN>", os.Getenv("TELEGRAM_BOT_TOKEN"), 1)
data := url.Values{}
data.Set("chat_id", os.Getenv("TELEGRAM_USER_CHAT_ID"))

Log this why we don't act upon it

Line: 42

func handleUpdates(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
if !shouldAct(update) {
// TODO: Log this why we don't act upon it
// TODO: Get lang update.Message.From.LanguageCode to update response
from := update.Message.From
user := repository.FindBannedUserByTelegramId(from.ID)
fmt.Println("user", user)
if user != nil {
return

Refactor the way feed are managed

For the bot to be public, I need to find a new way to manage feed but also manage the cron.

๐Ÿค”

Cron maybe will have to run every minute and pull the list of feed it need to analyze?
And for each feed it send the notification to one channel?

๐Ÿค”

Structure proposed:

{
   "_id": "",
   "url": "https://google.com/rss",
   "chatId": "12355",
   "createdAt": "Monday 15 May", # Timestamp
   "lastTimeChecked": "Monday 15 May [12H]" # Timestamp
}

Manage version file

Will be nice if we have a version.txt where we can find : vx.x.x

When we would create a PR, we will have a Github action that increase this version base on label / or action from comments

And it will manage the update of the file.

Once the PR is merged
It will create a DRAFT release with the correct tag.

Implement different dialog + support different lang

Line: 16

}
// Start execution process
// TODO: Implement different dialog + support different lang
func (cmd *startCmd) Execute(bot BotAPI, message tgbotapi.Message) {
intro := "Hello! My name is Otto and I am a bot created to help you find the latest RSS feeds. \n With my advanced search algorithms, I can help you discover a wide range of RSS feeds from various sources. \nJust let me know what topics interest you, and I'll take care of the rest!"
// If user didn't provide firstName
user := message.From.FirstName
if user == "" {
user = message.From.UserName

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.