bot only announces users as they leave, not as they join
Opened this issue · 3 comments
the bot definitely announces each user as they leave, but no announcement when they join. is there a way to enable a greeting and possibly their account name as well in that greeting?
`# User Greeting
Odsum
import random
import time
class Welcome:
def __init__(self, tinybot, conf):
"""
Initialize the Spam class.
:param tinybot: An instance of TinychatBot.
:type tinybot: TinychatBot
:param conf: The config file.
:type conf: config
"""
self.tinybot = tinybot
self.config = conf
def welcome(self, uid, greet):
time.sleep(0.2)
greet = ["Hi", "Sup", "Yo", "Hey", "Eh", 'Waddup' , 'Greetings Earthling',]
prefix = self.config.B_PREFIX
_user = self.tinybot.users.search(uid)
if _user is None:
return False
if not self.config.B_ALLOW_GUESTS:
return False
if self.config.B_GREET:
if _user.nick.startswith('guest-'):
return False
if greet:
if self.config.B_VERBOSE:
time.sleep(1.2)
self.tinybot.send_chat_msg('%s [%s], Welcome to *ROOM*!' % (random.choice(greet),_user.nick))
if greet:
if _user.user_level < 4:
time.sleep(1.6)
self.tinybot.send_private_msg(_user.id, 'Mod Level - %shelp for cmds' % prefix)
time.sleep(0.9)
self.tinybot.send_private_msg(_user.id,
'\n %s %s' % (self.tinybot.boticon, self.tinybot.announcement()))
return False
elif _user.user_level == 5:
time.sleep(1.4)
self.tinybot.send_private_msg(_user.id,
'%s %s, wb - You have access to the bot here, %shelp for cmds' % (
random.choice(greet), _user.nick, prefix))
time.sleep(1.0)
self.tinybot.send_private_msg(_user.id,
'\n %s %s' % (self.tinybot.boticon, self.tinybot.announcement()))
return False
elif _user.user_level == 7:
if self.config.B_VERBOSE:
time.sleep(1.5)
self.tinybot.send_chat_msg(
'%s %s, welcome to %s' % (random.choice(greet), _user.nick, self.tinybot.room_name))
return False
return True
return True
`
Changing your welcome.py to reflect the above will give you a welcome message.
Not sure if its completely accurate, but it works XD
welcome.zip
Here is the file if its easier. just extract amd then drop it into your modules and replace the original welcome.py
@SmokeyLlama props for posting some code, however it'd be most helpful to include the version of the file that snippet of code is from, that way rather than have bugs from one random section being slightly off, someone can easily correct their off-by-one (for example people that only needed to change +bandword
to +banword
).
I'm hesitant to help anyone from this repo as it is essentially dead, the only fork of this that has any degree of changed code is pretty goofy, and to be blunt outright shouldn't be used. @odsum can we please get some direct answers/action? I would prefer to let deprecated/abandoned things die before I unnecessarily further the fragmentation of the bot community. See: #34 (comment)