fix(text): Fix process scope bug.
This commit is contained in:
@@ -105,12 +105,15 @@ class TextSession:
|
|||||||
"""
|
"""
|
||||||
Process a message into the session.
|
Process a message into the session.
|
||||||
"""
|
"""
|
||||||
|
if not message.guild:
|
||||||
|
return
|
||||||
|
|
||||||
if (message.author.id != self.userid) or (message.guild.id != self.guildid):
|
if (message.author.id != self.userid) or (message.guild.id != self.guildid):
|
||||||
raise ValueError("Invalid attempt to process message from a different member!")
|
raise ValueError("Invalid attempt to process message from a different member!")
|
||||||
|
|
||||||
# Identify if we need to start a new period
|
# Identify if we need to start a new period
|
||||||
tdiff = (message.created_at - self.this_period_start).total_seconds()
|
start = self.this_period_start
|
||||||
if self.this_period_start is not None and tdiff < self.period_length:
|
if start is not None and (message.created_at - start).total_seconds() < self.period_length:
|
||||||
self.this_period_messages += 1
|
self.this_period_messages += 1
|
||||||
self.this_period_words += len(message.content.split())
|
self.this_period_words += len(message.content.split())
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user