irc: Add initial help message from service
patch c659a2d6a4a69276aaa838c05e8fd6f3988cefdc
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Mar 8 21:57:51 CET 2022
* irc: Add initial help message from service
diff -rN -u old-irgramd/irc.py new-irgramd/irc.py
--- old-irgramd/irc.py 2024-11-22 15:57:07.187135342 +0100
+++ new-irgramd/irc.py 2024-11-22 15:57:07.187135342 +0100
@@ -183,8 +183,7 @@
user.irc_nick = nick
self.users[ni] = user
if not user.registered and user.irc_username:
- user.registered = True
- await self.send_greeting(user)
+ await self.register(user)
else:
if user.registered:
await self.reply_code(user, 'ERR_ERRONEUSNICKNAME', (nick,))
@@ -214,8 +213,7 @@
user.irc_username = username
user.irc_realname = realname
if user.irc_nick:
- user.registered = True
- await self.send_greeting(user)
+ await self.register(user)
async def handle_irc_join(self, user, channels):
self.logger.debug('Handling JOIN: %s', channels)
@@ -413,6 +411,10 @@
user.stream.close()
# IRC functions
+ async def register(self, user):
+ user.registered = True
+ await self.send_greeting(user)
+ await self.send_help(user)
async def send_msg(self, source, target, message):
messages = split_lines(message)
@@ -493,6 +495,14 @@
async def send_isupport(self, user):
await self.reply_code(user, 'RPL_ISUPPORT', (CHAN_MAX_LENGHT, NICK_MAX_LENGTH))
+ async def send_help(self, user):
+ for line in (
+ 'Welcome to irgramd service',
+ 'use /msg {} help'.format(self.service_user.irc_nick),
+ 'to get help',
+ ):
+ await self.send_msg(self.service_user, user.irc_nick, line)
+
async def send_users_irc(self, prfx, command, params):
for usr in [x for x in self.users.values() if x.stream]:
await self.reply_command(usr, prfx, command, params)