Code Monkey home page Code Monkey logo

triviabot's Introduction

triviabot

A simple IRC trivia bot written in python using twisted.

Features

Simple implementation. Questions are ` formatted in plain text files.

Configurable colored text to help differentiate game text from user text.

Event driven implementation: uses very little cycles.

Implementation

triviabot uses a config.py and comes with an example for you to tweak and use.

Questions exist in files under $BOTDIR/questions. Each round, a file is selected at random, then a line is selected at random from the file.

The answer is then masked and the question is asked. Periodically, the bot will ask the current question again and unmask a letter. This happens three times before the answer is revealed.

What the bot doesn't do.

  • It doesn't have multiple answers to a question. It shows you the format. Part of the game is to match its formatting.

  • Have error-free questions: the questions come from other bot implementations which themselves had horrible typos. There needs to be an army of editors to go through the 350+k lines and format them to the standard format for the bot. The bot was written to catch malformed questions so it wouldn't crash, but if it technically matches ` there's no way for the bot to understand that's not part of the question.

Todo:

Look at the issues. Pull requests welcome.

Contact, Support, Development:

Quakenet IRC - #triviabot-dev http://webchat.quakenet.org/?channels=triviabot-dev

GitHub Issues/Tickets https://github.com/rawsonj/triviabot/issues

License:

Released under the GPLv3.

triviabot's People

Contributors

aerosteveo avatar andy5995 avatar duress-to-kill avatar edunham avatar genius3000 avatar jasonaowen avatar mostawesomedude avatar nibalizer avatar nickchappell avatar nightfly19 avatar pfaffle avatar prill avatar rawsonj avatar za3k avatar

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  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

triviabot's Issues

Wrong answer

in questions_08, line 465. Category:Science He transmitted radio signals across the Atlantic in 1901.`Enrico Marconi That's the wrong Marconi. It was Guglielmo Marconi.

using a database for questions and answers

I'm not sure how much this would help, and don't necessarily think it's the best idea, but wanted to open up a discussion about it.

Would using a database make it easier to edit, organize, and manage the questions?

If a database were used, should it only be used for organization and editing, but then exported back to text files? (thereby avoiding having to add database support to trivia.py)

Standings blank

First of all, my apologies that I'm unable to figure out how to fix this myself. It is quite likely a configuration issue on my end.

FreeBSD 10.0 & Python 2.7.12 installed via ports.

only changes I made to config.py were:
GAME_CHANNEL = '#triviatesting'
ADMINS = ['mynick']
DEFAULT_NICK = 'dantriviabot'
SERVER_PORT = 6697

The bot seems to work OK, and it is keeping track of scores (the ?score command reports the correct points total, even if the bot is killed and re-started) but whenever it spits out standings (or if I issue the ?standings command) it just says:

dantriviabot: The current trivia standings are:

and that's it (ETA: it doesn't crash, it just doesn't provide any list of names). I barely know anything about python so I'm sort of unsure as to whether I have something misconfigured or if there's some other package I need to install. Any ideas? Thanks!

color code stuff also eats dollar signs

14:56 <@trivia> Useless Trivia: Lee Harvey 
                Oswald's body tag was auctioned 
                off for---------- .
14:56 <@trivia> Clue: $6,6**
14:56 < edunham> $6,600
14:56 <@trivia> Question:
14:56 <@trivia> Useless Trivia: Lee Harvey 
                Oswald's body tag was auctioned 
                off for---------- .
14:56 <@trivia> Clue: $6,6*0
14:57 <@trivia> No one got it. The answer was: 
                $6,600

Always give three clues

The current system is to give one clue for short words, and 3 clues for long words. Please give MAX(3, N-1) clues for all words, and just make it easier. One common problem is years: "1---" is a very bad clue for "birth of albert einstein".

Official #triviabot-dev channel on QuakeNet

I registered an unofficial #triviabot-dev channel on Quakenet.

If @rawsonj wants to make it official, please let me know and I will op you and grant you ownership privileges.

If you'd like it deleted because of any conflicts with existing channels, I can do that too. :)

As far as I know, there's no existing dev IRC channel for triviabot. Is that right?

Question: Multiple data files?

Is there any reason the question data is in multiple files? Is this to reduce RAM usage or something?

Was considering doing a Python3 port (to fix #78) and saw some unrelated stuff that might be worth cleaning up.

add config option for different WAIT_INTERVAL

I suggest adding an option so the time between clues can be set differently than the time between questions. This would give admins some flexibility on what kind of "atmosphere" they'd like in their channels.

I'll write this code if you agree.

a more graceful death

Someone suggested recently that tb should die more gracefully

Update: This example catches a ctrl-c, and no errors are reported. But I haven't figured out how yet.

http://pastebin.com/dS3BupHx

Received SIGINT, shutting down.
2016-09-02 13:44:14-0500 [-] Main loop terminated.

Clean up msg.

The msg code is really ugly. Write a wrapper function that does formatting for the message.

clues give away answers that are 3 characters or less

Clues give away answers that are 3 characters or less.

Some answers are only one letter, and it's shown after the first hint.

And years can be pretty easy to guess, too.

_691

Hmm.. probably 1. ;)

Maybe only give 1 clue if string length is less than 3, and no clues on answers that are only 1 character? Something along those lines?

Fix the stupid lambda some day.

Why am I getting this when trying to load trivia.py as a plugin in HexChat?:
File "/home/lvr/Downloads/triviabot-master/trivia.py", line 450
sorted_scores = sorted(self._scores.iteritems(), key=lambda (k, v): (v, k), reverse=True)
^
SyntaxError: invalid syntax

Please help

Port the bot to python3.

From #76.

I don't think maintaining backward compatibility is required. The python universe has moved on, so should I.

HI

**

    1. Hello greetings. I was wondering, if anyone can answer my question. I am not a python coder, nor a programmer. But the bot is very good. I've been running it, and is very amazing. The only request. I am asking. if someone can help me to. achieved this. for example when every time a. User answers the correct answer. it says nick got it.
    1. what. I want to achieved is for example to say nick you got it. and then to stay all the scores from the users. who are in the database. Of the bot. and also can you guys port the bot to python3? thank you in advance.

**

show correct answer when someone wins

Some questions inspire guessing, and if someone guess several answers in quick succession, one of which is right, it's not obvious what the correct answer is.

Implement ?next voting for unpriviledged users.

The masses wish to be able to skip questions they don't like.
It should want 3 peoples votes before it skips, then resets state. Also should reset state on a change in quesiton regardless of if it was skipped or not.

Improve skip vote system

The current skip vote system is a hardcoded number, 3. This really kind of sucks--I play on FCN, and there still are never enough people voting to skip. It ranges from 0-1 players at night, to maybe 5 during peak hours.

Perhaps you can count the unique people guessing in say, the last 10 minutes, and set the number of skips needed to MIN(guessers, 3)

show winner's total points

When someone gets an answer correct, show both how many points were added (as is done now) and their total points.

Limit the number of standings so we don't wait 10 minutes for them to be printed out.

Due to #46 being resolved, users can now see the standings the bot is keeping track of.

The issue here is that maybe we've recorded a few hundred users playing the game, and if the rate-limiting is set to a large-ish number (say 1 second) we may wait for several minutes as the standings are queued instantly in the bot but sent to the server at the configured rate.

Several trivia questions can then be queued up and go by while the standings are still being printed out.

This can be fixed in one of two ways:

1: Limit the standings to the top ten, or maybe just the ten people around where the user is, or some variation on this. This would put an upper bound on the time required to print out the standings.

Pros:

  • Simple to implement.

Cons:

  • We're still waiting to see questions in the main channel, and it still disrupts the game, just not for as long.
  • We would be removing the ability to see the complete standings, which may be preferred in some cases.

2: Implement a priority queue or multiple queues. This may be preferable because if a user wants to see the complete standings they don't care about getting them as fast as possible, but the game should keep running as normal and be just as responsive as it normally would be.

Pros:

  • Avoids the cons of the first implementation.

Cons:

  • Not as simple to implement as the first implementation.

logging reported questions

With regard to #50, is it a feature you're interested in?

If so, I thought what would be more effective is a user being able to report the question number.

I could write a program in C that would write a string at the start of each line, numbering them, so each line would start with a string such as
Q [ 000001 ]
Q [ 005929 ]

Using a string of the same length, each line could be renumbered in the future.

What are your thoughts on this?

Daemonize the bot and make a debug mode.

I'm tired of running it in a screen. We don't have to stay attached to the thing while its running, and it makes sense to daemonise it unless we pass it a --debug, where it will not daemonise and will interact with whoever is attached to it.

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.