Git Product home page Git Product logo

znc2mysql's Introduction

znc2mysql

This ZNC module provides support for logging messages into a MySQL database. It is currently in its early stages, with no support to generate the required database schema and requires manual configuration of the database information.

znc2mysql

Requirements

This module requires:

Installation

Set up the database

Create a new MySQL database, and run the included schema (located in src/db.sql) to create the required tables. In example,

mysql -u root -p yourdb < db.sql

Configure database connection settings

open znc2mysql.py and edit the following to reflect your database settings:

    self.connection = pymysql.connect(
        host='localhost',
        user='root',
        password='root',
        db='irc',
        cursorclass=pymysql.cursors.DictCursor
    )

Install the module

Move znc2mysql.py to your znc modules folder (typically ~/.znc/modules)

Load the module in znc

loadmod znc2mysql

znc2mysql's People

Watchers

 avatar

Forkers

torksrevol

znc2mysql's Issues

Create a hook system for custom trigger commands

Currently the regex method used to detect and trigger commands is embeeded in the ircmysql class. We need to separate this out into its own hook system in order to extend this thing with more commands:

def userLastSeen(self, nick):
        with self.connection.cursor() as cursor:
            try:
                seen = {}
                uid = self.getUIDByNick(nick)
                cursor.execute("SELECT last_seen, last_message FROM `users` WHERE nick=%s", nick)
                results = cursor.fetchone()
                seen['seen'] = pretty.date(results['last_seen'], short=False)
                seen['message'] = results['last_message']
                return seen
            except Exception as e:
                print('Error: %s', str(e))
                return None

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.