Compare commits
2 Commits
8c718ad272
...
96ff52ef8a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96ff52ef8a | ||
|
|
93fb2ccc5c |
@ -51,13 +51,15 @@ 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)
|
||||||
|
|
||||||
def init_boreness(self):
|
def init_boreness(self):
|
||||||
if 'chat-channel' not in self.config:
|
if 'chat-channel' not in self.config:
|
||||||
return
|
return
|
||||||
self.last_activity_time = 0.0
|
self.last_activity_time = time.monotonic()
|
||||||
self.loop.create_task(self.on_boreness())
|
self.loop.create_task(self.on_boreness())
|
||||||
logging.info('Boreness initialised.')
|
logging.info('Boreness initialised.')
|
||||||
|
|
||||||
@ -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