Giter Club home page Giter Club logo

sequell's Introduction

Sequell

Sequell is the stats IRC bot for #crawl on Libera IRC.

Sequell is the successor to the original #crawl Henzell which at one point shared the same code. There are still many references to Henzell in the source and configuration.

Dependencies

  • Go 1.3 or better from http://golang.org/ or installed via your package manager.

    Your GOPATH environment variable must be correctly set, and $GOPATH/bin must be in your PATH for the seqdb tool.

  • PostgreSQL 9

    1. Install PostgreSQL, create a database 'sequell' and a user 'sequell', and give the user access to the database with password 'sequell'.

    2. In the 'sequell' database, install the PostgreSQL citext and orafce extensions by running (as an admin user): CREATE EXTENSION citext; CREATE EXTENSION orafce;

      citext is available as part of Postgres contrib; orafce is available at: https://github.com/orafce/orafce

      Sequell needs the CITEXT extension for case-insensitive comparison and grouping and the orafce extension for the median aggregate function. You may choose to skip the orafce extension if you do not need the median() aggregate function.

      You can use the seqdb tool to create the database and extensions if you run it as a Postgres admin user:

      Build seqdb from the Sequell root directory:

       $ make
      

      Then create the database:

       $ seqdb createdb --admin postgres --adminpassword xyzzy
      

      Depending on what authentication mode you're using for Postgres, you may need to run seqdb as the postgres Unix user (if using ident auth), and/or override the host and port you're connecting on.

      If you're connecting to Postgres using Unix sockets, specify the Unix socket directory as the --host option:

       $ seqdb --host /var/run/postgresql createdb
      

      Note that you still have to install the orafce and citext extensions for Postgres system-wide before you can create a database that uses these extensions. seqdb createdb merely automates the process of creating the database and sequell database user and creating the extensions in the database; it cannot install the extensions system-wide.

    3. Set up the database:

      Build Sequell's DB ops tool using make (this requires Go 1.3+):

       $ make
      

      Create the database tables in the schema:

       $ seqdb create-tables
      

      Populate the database: first fetch the server logs, then load them:

       $ seqdb fetch && seqdb load
      

      Create indexes and constraints on the database after loading logs:

       $ seqdb create-indexes
      

      You can change the database seqdb connects to, and how it connects. Run seqdb for an overview.

  • RE2

    1. Install RE2 using the package manager on your system (libre2-dev on the Debian family).
  • Ruby

    Sequell requires ruby 1.9 or better. You may need to install rubygems and the ruby headers (ruby-dev), depending on your system.

  • Perl

    Perl >= 5.14

Sequell wants Perl modules for IRC, YAML parsing, DB connectivity, etc. In addition the SQL query commands require several Ruby gems. To install Sequell's dependencies, use:

# ./scripts/install-libs

You can also install the Perl and Ruby dependencies independently:

# ./scripts/install-perl-modules
# gem install bundler && bundle install

Configuring Sequell

Sequell has three primary functions:

  1. Providing a repository for user-maintained content (the LearnDB).
  2. Storing records of all games on public serves and making them available to query.
  3. Serving a playlist of games enqueued for FooTV. This is one half of the configuration for FooTV. The FooTV service must separately be configured to connect to Sequell's playlist server.

Sequell also provides additional utility commands.

You configure Sequell by supplying an rc/sequell.rc in the directory from which you run Sequell. You can alternatively specify the rc filename as a command-line option with:

perl sequell.pl --rc=some/path/to/myweirdrc

Running Sequell queries without connecting to IRC

If you want to test new commands or run !lg queries on a local Sequell database without involving IRC, you can use the scripts/runcmd.pl script for an interactive Sequell REPL with no IRC strings attached. It's a good idea to run it via rlwrap for command-line editing and history support:

$ rlwrap ./scripts/runcmd.pl
Sequell command runner
> !lg *
7941444. foo the Warrior (L19 MfGl of Okawaru), mangled by a naga ritualist (a +3 dagger of venom) on Snake:4 (snake_hunt) on 2017-10-22 18:04:42, with 217416 points after 31169 turns and 0:53:26.

runcmd.pl assumes a default IRC nick of anon, and a default IRC channel of #crawl, for commands that expect to see a nick/channel. You may override these defaults with the NICK/CHANNEL environment variables.

$ NICK=won CHANNEL='#crawl-dev' rlwrap ./scripts/runcmd.pl
> .echo $nick in $channel
Sequell command runner
won in #crawl-dev

sequell's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sequell's Issues

"help" should show you the contents of {henzell_help[1]}

Thank you for writing/maintaining Henzell; it's a very useful bot.

I just wrote a factoid named henzell_help[1]. (As of 9 February 2013, the factoid is too new to be visible when you click that link.)

And now for my feature request:

Typing Henzell: help should produce precisely the same output as typing ??henzell_help[1].

!lg * x=avg(unknown) causes barf

< chequers> !lg * x=unknown
< Sequell> Unknown field: unknown
< chequers> !lg * x=avg(unknown)
< Sequell> Cannot apply to [unknown] (want [#<OpenStruct type=[#<Sql::Type:0x000000020ae900 @type_string="ETD", @raw_type="ETD", @type="ETD",
             @category="ETD">], return=#<Sql::Type:0x000000020ae7c0 @type_string="*">>, #<OpenStruct type=[#<Sql::Type:0x000000020ae360 @type_string="I",
             @raw_type="I", @type="I", @category="F">], return=#<Sql::Type:0x000000020ae220 @type_string="F">>])

!source command not using github's current format for anchor links to line numbers

URLs like:

https://github.com/crawl/crawl/blob/master/crawl-ref/source/tiledoll.cc#l190

don't correctly link to the relevant line number; they only link correctly in my browser with 'L' at the start of the anchor link, like:

https://github.com/crawl/crawl/blob/master/crawl-ref/source/tiledoll.cc#L190

Looking at:

https://github.com/crawl/sequell/blob/master/commands/source.pl#L57

it seems that the !source command is already using 'L', but presently Sequell is outputting 'l' here. Does the live copy of the script need updating?

'recent' keyword argument for sequell

a 'recent' keyword argument that limits the search to games/milestones from the current version and one version back, so right now it would be '!lg * cv~~(0.11|0.12), and when 0.13-a starts it would be (0.12|0.13) and so on.

Add 0.18 branches and 0.18 tournament to Sequell

The tournament is scheduled for 20:00 UTC Friday 6 May to 20:00 UTC Sunday 22 May.

The following servers have a 0.18 branch set up with their logfile/milestones and any rcfiles and ttyrecs available from the same base URLs as their other branches:

http://crawl.berotato.org/crawl/meta/0.18/
http://crawl.xtahua.com/crawl/meta/0.18/
https://crawl.jorgrun.rocks/meta/0.18/
http://underhound.eu:81/crawl/meta/0.18/
http://lazy-life.ddo.jp:8080/meta/0.18/
https://crawl.project357.org/dcss-logfiles-0.18 and https://crawl.project357.org/dcss-milestones-0.18
http://crawl.develz.org/allgames-0.18.txt and http://crawl.develz.org/milestones-0.18.txt

We're still waiting on getting CAO set up and we're waiting to hear from the CWZ admin. I'll update the issue when 0.18 is available for those two servers.

seqdb fetch lags servers

Using the seqdb fetch command causes lags/degraded experience for players, it might be good to throttle the downloads or create another command to only download a small part of the data for running sequell locally

Another idea is to host a prefilled postgres database for people to import instead of downloading everything from each server as the main path.

`seqdb load ` fails with error `panic: pq: relation "l_file" does not exist`

I'm trying to run a local instance of Sequell to analyze my offline games. In order to build all the environment it needs I wrote step by step the following Dockerfile:

FROM phusion/baseimage
ADD . /sequell
RUN apt-get update -y 
RUN apt-get install -y golang ruby perl make postgresql git postgresql-contrib build-essential mercurial
RUN apt-get install -y libpthread-stubs0-dev wget
RUN  wget https://re2.googlecode.com/files/re2-20140304.tgz && tar xvf re2*.tgz && cd re2 && make && make install
RUN chown -R postgres:postgres /sequell
RUN    /etc/init.d/postgresql start &&\
    sudo -u postgres psql --command "CREATE USER sequell WITH SUPERUSER PASSWORD 'sequell';" &&\
    sudo -u postgres createdb -O sequell sequell &&\
    sudo -u postgres psql -d sequell --command "CREATE EXTENSION citext;"
ENV GOPATH /go
RUN mkdir /go
RUN cd sequell && make
ENV PATH /go/bin:$PATH
ENV PERL_MM_USE_DEFAULT 1

RUN cpan -i DBI
RUN apt-get install -y libpq-dev
RUN cpan -i DBD::Pg
RUN cpan -i DBD::SQLite
RUN cpan -i Bot::BasicBot
RUN cpan -i YAML::XS
RUN cpan -i YAML::Any
RUN cpan -i Tie::Cache
RUN cpan -i File::Next
RUN cpan -i App::Nopaste
RUN cpan -i re::engine::RE2
RUN cpan -i Lingua::Stem
RUN cpan -i Text::Levenshtein::Damerau
RUN cpan -i Text::Levenshtein::Damerau::XS
RUN cpan -i JSON
RUN cpan -i Sub::Recursive
RUN cpan -i HTML::Entities

# RUN cd /sequell && scripts/install-perl-modules && gem install bundler && bundle install
RUN apt-get install -y bundler libsqlite3-dev
WORKDIR /sequell
RUN bundle install
RUN apt-get install -y postgresql-9.3-orafce
USER postgres
RUN /etc/init.d/postgresql start && psql -d sequell --command "CREATE EXTENSION orafce;"
RUN /etc/init.d/postgresql start && seqdb --host /var/run/postgresql createdb 
RUN /etc/init.d/postgresql start && seqdb fetch 
RUN /etc/init.d/postgresql start && seqdb load 
RUN /etc/init.d/postgresql start && seqdb create-indexes

Building it fails on seqdb load stage with the following error:

panic: pq: relation "l_file" does not exist

While all the previous difficulties resolved by splitting install commands and installing requirements not mentioned, this issue seem to be from some relation (table?) not created or referenced incorrectly.

queries containing ' are echoed wrong

20:56 <rwbarton> !lg * vmsg="succumbed to something's poison gas" s=place
20:56 <Sequell> 30 games for * (vmsg='succumbed to something\1s poison gas'): 12x Abyss:1, 3x Swamp:5, 2x Swamp:2, 2x Swamp:1, Abyss:2, D:1, D:12, Pan, Zot:5, Lair:4, Swamp:4, Depths:4, Depths:3, D:4, Lair:3

The \1 looks like a regex replacement gone wrong.

Kramell proxy auth failing

With Kramell in ??:acl:proxy, "!RELAY -nick asdf !lm" gets no response.
If I remove Kramell from that acl it works again, although it no longer has editting permissions.

Add parameter handling to !cmd

!cmd currently executes the defined command with the rest of the message concatenated onto the end. This limits the possibilities of !cmd. I'm not sure how difficult or unsafe this would be, but handling parameters/arguments would be nice.

Something like this:

!cmd greaterplayer !lg * playable s=crace / @$1 won ?: N=0
!greaterplayer pivotal

or

!cmd greaterrace !lg * playable crace=$1 / @$2 won ?: N=0
!greaterrace dg pivotal

ratio queries with -graph should graph the ratio

I wanted to see a graph of what proportion of milestones were in stable version games on each day. I thought !lm * recent s=day(time) / !alpha -graph would do it, but it produces the same graph as !lm * recent s=day(time) -graph.

authentication failing

<Kramin> !learn add :beh: test
<Sequell> Could not authenticate Kramin with services for !learn add :beh: test

I checked I am logged in with NickServ. I believe this error has been causing the !RELAY command to fail for Kramell too. As far as I can tell, it began after a freenode netsplit, so possibly it was caused by that, I can't think of anything else that would cause it to suddenly start failing.

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.