Francisation et adaption a l'April
This commit is contained in:
parent
ea79cc76c3
commit
fd09e1e4d7
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ local
|
|||||||
bin
|
bin
|
||||||
error.log
|
error.log
|
||||||
nicks.csv
|
nicks.csv
|
||||||
|
nohup.out
|
||||||
|
24
bot.py
24
bot.py
@ -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/
|
# 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.
|
# Import some necessary libraries.
|
||||||
@ -65,7 +67,7 @@ def irc_start(server): # pragma: no cover (this excludes this function from tes
|
|||||||
return ircsock
|
return ircsock
|
||||||
|
|
||||||
def join_irc(ircsock, botnick, channel):
|
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
|
".\n".format(botnick)) # bot authentication
|
||||||
ircsock.send("NICK {}\n".format(botnick)) # Assign the nick to the bot.
|
ircsock.send("NICK {}\n".format(botnick)) # Assign the nick to the bot.
|
||||||
if os.path.isfile("password.txt"):
|
if os.path.isfile("password.txt"):
|
||||||
@ -100,12 +102,14 @@ def get_regex(options, botnick):
|
|||||||
|
|
||||||
# Welcomes the "person" passed to it.
|
# Welcomes the "person" passed to it.
|
||||||
def welcome_nick(newcomer, ircsock, channel, channel_greeters):
|
def welcome_nick(newcomer, ircsock, channel, channel_greeters):
|
||||||
ircsock.send("PRIVMSG {0} :Welcome {1}! The channel is pretty quiet "
|
ircsock.send("PRIVMSG {0} :Bonjour {1} Je suis un robot IRC. Ce salon est tranquille actuellement, "
|
||||||
"right now, so I thought I'd say hello, and ping some people "
|
"je me permets donc de vous dire bonjour. Je signale à des actifs de l'April "
|
||||||
"(like {2}) that you're here. If no one responds for a "
|
"(comme {2}) que vous êtes là."
|
||||||
"while, try emailing us at hello@openhatch.org or just try "
|
"\n".format(channel, newcomer, greeter_string(channel_greeters)))
|
||||||
"coming back later. FYI, you're now on my list of known "
|
|
||||||
"nicknames, so I won't bother you again."
|
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)))
|
"\n".format(channel, newcomer, greeter_string(channel_greeters)))
|
||||||
|
|
||||||
# Checks and manages the status of newcomers.
|
# Checks and manages the status of newcomers.
|
||||||
@ -127,7 +131,7 @@ def parse_messages(ircmsg):
|
|||||||
# Cleans a nickname of decorators/identifiers
|
# Cleans a nickname of decorators/identifiers
|
||||||
def clean_nick(actor):
|
def clean_nick(actor):
|
||||||
if actor: # In case an empty string gets passed
|
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
|
return actor
|
||||||
actor = actor.replace("_", "") # Strip out trailing _ characters
|
actor = actor.replace("_", "") # Strip out trailing _ characters
|
||||||
while(actor[-1]) in "1234567890": # Remove trailing numbers
|
while(actor[-1]) in "1234567890": # Remove trailing numbers
|
||||||
@ -198,9 +202,9 @@ def greeter_string(greeters):
|
|||||||
if len(greeters) > 2:
|
if len(greeters) > 2:
|
||||||
for name in greeters[:-1]:
|
for name in greeters[:-1]:
|
||||||
greeterstring += "{}, ".format(name)
|
greeterstring += "{}, ".format(name)
|
||||||
greeterstring += "and {}".format(greeters[-1])
|
greeterstring += "et {}".format(greeters[-1])
|
||||||
elif len(greeters) == 2:
|
elif len(greeters) == 2:
|
||||||
greeterstring = "{0} and {1}".format(greeters[0], greeters[1])
|
greeterstring = "{0} et {1}".format(greeters[0], greeters[1])
|
||||||
else:
|
else:
|
||||||
greeterstring = greeters[0]
|
greeterstring = greeters[0]
|
||||||
return greeterstring
|
return greeterstring
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
# Replace these default settings with your own personal settings
|
# Replace these default settings with your own personal settings
|
||||||
|
|
||||||
# IRC configuration
|
# IRC configuration
|
||||||
channel = "#openhatch"
|
channel = "#april-accueil"
|
||||||
botnick = "welcomebot"
|
botnick = "bot_d_accueil"
|
||||||
server = "irc.freenode.net"
|
server = "irc.freenode.net"
|
||||||
registered = False
|
registered = False
|
||||||
|
|
||||||
# Bot behavior
|
# Bot behavior
|
||||||
wait_time = 60
|
wait_time = 60
|
||||||
channel_greeters = ["shauna", "paulproteus", "marktraceur"]
|
channel_greeters = ["madix", "cioccolisa", "cpm__", "lonugem" ]
|
||||||
nick_source = "nicks.csv"
|
nick_source = "nicks.csv"
|
||||||
|
|
||||||
# Bot text
|
# Bot text
|
||||||
hello_list = ["hello", "hi", "hey", "yo", "sup"]
|
hello_list = ["hello", "hi", "hey", "yo", "sup"]
|
||||||
help_list = ["help", "info", "faq", "explain_yourself"]
|
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."
|
||||||
|
Loading…
Reference in New Issue
Block a user