print(f"Added Reddit post {submission.id} as record #{s.id}")
print(f"Added Reddit post {submission.id} as record {s.id}")
new_requests.append(s)
# Only post the totals into IRC
ifnew_requests:
awaitself.message(room,f"Found {len(new_requests)} new Reddit posts in /r/monerosupport. Use `!list` to see the list and `!request x` to see each one.")
awaitself.message(room,f"Found {len(new_requests)} new Reddit posts in /r/monerosupport. Use `.list` to see the list and `.request x` to see each one.")
awaitself.message(target,f"Support request {req.id} claimed by {source}")
else:
awaitself.message(target,"No record with that ID")
# queue command only shows things assigned to you
ifmessagein[".queue"]:
req=SupportRequest.select().where(
IRCSupportOperator.irc_nick==source,
IRCSupportOperator.solved==False
).first()
ifreq:
reqs=[]
foriinreq:
reqs.append(i)
awaitself.message(target,", ".join(reqs))
else:
awaitself.message(target,"No support requests assigned to you")
# help command shows available commands
ifmessagein[".help"]:
awaitself.message(target,"`.list`: Show open support tickets on Reddit and synchronized to the database. | `.request x`: Show metadata of support request \"x\". | `.claim x`: Claim support request \"x\" | `.queue`: Show support requests assigned to you")
asyncdefis_admin(self,nickname):
admin=False
@ -114,6 +151,15 @@ class IRCBot(pydle.Client):
print("info: ",info)
returnadmin
asyncdefis_registered(self,nickname):
irc_nick=IRCSupportOperator.select().where(
IRCSupportOperator.irc_nick==nickname
).first()
ifirc_nick:
returnTrue
else:
returnFalse
defrun_bot():
try:
print(f"[+] Starting IRC bot connecting to {config.IRC_HOST}...\n")