Implement support for users instead of nicks

master
jmjl 2024-10-27 11:11:14 +00:00
parent 2ef3a95ef0
commit 119e3a251f
2 changed files with 15 additions and 5 deletions

View File

@ -20,17 +20,23 @@ def tilde_plugin(msg):
return
if msg.channel != util.tilde.GOOD_CHAN and not util.tilde.DEBUG:
return pinhook.plugin.message("{} is a meanie and gets no tildes. **ju only gives out tildes in the {} channel.**".format(msg.nick, util.tilde.GOOD_CHAN))
if msg.nick not in util.tilde.challenges:
challenge = util.tilde.challenge(msg.channel, msg.nick, msg.timestamp)
user_nick = msg.nick
if util.tilde.use_ident(msg.nick, msg.user):
user_nick = msg.user
if user_nick not in util.tilde.challenges:
challenge = util.tilde.challenge(msg.channel, user_nick, msg.timestamp)
return pinhook.plugin.message(challenge)
@pinhook.plugin.listener('tilde_guess')
def tilde_guess_plugin(msg):
if util.tilde.ADMIN_ONLY and msg.nick not in msg.ops:
return
if msg.nick in util.tilde.challenges and (msg.channel == util.tilde.GOOD_CHAN or util.tilde.DEBUG) and not msg.text.startswith('!'):
user_nick = msg.nick
if util.tilde.use_ident(msg.nick, msg.user):
user_nick = msg.user
if user_nick in util.tilde.challenges and (msg.channel == util.tilde.GOOD_CHAN or util.tilde.DEBUG) and not msg.text.startswith('!'):
try:
chalres = util.tilde.challenge_response(msg.nick, msg.timestamp, msg.text)
chalres = util.tilde.challenge_response(user_nick, msg.timestamp, msg.text)
print(chalres)
resp = pinhook.plugin.message(str(chalres[0]))
return resp
@ -38,3 +44,7 @@ def tilde_guess_plugin(msg):
print(traceback.format_exc())
return pinhook.plugin.message(str(e))
@pinhook.plugin.command('&tildeident', help_text='Use your ident instead of your nickname or the inverse')
def tilde_plugin(msg):
response = util.tilde.modify_ident(msg.nick, msg.user)
return pinhook.plugin.message(response)

View File

@ -4,7 +4,7 @@ emoji~=0.4.5
geopy~=1.11.0
markovify~=0.7.1
nltk>~3.4.5
pinhook~=1.10
pinhook~=1.10.1
python-forecastio~=1.3.5
requests>~2.20.0
tvdb-api~=1.10