This commit is contained in:
0xd3d0c3d 2021-12-01 03:23:20 -06:00
parent 1d7ab3fca7
commit f33867d3f8
32 changed files with 102 additions and 23 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -3,8 +3,8 @@ from irc3.plugins.cron import cron
import irc3
###########################################################################################
###########################################################################################
NICKSERV_USERNAME='SET_BOT_USERNAME_HERE'
NICKSERV_PASSWORD='SET_BOT_PASSWORD_HERE'
NICKSERV_USERNAME='maple'
NICKSERV_PASSWORD='YOUCANHAVEMYNAME'
###########################################################################################
###########################################################################################
@irc3.plugin

43
plugins/joke_plugin.py Normal file

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
###############################################################################################
###############################################################################################
from irc3.plugins.command import command
import irc3
###############################################################################################
###############################################################################################
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
###############################################################################################
###############################################################################################
@irc3.plugin
class Plugin:
###########################################################################################
###########################################################################################
def __init__(self, bot):
self.bot=bot
self.site_url="https://icanhazdadjoke.com"
###########################################################################################
###########################################################################################
def urlget(self,url):
USER_AGENT_CURL="curl/7.78.0"
ACCEPT_MODES="text/plain"
STATUS_BAD_CODE=":( - error code: {}"
STATUS_BAD_REASON=":( - failed reason: {}"
STATUS_OK=":)"
r = Request(url,data=None,headers={ 'user-agent': USER_AGENT_CURL, 'accept': ACCEPT_MODES })
try: response = urlopen(r,timeout=15).read().decode('utf-8')
except HTTPError as e: return STATUS_BAD_CODE.format(e.code)
except URLError as e: return STATUS_BAD_REASON.format(e.reason)
else: return STATUS_OK + response
###########################################################################################
###########################################################################################
@irc3.extend
@command(permission='view')
def joke(self, mask, target, args):
"""joke
%%joke
"""
response=self.urlget(self.site_url)[2:]
for msg in response.splitlines():
if len(msg) > 1:
self.bot.privmsg(target, self.bot.emo(msg))

@ -8,6 +8,7 @@ from irc3.plugins.cron import cron
import re
import os
from difflib import SequenceMatcher
import random
###############################################################################################
###############################################################################################
TELL_RE = re.compile('maple.tell\s(.+?)\s(.+)')
@ -59,12 +60,11 @@ class Plugin:
###########################################################################################
###########################################################################################
def __init__(self, bot):
self.bot = bot
self.bot.history = MESSAGE_HISTORY()
self.bot=bot
self.bot.history=MESSAGE_HISTORY()
self.bot.present=0
for _ in range(5):
self.bot.history.maple_messages.append(_)
# self.bot.history.user_messages.append(_)
# self.bot.history.user_users.append(_)
###########################################################################################
###########################################################################################
def log(self, s):
@ -82,18 +82,45 @@ class Plugin:
###########################################################################################
@irc3.event(irc3.rfc.PRIVMSG)
async def on_privmsg_search_for_maple(self, mask=None, target=None, data=None, **kw):
if not data.lower().find('maple') > -1:
##############################################
if mask.nick == 'maple':
return
if not target.lower() == "#tcpdirect".lower():
return
if mask.nick == 'maple':
return
# log = self.log
# out = self.out
# log(data)
data = data.lower().replace('maple','')
self.bot.history.push_user_messages(mask.nick.lower(),data)
# out(data)
##############################################
DICE=0
##############################################
if self.bot.present == 0:
if not data.lower().find('maple') > -1:
if not random.randint(0,100) == 13:
DICE=0
else:
DICE=1
if not data.lower().find('joke') == -1:
self.bot.joke(mask,target,'')
DICE=1
if mask.nick == 'd':
if not data.lower().find('hang with us') == -1:
self.bot.present=1
msg="i don't mind hanging out for a bit"
self.bot.privmsg(target,self.bot.emo(msg))
DICE=1
if DICE == 0: return
log = self.log
log(data)
data = data.lower().replace('maple','')
self.bot.history.push_user_messages(mask.nick.lower(),data)
##############################################
elif self.bot.present == 1:
if mask.nick == 'd':
if not data.lower().find('leave us alone') == -1:
self.bot.present=0
msg="i gotta go, i'll ttyl"
self.bot.privmsg(target,self.bot.emo(msg))
log = self.log
log(data)
data = data.lower().replace('maple','')
self.bot.history.push_user_messages(mask.nick.lower(),data)
###############################################################################################
###############################################################################################
@cron('* * * * * */1')

@ -159,6 +159,7 @@ class Plugin:
msg = "Note Added! {}".format(note_uuid)
msg = self.bot.emo(msg)
self.bot.privmsg(target, msg)
self.bot.history.push_user_messages(mask.nick.lower(),note)
#######################################################################################
#######################################################################################
###########################################################################################

@ -59,6 +59,7 @@ class Plugin:
status=f"\x02\x0304error \x02\x0303▶\x0F {e.message[0]['message']}'"
msg=self.bot.emo(status)
self.bot.privmsg(target,msg)
self.bot.history.push_user_messages(mask.nick.lower(),message)
#######################################################################################
#######################################################################################
@command(permission='view')
@ -73,7 +74,7 @@ class Plugin:
self.bot.db.setlist('quotes',[])
quote_user=[]
for i in range(len(quote_list)):
if(quote_list[i]['user']==user):
if(quote_list[i]['user']==user):
quote_user.append(quote_list[i]['message'])
for i in range(len(quote_user)):
msg=user+' \x02\x0303▶\x0F '+quote_user[i]

@ -79,12 +79,14 @@ class Plugin:
msg = "\x02{}\x0F \x0303▶\x0F \x02\x0302{}\x0F \x0306፨ \x0F\x1F\x1D{}\x0F".format(nick, msg.get("msg"), time_since.capitalize())
msg = self.bot.emo(msg)
self.bot.privmsg(target, msg)
self.bot.history.push_user_messages(mask.nick.lower(),f"have you seen {nick}")
else:
msg = "{} Has Not Been Seen".format(nick)
msg = self.bot.emo(msg)
self.bot.privmsg(target, msg)
self.bot.history.push_user_messages(mask.nick.lower(),f"have you seen {nick}")
return
#######################################################################################
#######################################################################################
###########################################################################################
###########################################################################################
###########################################################################################

@ -81,5 +81,6 @@ class Plugin:
msg=f"\x02\x0302{NICK}\x0F\x02\x0304 ▶ "
msg+=f"\x0F\x02\x0313{MSG}\x0F\x02\x0304 "
self.bot.privmsg(target,self.bot.emo(f"{msg}"))
self.bot.history.push_user_messages(mask.nick.lower(),f'{TITLE} {NAME}')
###########################################################################################
###########################################################################################
###########################################################################################

@ -11,7 +11,7 @@ class Plugin:
def __init__(self, bot):
self.bot = bot
#######################################################################################
#######################################################################################
#######################################################################################
def _get_weed(self,t,s):
try:
url=""
@ -29,7 +29,7 @@ class Plugin:
except:
return -1
#######################################################################################
#######################################################################################
#######################################################################################
@command(permission='view')
def strain(self, mask, target, args):
"""strain
@ -80,12 +80,13 @@ class Plugin:
url = b[0]['url']
msg = "▶▶▶ " + "url: {}".format(url)
self.bot.privmsg(target, msg)
self.bot.history.push_user_messages(mask.nick.lower(),msg)
except:
pass
except:
msg = "strain: not found"
self.bot.privmsg(target, msg)
#######################################################################################
#######################################################################################
#######################################################################################
###########################################################################################
###########################################################################################
###########################################################################################

@ -28,7 +28,8 @@ class Plugin:
except:
msg = "{} Term Not Found".format(term)
self.bot.privmsg(target,msg)
self.bot.history.push_user_messages(mask.nick.lower(),msg)
#######################################################################################
#######################################################################################
###########################################################################################
###########################################################################################
###########################################################################################

@ -77,6 +77,7 @@ class Plugin:
msg = msg
msg = self.bot.emo(msg)
self.bot.privmsg(target,msg)
self.bot.history.push_user_messages(mask.nick.lower(),title)
#######################################################################################
#######################################################################################
@irc3.extend
@ -135,6 +136,7 @@ class Plugin:
msg = msg + url
msg = self.bot.emo(msg)
self.bot.privmsg(target, msg)
self.bot.history.push_user_messages(mask.nick.lower(),title)
#######################################################################################
#######################################################################################
###########################################################################################