Glob2Chan: Add French welcome message.
parent
67663db91a
commit
27f37d397c
|
@ -50,8 +50,12 @@ __contributors__ = {}
|
|||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = '' # 'http://supybot.com/Members/yourname/Glob2Chan/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
try:
|
||||
from . import config
|
||||
from . import plugin
|
||||
except ImportError:
|
||||
import config
|
||||
import plugin
|
||||
from imp import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf8 -*-
|
||||
###
|
||||
# Copyright (c) 2010-2011, Valentin Lorentz
|
||||
# All rights reserved.
|
||||
|
@ -28,6 +29,8 @@
|
|||
|
||||
###
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.gis.geoip import GeoIP
|
||||
|
||||
import supybot.utils as utils
|
||||
|
@ -91,19 +94,13 @@ class Glob2Chan(callbacks.Plugin):
|
|||
return
|
||||
nick = msg.nick
|
||||
self._users.update({msg.nick: msg.prefix.split('@')[1]})
|
||||
if nick.startswith('[YOG]') and \
|
||||
nick not in self.registryValue('nowelcome').split(' '):
|
||||
irc.queueMsg(ircmsgs.privmsg(nick, ('Hi %s, welcome to the '
|
||||
'globulation online game room. There are currently %i '
|
||||
'people connected via IRC, they may awaken and challenge '
|
||||
'you to a game. Please stay here a few minutes, someone '
|
||||
'may connect in the meantime.') %
|
||||
(nick, len(irc.state.channels[channel].users))))
|
||||
if nick.startswith('[YOG]'):
|
||||
irc.queueMsg(ircmsgs.IrcMsg(s='WHOIS %s' % nick))
|
||||
|
||||
def do311(self, irc, msg):
|
||||
nick = msg.args[1]
|
||||
if not nick.startswith('[YOG]') or nick in self.registryValue('nowelcome').split(' '):
|
||||
return
|
||||
realname = msg.args[5]
|
||||
hostname = self._users.pop(nick)
|
||||
try:
|
||||
|
@ -112,6 +109,20 @@ class Glob2Chan(callbacks.Plugin):
|
|||
version = 'unknown version'
|
||||
g = GeoIP()
|
||||
country = g.country(hostname)['country_name']
|
||||
if country == 'France':
|
||||
irc.queueMsg(ircmsgs.privmsg(nick, ('Bonjour %s, bienvenue dans le '
|
||||
'salon de jeu Globulation2 en ligne. Il y a actuellement %i '
|
||||
'personnes connectées via IRC, elles pourraient se réveiller et '
|
||||
'jouer avec vous. Attendez ici au moins quelques minutes, '
|
||||
'quelqu\'un pourrait se connecter d\'ici là.') %
|
||||
(nick, len(irc.state.channels['#glob2'].users))))
|
||||
else:
|
||||
irc.queueMsg(ircmsgs.privmsg(nick, ('Hi %s, welcome to the '
|
||||
'globulation online game room. There are currently %i '
|
||||
'people connected via IRC, they may awaken and challenge '
|
||||
'you to a game. Please stay here at least a few minutes, '
|
||||
'someone may connect in the meantime.') %
|
||||
(nick, len(irc.state.channels['#glob2'].users))))
|
||||
irc.queueMsg(ircmsgs.privmsg('#glob2', ('Welcome to %s, running %s '
|
||||
'and connecting from %s.') % (nick, version, country)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue