Giter VIP home page Giter VIP logo

abot's People

Contributors

frankdai320 avatar fydai avatar jarhill0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

frankdai320

abot's Issues

Alert targets should not be hard-coded.

Currently, the bot notifies only one hard-coded chat ID. Instead, there should be a command which subscribes a user or channel to a type of alert. Current alert types are the following:

  • xkcd
  • launches

Command syntax should be /subscribe xkcd or /unsubscribe launches.

Refactor Reddit metadata storage

ABot/reddit.py

Lines 133 to 158 in 8da16a0

def add_posts_to_dict(chat_id, posts):
global reddit_posts_dict
reddit_posts_dict[chat_id] = posts
def get_post_from_dict(chat_id, post_id):
section = reddit_posts_dict.get(chat_id, None)
if section is None:
return False, None
else:
post_url = section.get(post_id, None)
if post_url is None:
return True, None
else:
return True, post_url
def set_redditposts_limit(user_id, limit):
global reddit_limits_dict
reddit_limits_dict[str(user_id)] = limit
with open(redditposts_path, 'w') as fi:
json.dump(reddit_limits_dict, fi)
def get_redditposts_limit(user_id):
return reddit_limits_dict.setdefault(str(user_id), 5)

This global access is unacceptable. An object would be a much better solution.

Fixing this issue might also be a nice time to create persistent storage of any metadata per chat without limiting it to Reddit-related information.

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.