Improve chat-channel management and do not historise welcome question.
This commit is contained in:
parent
8c718ad272
commit
93fb2ccc5c
@ -51,6 +51,8 @@ class FjerkroaBot(commands.Bot):
|
|||||||
def init_channels(self):
|
def init_channels(self):
|
||||||
if 'chat-channel' in self.config:
|
if 'chat-channel' in self.config:
|
||||||
self.chat_channel = self.channel_by_name(self.config['chat-channel'], no_ignore=True)
|
self.chat_channel = self.channel_by_name(self.config['chat-channel'], no_ignore=True)
|
||||||
|
else:
|
||||||
|
self.chat_channel = None
|
||||||
self.staff_channel = self.channel_by_name(self.config['staff-channel'], no_ignore=True)
|
self.staff_channel = self.channel_by_name(self.config['staff-channel'], no_ignore=True)
|
||||||
self.welcome_channel = self.channel_by_name(self.config['welcome-channel'], no_ignore=True)
|
self.welcome_channel = self.channel_by_name(self.config['welcome-channel'], no_ignore=True)
|
||||||
|
|
||||||
@ -83,12 +85,16 @@ class FjerkroaBot(commands.Bot):
|
|||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
self.init_channels()
|
self.init_channels()
|
||||||
self.init_boreness()
|
self.init_boreness()
|
||||||
logging.info(f"We have logged in as {self.user} ({repr(self.staff_channel)}, {repr(self.welcome_channel)})")
|
logging.info(f"We have logged in as {self.user}"
|
||||||
|
f" ({repr(self.staff_channel)}, {repr(self.welcome_channel)}, {repr(self.chat_channel)})")
|
||||||
|
|
||||||
async def on_member_join(self, member):
|
async def on_member_join(self, member):
|
||||||
logging.info(f"User {member.name} joined")
|
logging.info(f"User {member.name} joined")
|
||||||
if self.welcome_channel is not None:
|
if self.welcome_channel is not None:
|
||||||
msg = AIMessage(member.name, self.config['join-message'].replace('{name}', member.name), str(self.welcome_channel.name))
|
msg = AIMessage(member.name,
|
||||||
|
self.config['join-message'].replace('{name}', member.name),
|
||||||
|
str(self.welcome_channel.name),
|
||||||
|
historise_question=False)
|
||||||
await self.respond(msg, self.welcome_channel)
|
await self.respond(msg, self.welcome_channel)
|
||||||
|
|
||||||
async def on_message(self, message: Message) -> None:
|
async def on_message(self, message: Message) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user