53 Commits (master)
 

Author SHA1 Message Date
Matteo Cypriani f3f9b9baa8 Allow disabling welcome messages (--welcome)
Add the --welcome option, that takes an on/off parameter and
enables/disables welcome messages when a new user joins the MUC.
The default is enabled.

send_welcome() was refactored from muc_online().

Issue: RoboTux's rant.
7 years ago
Matteo Cypriani 43e04dc62d README: add note about config file
Also:
- update usage message
- kaabot.py: update description (period needed after the description,
  because of ConfigArgParse automatic message).
7 years ago
Bogdan Cordier b5efa11228 Config file support
- CLI arguments can now be saved to/read from config file.
- Arguments format : name= value
- Replaced argparse module with configargparse.
- Modified debug argument accordingly to configargparse behavior.
7 years ago
Bogdan Cordier 473f30c484 Fix timestamp format 7 years ago
Bogdan Cordier 52fc9d0273 Show timestamp in log 7 years ago
Bogdan Cordier 034a80c7a3 Fix vocabulary file reading method 7 years ago
Matteo Cypriani fc66f256c8 Fix bug when XDG directories are not detected 7 years ago
Matteo Cypriani c606a6293a Send uptime publicly when requested publicly
The uptime is now sent on the MUC if the command was in a public
message, and privately if the bot was contacted privately.

The parse_command()'s `echo` argument was renamed `priv` to better
reflect the logic.
7 years ago
Matteo Cypriani f343a48f8b Tweak vocabulary file
- Use non-breakable spaces as-needed.
- Be more gender-neutral.
- Minor fixes.
7 years ago
Matteo Cypriani d39e6dcea9 Use vocabulary file for welcome & greetings
- greetings = the bot's first message upon arrival in the MUC.
- welcome = message the bot sends whenever somebody connects.

Closes: #4
7 years ago
Matteo Cypriani c4142d95fb Use vocabulary file for uptime
Issue: #4
7 years ago
Matteo Cypriani 3f65cc7acd Use vocabulary file for sending the log
Issue: #4
7 years ago
Matteo Cypriani 0528cc250c Use vocabulary file for help message
Issue: #4
7 years ago
Matteo Cypriani 6b155256ab Use pick_sentence() for direct messages
Added "refusals" category in the vocabulary file.

Issue: #4
7 years ago
Matteo Cypriani a7bf447fe3 Refactoring: add pick_sentence()
Issue: #4
7 years ago
Bogdan Cordier 670087638e Revert "Clean import"
This reverts commit 442c50cbd1.

* pyxdg submodule BaseDirectory can't be imported from main module.
7 years ago
Matteo Cypriani 071158591d Improve license stuff
- Renamed LICENSE -> COPYING.
- Added email addresses.
- Added copyright header in kaabot.py.
- Slightly improved README.
7 years ago
Bogdan Cordier 445ba23eef PEP 8 cleanups & refactoring 7 years ago
Octogene cbec099251 Add License
- README : Add license section & delete logo integration.
- Removed logo for copyrights reasons.
7 years ago
Octogene 644bdd7742 README : update requirements 7 years ago
Octogene 95d3b65ee7 Add requirements file 7 years ago
Octogene 442c50cbd1 Clean import 7 years ago
Matteo Cypriani 43dab85ef5 README: add Installing section, update usage 7 years ago
Matteo Cypriani 2e3485cb28 Handle XDG paths for the database file
The default file name is now "{muc}.db", with "{muc}" substituted with
the name of the current MUC. The substitution done in the user-provided
database file name as well. This makes easy to handle multiple instances
of the bot connecting to several MUCs.

This will also allow one to set up an alternative data directory in the
(future) configuration file, as simply as:
  database = /var/lib/kaabot/{muc}.db

This commit also changes the short option for --database from -db to -b
(like base). This avoids having a single-dash long option.
7 years ago
Matteo Cypriani dc60ed97f8 Handle XDG paths to search for vocabulary file 7 years ago
Octogene 62d9e9a308 Renaming KaaBot class variable room
Renaming in accordance with cli arguments.
7 years ago
Matteo Cypriani 5d96b90072 Code wrap & minor fixes
- Wrap the few lines that still were longer than 80 characters.
- Drop long commands "backlog" and "historique" from the bot's help
  message, since they are not (and won't be) implemented.
- Fix typo in JSON decoding warning message ("filenam").
7 years ago
Matteo Cypriani d0dd4bb772 Fix JSON exception for Python < 3.5
Also drop useless import string.
7 years ago
Octogene 9f35575fae Refactoring
- More readable & idiomatic code for vocabulary handling.
- Refactored hardcoded string length.
7 years ago
Matteo Cypriani 5a47f90663 Read insults from a JSON file
- New option --vocabulary to provide the path to a vocabulary file
  (default: vocabulary.json in the working directory).

- Added file vocabulary.json with the current set of insults. The schema
  is done so we can extend it with other categories of vocabulary (I'm
  thinking of a "greetings" category).

Closes: #4
7 years ago
Matteo Cypriani ae25f31506 Add more insults 7 years ago
Matteo Cypriani 127b250ec4 Fix bug with the bot's nick at the end of a line 7 years ago
Matteo Cypriani 85d10d3e9d Handle private messages
- The bot now accepts commands sent privately.

- Whenever someone tries to read the log by a private message, the bot
  reports it publicly.

- When a private message is not a valid command, the user is insulted
  publicly.

- Direct messages (sent with the bot's JID, not from a MUC) are refused.

Closes: #1, #2
7 years ago
Matteo Cypriani 50624e9127 Send named welcome message 7 years ago
Matteo Cypriani 32f7b46976 Send named insults 7 years ago
Octogene 939f87fdcf Update cli argument in README 7 years ago
Octogene 993e131b4f Add comma & non-breaking space to cmd cleaning. 7 years ago
Matteo Cypriani 1ee9e9165f Improve command parsing
- The bot now interprets ':', and strip extra whitespaces.
- The general logic of the tests was improved, parse_command() was added
  to make thinks clearer.
7 years ago
Matteo Cypriani ca12532063 Log every message
Log every public message, including the bot's own ones.
7 years ago
Matteo Cypriani 5710c07025 Make Python 3 version actually work
* Quit setting encoding:
  UTF-8 is used by default in Python 3, hence the Python 3 version of
  sleekxmpp does't have setdefaultencoding().

* Use input() instead of raw_input().
7 years ago
Octogene b82d1f67e9 Refactor send_log
- Fix table user type initialisation.
- Code cleaning.
7 years ago
Matteo Cypriani e348e95521 Switch to Python 3 7 years ago
Octogene 6c9e3279a1 Add uptime cmd & changes in cmd system.
- Add bot behavior on unknown command.
- Modified muc got_online presence handling.
- Refactoring.
- Code cleaning.
- Comments.
7 years ago
Matteo Cypriani 5538249dae README: fix relative link
Relative links in READMEs are apparently different than on the wikis
(/login/project/ is required).
7 years ago
Matteo Cypriani a4acaee100 Refactoring: add send_help() & send_log() 7 years ago
Matteo Cypriani 38ff7c8a27 Add --nick option 7 years ago
Matteo Cypriani 43be0c4e86 Add argparse description 7 years ago
Matteo Cypriani baef6839af Make kaabot.py executable 7 years ago
Matteo Cypriani 5637748869 README: use relative link & cosmetic changes 7 years ago
Octogene 814d3fb93b Fix /log cmd behavior
- Bot answers /log cmd on private chat.
7 years ago