Francisation et adaption a l'April

This commit is contained in:
root 2016-05-17 16:40:48 +02:00
parent ea79cc76c3
commit fd09e1e4d7
3 changed files with 19 additions and 14 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ local
bin
error.log
nicks.csv
nohup.out

24
bot.py
View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -1 -*-
# Welcome to WelcomeBot. Find source, documentation, etc here: https://github.com/shaunagm/WelcomeBot/ Licensed https://creativecommons.org/licenses/by-sa/2.0/
# Import some necessary libraries.
@ -65,7 +67,7 @@ def irc_start(server): # pragma: no cover (this excludes this function from tes
return ircsock
def join_irc(ircsock, botnick, channel):
ircsock.send("USER {0} {0} {0} :This is http://openhatch.org/'s greeter bot"
ircsock.send("USER {0} {0} {0} :Robot d'accueil de https://april.org."
".\n".format(botnick)) # bot authentication
ircsock.send("NICK {}\n".format(botnick)) # Assign the nick to the bot.
if os.path.isfile("password.txt"):
@ -100,12 +102,14 @@ def get_regex(options, botnick):
# Welcomes the "person" passed to it.
def welcome_nick(newcomer, ircsock, channel, channel_greeters):
ircsock.send("PRIVMSG {0} :Welcome {1}! The channel is pretty quiet "
"right now, so I thought I'd say hello, and ping some people "
"(like {2}) that you're here. If no one responds for a "
"while, try emailing us at hello@openhatch.org or just try "
"coming back later. FYI, you're now on my list of known "
"nicknames, so I won't bother you again."
ircsock.send("PRIVMSG {0} :Bonjour {1} Je suis un robot IRC. Ce salon est tranquille actuellement, "
"je me permets donc de vous dire bonjour. Je signale à des actifs de l'April "
"(comme {2}) que vous êtes là."
"\n".format(channel, newcomer, greeter_string(channel_greeters)))
ircsock.send("PRIVMSG {0} :{1} Si personne ne répond d'ici quelques minutes, "
"vous pouvez nous envoyer un courriel à contact@april.org ou revenir plus tard. "
"Vous êtes désormais dans ma liste d'identifiants connus. Je ne vous enverrai plus de message."
"\n".format(channel, newcomer, greeter_string(channel_greeters)))
# Checks and manages the status of newcomers.
@ -127,7 +131,7 @@ def parse_messages(ircmsg):
# Cleans a nickname of decorators/identifiers
def clean_nick(actor):
if actor: # In case an empty string gets passed
if actor.find("openhatch") != -1: # If nick is like "openhatch_1234" don't clean.
if actor.find("april") != -1: # If nick is like "openhatch_1234" don't clean.
return actor
actor = actor.replace("_", "") # Strip out trailing _ characters
while(actor[-1]) in "1234567890": # Remove trailing numbers
@ -198,9 +202,9 @@ def greeter_string(greeters):
if len(greeters) > 2:
for name in greeters[:-1]:
greeterstring += "{}, ".format(name)
greeterstring += "and {}".format(greeters[-1])
greeterstring += "et {}".format(greeters[-1])
elif len(greeters) == 2:
greeterstring = "{0} and {1}".format(greeters[0], greeters[1])
greeterstring = "{0} et {1}".format(greeters[0], greeters[1])
else:
greeterstring = greeters[0]
return greeterstring

View File

@ -1,17 +1,17 @@
# Replace these default settings with your own personal settings
# IRC configuration
channel = "#openhatch"
botnick = "welcomebot"
channel = "#april-accueil"
botnick = "bot_d_accueil"
server = "irc.freenode.net"
registered = False
# Bot behavior
wait_time = 60
channel_greeters = ["shauna", "paulproteus", "marktraceur"]
channel_greeters = ["madix", "cioccolisa", "cpm__", "lonugem" ]
nick_source = "nicks.csv"
# Bot text
hello_list = ["hello", "hi", "hey", "yo", "sup"]
help_list = ["help", "info", "faq", "explain_yourself"]
welcome_message = "Welcome! The channel is pretty quiet right now, so I thought I'd say hello, and ping some people that you're here. If no one responds for a whle, try emailing us at hello@openhatch.org or just try coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again."
welcome_message = "Welcome! The channel is pretty quiet right now, so I thought I'd say hello, and ping some people that you're here. If no one responds for a whle, try emailing us at contact@april.org or just try coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again."