summaryrefslogtreecommitdiff
path: root/ircbot/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'ircbot/main.py')
-rw-r--r--ircbot/main.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/ircbot/main.py b/ircbot/main.py
index a106dc1..db49a8e 100644
--- a/ircbot/main.py
+++ b/ircbot/main.py
@@ -10,6 +10,8 @@ import hashlib
import re
import requests
+connect_time = time.time()
+
config = None
with open('./config.json', 'r', encoding='utf-8') as f:
config = json.load(f)
@@ -97,19 +99,23 @@ def log_command(chan, sender, args):
return f"https://raye.mistivia.com/irclog/view/?chan={chan[1:]}"
def load_lastseen():
- try:
- with open("lastseen", "r") as fp:
- return json.load(fp)
- except:
- return dict()
+ return dict()
+ # try:
+ # with open("lastseen", "r") as fp:
+ # return json.load(fp)
+ # except:
+ # return dict()
LAST_SEEN = load_lastseen()
def save_lastseen():
- with open("lastseen", "w") as fp:
- json.dump(LAST_SEEN, fp)
+ pass
+ # with open("lastseen", "w") as fp:
+ # json.dump(LAST_SEEN, fp)
def get_greeting(chan, sender, args):
+ if time.time() - connect_time < 300:
+ return ''
if sender == NICKNAME:
return ''
if not chan in GREETINGS:
@@ -396,7 +402,7 @@ class IRCBot:
self.socket.settimeout(300)
self.socket.connect((self.server, self.port))
print("Connection successful.")
-
+ connect_time = time.time()
self.send_raw(f"NICK {self.nickname}")
self.send_raw(f"USER {self.ident} 0 * :{self.realname}")