Code Monkey home page Code Monkey logo

cksmaid's Introduction

k88 (cksmaid@rizon, ckatsmaid@libera)

everyone seems to have some terribly structured irc bot with unmaintainable code these days, this is my take on it

features

at the core, its another attempt at a somewhat maintainable (for me) bot system with the following features:

  • multithreaded
  • module system
  • multiple server support
  • ini config
  • self updating
  • TLS v1.2

modules

an ever incomplete list of the functionality provided through modules:

  • ddg search (shoddy instant result api)
  • wolfram alpha
  • markov posting (learns on every channel its enabled on)
  • onion link translating
  • link reader
  • 4chan scraper
  • cross server bridging
  • al search
  • image saucing
  • message triggers
  • typical irc nonsense (decide, IBIP, fortunes, modulemanagement etc)

building and running*

git submodule init
git submodule update
make run

*: it is not recommended to actually use this bot, the source is only public so other people can fix issues for me. if you, for whatever reason, want the bot in your channel contact me instead and I'll join my instance.

incomplete guide to writing modules

module boilerplating is generated at make through the shellscript, all thats needed to add a new module is create a new directory under mods/ with a .c file. see the other modules on how this is formatted.

module contents

a module is structured as a bunch of handle_ functions, and an _init function. inside the _init the module is added to the module system with its name and handler functions, any other initialisation the module might need should also be done here. again refer to all other mods on how this is structured.

module 'api'

while everything is made to minimize having to look at the core bot code, a few things have to be known:

  • send_privmsg for privmsgs
  • send_notice for notices
  • log_info, log_err for anything you want to log to console
  • all of the above take printf like formatting, log functions expect a \n at the end
  • for interfacing with api endpoints, see the ddg or wolfram module for how I (ab)use curl
  • the signatures of all handle_ functions are to be copied 1:1, they're used by macros
  • do not alter any strings your module is passed, these are reused by other modules
  • it shouldnt matter too much, but your module code should be (mostly) threadsafe
  • utils that will be reused over multiple modules are to be implemented in utils/

FAQ

  • why is this written so poorly?/why is x done like y when z makes more sense?
    I have given up. this is a combination of many dead bot projects I had laying around. I may or may not slowly clean up the most terrible parts over time. feel free to do it for me in PRs as well

cksmaid's People

Contributors

ckath avatar gottaeat avatar

Watchers

 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.