tinychat auto greet auto messanger

im trying to set up a script that will auto  greet people when they join with a editable message

also  not flood  and know to pause and wait  then message 

possibly set a message  if the room owner joins  or if a mod joins 

have  a tinychat bot that  has kinda what i wanna do  scripted in it  in py

 so i kinda wanna use the same  bits off the bot to be able to use in tampermonkey

id appreciate if u can kinda help me or see what i got  and show me what id need to  make it work

here are bits and parts  from the bot script i figured be what id need 

“”" Toggles if users should be greeted on entry. “”"
pinylib.CONFIG.B_GREET = not pinylib.CONFIG.B_GREET
if not s:
self.handle_msg(‘Greet Users: %s’ % pinylib.CONFIG.B_GREET)

for cset in csets:
cmds = ", ".join(cset)
time.sleep(1.5)
self.send_private_msg(self.active_user.id, ‘%s’ % cmds)

def welcome(self, uid, greet):

while True:
time.sleep(0.2)
greetings = [“hi”, “sup”, “yo”, “hey”, “eh”,]
prefix = pinylib.CONFIG.B_PREFIX
_user = self.users.search(uid)

if _user is None:
break

if not pinylib.CONFIG.B_ALLOW_GUESTS:
break

cmds_av.sort()
cmds_dump = [prefix + cmd for cmd in cmds_av]
csets = zip(*[iter(cmds_dump)] * 8)
self.send_private_msg(self.active_user.id, ‘\n\n %s Available Commands:’ % self.boticon)

for cset in csets:
cmds = ", ".join(cset)
time.sleep(1.5)
self.send_private_msg(self.active_user.id, ‘%s’ % cmds)

def welcome(self, uid, greet):

while True:
time.sleep(0.2)
greetings = [“hi”, “sup”, “yo”, “hey”, “eh”,]
prefix = pinylib.CONFIG.B_PREFIX
_user = self.users.search(uid)

if _user is None:
break

if not pinylib.CONFIG.B_ALLOW_GUESTS:
break

elif cmd == prefix + ‘greet’:
self.do_greet(0)

def on_join(self, join_info):
“”"
Received when a user joins the room.

:param join_info: This contains user information such as role, account and so on.
:type join_info: dict
“”"
log.info(‘user join info: %s’ % join_info)
_user = self.users.add(join_info)

if _user.account:
if _user.is_owner:
_user.user_level = 1
self.console_write(pinylib.COLOR[‘red’], ‘Room Owner %s:%d:%s’ %
self.send_chat_msg("ALL HAIL THE KING HAS RETURNED ")
(_user.nick, _user.id, _user.account))
elif _user.is_mod:
_user.user_level = 3
self.console_write(pinylib.COLOR[‘bright_red’], ‘Moderator %s:%d:%s’ %
self.send_chat_msg(“One of Our Staff has Returned Moderator %s WB”)
(_user.nick, _user.id, _user.account))
else:
self.console_write(pinylib.COLOR[‘bright_yellow’], ‘%s:%d has account: %s’ %
(_user.nick, _user.id, _user.account))

if not self.user_check(_user, account=True, guest=True, nick=True, lurker=True):
if pinylib.CONFIG.B_GREET and self.is_client_mod:
if not _user.nick.startswith(‘guest-’):
if _user.account:
self.send_chat_msg('Welcome to %s %s:%s:%s Please Keep Mic Muted Hosting system in effect ’ %
(self.room_name, _user.nick, _user.id, _user.account))
else:
self.send_chat_msg('Welcome to %s %s:%s Please Keep Mic Muted Hosting system in effect ’ % (_user.nick, _user.id))

self.console_write(pinylib.COLOR[‘cyan’], ‘%s:%d joined the room.’ % (_user.nick, _user.id))

def on_nick(self, uid, nick):
“”"
Received when a user changes nick name.

:param uid: The ID (handle) of the user.
:type uid: int
:param nick: The new nick name.
:type nick: str
“”"
_user = self.users.search(uid)
old_nick = _user.nick
_user.nick = nick

if uid != self.client_id:
if not self.user_check(_user, nick=True):
if pinylib.CONFIG.B_GREET and self.is_client_mod:
if old_nick.startswith(‘guest-’):
if _user.account:
self.send_chat_msg('Welcome to the Party %s:%s:%s Please Keep Mic Muted Hosting system in effect  %
(_user.nick, _user.id, _user.account))
else:
self.send_chat_msg('Welcome to the Party %s:%s Please Keep Mic Muted Hosting system in effect % (_user.nick, _user.id))

self.console_write(pinylib.COLOR[‘bright_cyan’], ‘%s:%s Changed nick to: %s’ % (old_nick, uid, nick))

}
}
})();