GithubHelp home page GithubHelp logo

amasad / actiondb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zwork101/actiondb

0.0 2.0 0.0 44 KB

The database that doesn't wait for you, it comes.

Home Page: https://zwork101.github.io/action/

License: MIT License

Python 21.61% HTML 78.39%

actiondb's Introduction

Welcome to ActionDB

The database that doesn't wait for you, it goes.

MyPy Flake8 Build Status Full docs here

Introduction

Welcome to actionDB, the DB that comes to you. ActionDB is designed to keep events that need to be summoned at a later date persistent. Personally, this will be used when I make discord bots via https://github.com/b1naryth1ef/disco. However this doesn't mean you can't use this with anything else, you can, and I highly encourage that you do. While this library was designed so that you could easily create and use your own backend, you're welcome to use the sqlite3 backend that comes with it. Lastly, I was to talk about what's planned. At some point, I want to do some major refactoring, and separate the client and server. This would allow you connect to a remote database, something that's not essential but nice, but mainly use whatever concurrency library you want. The backend will still be gevent, however the client can be asyncio, trio, threading, etc.

Quick Start

To get started, we'll need to create our client, this will also create a action.db file, however the name can be changed when initializing:

from action import Action

action = Action()

After this, you should add listeners to your heart's content:

@action.listen("new_msg")
def new_message(name: str, content: str, id: str=None)
    print(name + "\\n\\n" + content + "\\n" + "(" + id + ")")

And if you want to do something, such as send a message in 5 minutes, you can do:

action.trigger_in(5 * 60, "new_msg", "Hello World!", "My name is sam, and I live in a can", id="2323445")

Then presuming you're also doing other things, or have utilized gevent.joinall, in 5 minutes you'll see:

Hello World!

My name is sam, and I live in a can
(2323445)

And that's all there is! If you want to see how you can trigger events at an exact time, or other fun stuff, see the documentation graciously provided below!

Note:

You can import the main classes from action like so:

from action import Action, ActionBackend, ActionEmitter, Event

Happy Coding!

actiondb's People

Contributors

zwork101 avatar

Watchers

 avatar  avatar

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.