38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
import pydle
|
|
import monero
|
|
|
|
import config
|
|
|
|
class IRCBot(pydle.Client):
|
|
async def on_connect(self):
|
|
for room in config.ROOMS:
|
|
await self.join(room)
|
|
|
|
async def on_message(self, target, source, message):
|
|
if source == self.nickname:
|
|
return
|
|
|
|
if message.startswith('++help'):
|
|
await self.message(target, f"Hello new user, {source}! Don't worry, help is on the way! said: {message}")
|
|
elif config.BOT_NICKNAME in message:
|
|
await self.message(target, f"Sup {source} - I'm not programmed to do anything just yet.")
|
|
|
|
# isadmin = await self.is_admin(source)
|
|
# print(isadmin)
|
|
|
|
async def is_admin(self, nickname):
|
|
admin = False
|
|
if nickname in config.ADMIN_NICKNAMES:
|
|
info = await self.whois(nickname)
|
|
admin = info['identified']
|
|
print("info: ", info)
|
|
return admin
|
|
|
|
client = IRCBot(
|
|
nickname=config.BOT_NICKNAME,
|
|
sasl_mechanism = "EXTERNAL",
|
|
tls_client_cert = "./freenode.pem",
|
|
)
|
|
|
|
client.run(config.IRC_HOST, tls=True, tls_verify=False)
|