Skip to content

Commit

Permalink
[#63] implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Linedwell committed Jul 20, 2018
1 parent 7d14612 commit 3bf5ed0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
'it' : u'{{Benvenuto}}%s',
}

welcomeschoolmsg = {
'fr' : u'{{Bienvenue école}}%s',
}

schooldiscriminator = {
'fr' : ur'coll[eè]ge|[eé]cole|cdi|lyc[eé]|prof',
}

welcomelog = {
'fr' : u'User:LinedBot/Welcome/Log',
'it' : u'User:LinedBot/Welcome/Log',
Expand Down Expand Up @@ -103,7 +111,7 @@ def run(self):
#print user.name()
if user.isBlocked():
#showStatus(3)
pywikibot.output(u" %s is blocked; skipping." % user.name())
pywikibot.output(u"%s is blocked; skipping." % user.name())
continue
if "bot" in user.groups():
#showStatus(3)
Expand All @@ -123,6 +131,12 @@ def run(self):
continue
else:
welcome_text = i18n.translate(self.site, welcomemsg)
welcome_school_text = i18n.translate(self.site, welcomeschoolmsg)
if welcome_school_text != None:
discrim = i18n.translate(self.site, schooldiscriminator)
if discrim != None and re.match(discrim, user.name().lower()): #if the discriminator exists and is present in username
pywikibot.output(u"%s is a maybe a school related account; using school welcoming templatei instead." % user.name())
welcome_text = welcome_school_text
if globalsettings['randomSign'] and len(self.signList) > 0:
sign = choice(self.signList)
else:
Expand Down

0 comments on commit 3bf5ed0

Please sign in to comment.