revisions
This commit is contained in:
parent
e0c56c46e1
commit
cd0053efbf
@ -77,149 +77,6 @@ class Plugin:
|
||||
self.bot.send(cmd)
|
||||
self.bot.kick(channel, mask.nick, msg)
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@irc3.event(irc3.rfc.JOIN)
|
||||
def hardchat_radar(self, mask, channel, **kw):
|
||||
"""radar for hardchatters who join a channel"""
|
||||
try:
|
||||
if mask.nick != self.bot.nick:
|
||||
for _ in self.gifts:
|
||||
if _ == mask.nick:
|
||||
cmd=f"MODE {channel} +v {mask.nick}"
|
||||
self.bot.send(cmd)
|
||||
except Exception as e:
|
||||
msg=f'error: base_plugin > hardchat_radar: {e}'
|
||||
print(msg)
|
||||
self.bot.privmsg(channel,self.bot.emo(msg))
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@command(permission='view')
|
||||
def hardchatter(self, mask, target, args):
|
||||
"""hardchatter
|
||||
%%hardchatter <message>...
|
||||
"""
|
||||
try:
|
||||
OP_FLAG=False
|
||||
channel = self.bot.channels[target]
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
if OP_FLAG:
|
||||
user = ''.join(args['<message>'])
|
||||
self.gifts.append(user)
|
||||
self.bot.privmsg(target, self.bot.emo(f'hardchatter: {user}'))
|
||||
cmd=f"MODE {target} +v {user}"
|
||||
self.bot.send(cmd)
|
||||
self.gifts.sort()
|
||||
self.bot.db.setlist("hardchatters", self.gifts) # updating database
|
||||
else:
|
||||
return
|
||||
except Exception as e:
|
||||
msg=f'error: base_plugin > gift: {e}'
|
||||
print(msg)
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@command(permission='view')
|
||||
def softchatter(self, mask, target, args):
|
||||
"""softchatter
|
||||
%%softchatter <message>...
|
||||
"""
|
||||
user = ''.join(args['<message>'])
|
||||
try:
|
||||
OP_FLAG=False
|
||||
channel = self.bot.channels[target]
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
if OP_FLAG:
|
||||
self.gifts.remove(user)
|
||||
self.bot.privmsg(target, self.bot.emo(f'softchatted: {user}'))
|
||||
cmd=f"MODE {target} -v {user}"
|
||||
self.bot.send(cmd)
|
||||
self.gifts.sort()
|
||||
self.bot.db.setlist("hardchatters", self.gifts) # updating database
|
||||
else:
|
||||
return
|
||||
except Exception as e:
|
||||
msg=f'error: base_plugin > ungift: {e}'
|
||||
print(msg)
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
pass
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@command(permission='view')
|
||||
def hardchatters(self, mask, target, args):
|
||||
"""hardchatters
|
||||
%%hardchatters
|
||||
"""
|
||||
try:
|
||||
OP_FLAG=False
|
||||
channel = self.bot.channels[target]
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
if OP_FLAG:
|
||||
self.gifts.sort()
|
||||
if self.gifts:
|
||||
_msg = re.findall(r'.{1,400}(?:\s+|$)', f'hardchatters: {self.gifts}')
|
||||
for _ in _msg:
|
||||
self.bot.privmsg(target, self.bot.emo(_))
|
||||
else:
|
||||
self.bot.privmsg(target, self.bot.emo("no hardchatters"))
|
||||
else:
|
||||
return
|
||||
except Exception as e:
|
||||
msg=f'error: base_plugin > gifts: {e}'
|
||||
print(msg)
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
pass
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@command(permission='view', public=True, show_in_help_list=False)
|
||||
def hardchatting(self, mask, target, args):
|
||||
"""hardchatting all present hardchatters
|
||||
%%hardchatting
|
||||
"""
|
||||
try:
|
||||
OP_FLAG=False
|
||||
channel = self.bot.channels[target]
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
if OP_FLAG:
|
||||
for _ in channel:
|
||||
self.gifts.append(_)
|
||||
user=_
|
||||
cmd=f"MODE {target} +v {user}"
|
||||
self.bot.send(cmd)
|
||||
self.gifts=set(self.gifts)
|
||||
self.gifts=' '.join(self.gifts).split()
|
||||
self.gifts.sort()
|
||||
self.bot.db.setlist("hardchatters", self.gifts) # store in database
|
||||
_msg = re.findall(r'.{1,400}(?:\s+|$)', f'hardchatting: {self.gifts}')
|
||||
for _ in _msg:
|
||||
self.bot.privmsg(target, self.bot.emo(_))
|
||||
else:
|
||||
return
|
||||
except Exception as e:
|
||||
msg=f'error: base_plugin > gifting: {e}'
|
||||
print(msg)
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
pass
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@command(permission='view', public=True, show_in_help_list=True)
|
||||
def v(self, mask, target, args):
|
||||
@ -253,6 +110,9 @@ class Plugin:
|
||||
###########################################################################################
|
||||
@command(permission='admin', public=True, show_in_help_list=False)
|
||||
def op(self, mask, target, args):
|
||||
"""Ops user
|
||||
%%op <nick>
|
||||
"""
|
||||
if args['<nick>']:
|
||||
nick = args['<nick>']
|
||||
cmd = f"MODE {target} +o {mask.nick}"
|
||||
@ -261,6 +121,9 @@ class Plugin:
|
||||
###########################################################################################
|
||||
@command(permission='admin', public=True, show_in_help_list=False)
|
||||
def deop(self, mask, target, args):
|
||||
"""Deops user
|
||||
%%op <nick>
|
||||
"""
|
||||
if args['<nick>']:
|
||||
nick = args['<nick>']
|
||||
cmd = f"MODE {target} -o {mask.nick}"
|
||||
@ -269,13 +132,10 @@ class Plugin:
|
||||
###########################################################################################
|
||||
@command(permission="admin", show_in_help_list=False)
|
||||
def stats(self, mask, target, args):
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
if args['<channel>']:
|
||||
channel = args['<channel>']
|
||||
target = mask.nick
|
||||
else:
|
||||
channel = target
|
||||
"""Stats
|
||||
%%stats
|
||||
"""
|
||||
channel = target
|
||||
if channel in self.bot.channels:
|
||||
channel = self.bot.channels[channel]
|
||||
message = f'{len(channel)} users'
|
||||
@ -286,6 +146,9 @@ class Plugin:
|
||||
###########################################################################################
|
||||
@command(permission='admin', public=False, show_in_help_list=False)
|
||||
def restart(self, mask, target, args):
|
||||
"""restart
|
||||
%%restart
|
||||
"""
|
||||
self.bot.privmsg(target, 'BOT RESTARTING')
|
||||
time.sleep(1)
|
||||
os.execl(sys.executable, sys.executable, *sys.argv)
|
||||
@ -303,6 +166,9 @@ class Plugin:
|
||||
###########################################################################################
|
||||
@command(permission='staff', public=True, show_in_help_list=True)
|
||||
def staff(self, mask, target, args):
|
||||
"""staff
|
||||
%%staff <noise>...
|
||||
"""
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
def __staff_list(self, mask, target, args):
|
||||
@ -390,7 +256,8 @@ class Plugin:
|
||||
return
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
cmd = args.get("<cmd>")
|
||||
cmd = ' '.join(args['<noise>'])[0]
|
||||
args = ' '.join(args['<noise>'])[1:]
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
if not cmd:
|
||||
|
@ -10,12 +10,13 @@ from typing import Type
|
||||
import random
|
||||
import string
|
||||
import os
|
||||
import ipdb
|
||||
######################################################################################################### THE ASCII LOGO TO BE USED
|
||||
MOTD="""
|
||||
_________ _________ _________ ___ ___ _________ _________ ____ ____
|
||||
| o ) / O \ / O \ | \ / | | o ) / O \ \ \_/ /
|
||||
|_____O___) \_________/ \_________/ |____|____| |_____O___) \_________/ /___/%\___\\
|
||||
'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BB' 'BB'
|
||||
_________ _________ _________ ___ ___ _________ _________ ____ ____
|
||||
| o ) / O \ / O \ | \ / | | o ) / O \ \ \_/ /
|
||||
|_____O___) \_________/ \_________/ |____|____| |_____O___) \_________/ /___/%\___\\
|
||||
'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BBBBBBB' 'BB' 'BB'
|
||||
"""
|
||||
######################################################################################################### BOOMBOX MAIN ENTRY
|
||||
@irc3.plugin
|
||||
@ -32,13 +33,13 @@ class Plugin:
|
||||
self.bot.bbs.b5,self.bot.bbs.b6,self.bot.bbs.b7,self.bot.bbs.b8=self.bot.bbs.palette()[0:4]
|
||||
################################################################################################# COLOR INIT
|
||||
self.bot.bbs.sites=['soundcloud','youtube','spotify','bandcamp']
|
||||
self.bot.bbs.floor__top_songs=5
|
||||
self.bot.bbs.floor__last_songs=5
|
||||
self.bot.bbs.floor__top_users=3
|
||||
self.bot.bbs.floor__top_sites=1
|
||||
self.bot.bbs.ceiling__top_songs=15
|
||||
self.bot.bbs.ceiling__last_songs=25
|
||||
self.bot.bbs.ceiling__top_users=10
|
||||
self.bot.bbs.floor__top_songs=15
|
||||
self.bot.bbs.floor__last_songs=15
|
||||
self.bot.bbs.floor__top_users=5
|
||||
self.bot.bbs.floor__top_sites=len(self.bot.bbs.sites)
|
||||
self.bot.bbs.ceiling__top_songs=50
|
||||
self.bot.bbs.ceiling__last_songs=50
|
||||
self.bot.bbs.ceiling__top_users=25
|
||||
self.bot.bbs.ceiling__top_sites=len(self.bot.bbs.sites)
|
||||
################################################################################################# EOF COLOR INIT
|
||||
self.bot.bbs.bot=self.bot
|
||||
@ -85,255 +86,295 @@ class Plugin:
|
||||
msg+=f"{c[2]}error{c[1]}: {c[3]}{token} is an invalid token"
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
##################################################################################################### BOOMBOX MAIN 2
|
||||
@command(permission='view')
|
||||
@command(permission='view',error_format="{cmd} error - usage: ?{cmd} all,top,old,user,site - example: ?{cmd} all".format)
|
||||
def boombox(self, mask, target, args):
|
||||
"""boombox
|
||||
%%boombox
|
||||
"""
|
||||
command='all' #' '.join(args['<command>']).lower()
|
||||
command='all'
|
||||
###########################################################################
|
||||
commands=['top','last','user','site','all']
|
||||
commands=['top','old','user','site','all']
|
||||
###########################################################################
|
||||
if not command in commands:
|
||||
msg="boombox - usage: ?boombox top, ?boombox last, ?boombox user, ?boombox site, ?boombox all"
|
||||
msg="boombox - usage: ?boombox top, ?boombox old, ?boombox user, ?boombox site, ?boombox all"
|
||||
self.bot.privmsg(target,self.bot.emo(msg))
|
||||
return
|
||||
###########################################################################
|
||||
bbs_last=self.bot.db.getlist("bbs_last")
|
||||
bbs_data=self.bot.db.getlist('bbs_data')
|
||||
###########################################################################
|
||||
try:
|
||||
if bbs_data:
|
||||
#########################################################################################
|
||||
c1,c2,c3,c4,c5,c6,c7,c8=self.bot.bbs.c
|
||||
#########################################################################################
|
||||
if command=='all':
|
||||
for _ in MOTD.splitlines():
|
||||
if _:
|
||||
self.bot.privmsg(target,f'{self.bot.bbs.palette()[0]}{_}')
|
||||
#########################################################################################
|
||||
if command=='top' or command=='all':
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
msg=f'TOP SONGS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
######################################################################################################################lays ╏ ?bb mJYj0
|
||||
# msg=f'{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_data=self.bot.db.getlist('bbs_data')
|
||||
hits=[]
|
||||
for i,data in enumerate(bbs_data):
|
||||
hits.append(data['hits'])
|
||||
lot=[(k,v) for k, v in zip(range(len(hits)),hits)]
|
||||
nl=[]
|
||||
while len(lot)> 0:
|
||||
nl.append(max(lot,key=lambda x: x[1]))
|
||||
lot.remove(nl[-1])
|
||||
nl[0:self.bot.bbs.ceiling__last_songs]
|
||||
for i in range(len(bbs_data)):
|
||||
base=bbs_data[nl[0:self.bot.bbs.ceiling__last_songs][i][0]]
|
||||
title=base['title'].lower()
|
||||
token=base['token']
|
||||
url=base['url']
|
||||
site=base['site']
|
||||
bbs_data=self.bot.db.getlist("bbs_data")
|
||||
hits=base['hits']
|
||||
lot_nicks=[(k,v) for k, v in zip(range(len(base['nicks'].values())),base['nicks'].values())]
|
||||
buf_nicks=[]
|
||||
while len(lot_nicks)>0:
|
||||
buf_nicks.append(max(lot_nicks,key=lambda x: x[1]))
|
||||
lot_nicks.remove(buf_nicks[-1])
|
||||
nick_hits=buf_nicks[0][1]
|
||||
nick=list(base['nicks'])[buf_nicks[0][0]]
|
||||
msg=f'{c4}{self.bot.bbs.tailor(title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(nick.lower(),10)} {c1}╏ {c7}{str(nick_hits).zfill(2)}{c1}/{c7}{str(hits).zfill(2)} {c6}plays {c1}╏ {c5}?bb {token}'
|
||||
self.bot.privmsg(target,msg)
|
||||
#########################################################################################
|
||||
if command=='last' or command=='all':
|
||||
# LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST
|
||||
# LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST
|
||||
# LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST SONGS LAST
|
||||
msg=f'OLD SONGS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_data=self.bot.db.getlist('bbs_data')
|
||||
if bbs_data:
|
||||
#########################################################################################
|
||||
c1,c2,c3,c4,c5,c6,c7,c8=self.bot.bbs.c
|
||||
#########################################################################################f
|
||||
if command=='all':
|
||||
for _ in MOTD.splitlines():
|
||||
if _:
|
||||
self.bot.privmsg(target,f'{self.bot.bbs.palette()[0]}{_}')
|
||||
#########################################################################################
|
||||
if command=='top' or command=='all':
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
# TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP SONGS TOP
|
||||
msg=f'TOP SONGS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
######################################################################################################################
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_data=self.bot.db.getlist('bbs_data')
|
||||
hits=[]
|
||||
for i,data in enumerate(bbs_data):
|
||||
hits.append(data['hits'])
|
||||
lot=[(k,v) for k, v in zip(range(len(hits)),hits)]
|
||||
nl=[]
|
||||
while len(lot)> 0:
|
||||
nl.append(max(lot,key=lambda x: x[1]))
|
||||
lot.remove(nl[-1])
|
||||
nl[0:len(bbs_data)]
|
||||
#####################################################################################
|
||||
mode_length=0
|
||||
if command=='top':
|
||||
mode_length=self.bot.bbs.ceiling__top_songs
|
||||
elif command=='all':
|
||||
mode_length=self.bot.bbs.floor__top_songs
|
||||
#####################################################################################
|
||||
for i in range(mode_length):
|
||||
try:
|
||||
count=0
|
||||
for i,lastdb in enumerate(bbs_last):
|
||||
nick=lastdb[0]
|
||||
site=lastdb[1]
|
||||
title=lastdb[2]
|
||||
token=lastdb[3]
|
||||
url=lastdb[4]
|
||||
try:
|
||||
reverse_index=self.bot.bbs.dbgaze('bbs_data','token',token)
|
||||
hits=bbs_data[reverse_index]['hits']
|
||||
db_key_nicks=list(zip(list(bbs_data[reverse_index]['nicks'].values()),list(bbs_data[reverse_index]['nicks'].keys())))
|
||||
db_key_nicks.sort()
|
||||
user=db_key_nicks[-1][1]
|
||||
plays=user=db_key_nicks[-1][0]
|
||||
if len(lastdb)>0:
|
||||
count+=1
|
||||
msg=f'{c4}{self.bot.bbs.tailor(title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(nick.lower(),10)} {c1}╏ {c7}{str(plays).zfill(2)}{c1}/{c7}{str(hits).zfill(2)} {c6}plays {c1}╏ {c5}?bb {token}'
|
||||
self.bot.privmsg(target, msg)
|
||||
except Exception as e:
|
||||
print(f'{mask.nick}: boombox_plugin:boombox:last - error: {e}')
|
||||
if count==0:
|
||||
msg=f'{c3}{str("https://soundcloud.com/vanta_sec/fenix-flexin-10-toes-dr1ph0p-m1x")}'
|
||||
self.bot.privmsg(target, msg)
|
||||
except Exception as e:
|
||||
base=bbs_data[nl[i][0]]
|
||||
except:
|
||||
ipdb.set_trace()
|
||||
pass
|
||||
#msg=f'boombox/error: error in last {str(self.bot.bbs.ceiling__last_songs)} songs data parsing: {e}'
|
||||
#self.bot.privmsg(target,msg)
|
||||
#########################################################################################
|
||||
if command=='user' or command=='all':
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
msg=f'TOP USERS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
title=base['title'].lower()
|
||||
token=base['token']
|
||||
url=base['url']
|
||||
site=base['site']
|
||||
# bbs_data=self.bot.db.getlist("bbs_data")
|
||||
hits=base['hits']
|
||||
lot_nicks=[(k,v) for k, v in zip(range(len(base['nicks'].values())),base['nicks'].values())]
|
||||
buf_nicks=[]
|
||||
while len(lot_nicks)>0:
|
||||
buf_nicks.append(max(lot_nicks,key=lambda x: x[1]))
|
||||
lot_nicks.remove(buf_nicks[-1])
|
||||
nick_hits=buf_nicks[0][1]
|
||||
nick=list(base['nicks'])[buf_nicks[0][0]]
|
||||
msg=f'{c4}{self.bot.bbs.tailor(title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(nick.lower(),10)} {c1}╏ {c7}{str(nick_hits).zfill(2)}{c1}/{c7}{str(hits).zfill(2)} {c6}plays {c1}╏ {c5}?bb {token}'
|
||||
self.bot.privmsg(target,msg)
|
||||
top_data=self.bot.db.getlist('bbs_data')
|
||||
bbs_nicks=self.bot.db.getlist("bbs_nicks")
|
||||
top_nicks=list(bbs_nicks[0].keys())
|
||||
top_users_tally=[]; top_users=[]
|
||||
for _ in [ x for x in bbs_nicks[0] ]:
|
||||
top_users_tally.append(bbs_nicks[0][_]['tally'])
|
||||
for _ in [ x for x in bbs_nicks[0] ]:
|
||||
top_users.append(_)
|
||||
userlist=list(zip(top_users_tally,top_users))
|
||||
# [(5, 'd'), (1, 'dr1p')]
|
||||
userlist.sort()
|
||||
userlist.reverse()
|
||||
for i,_ in enumerate(userlist):
|
||||
tally,user=_
|
||||
print(f'{str(i).zfill(2)} - username {user} scoring {tally} hits')
|
||||
top_users=[]
|
||||
for _user in userlist:
|
||||
top_user=_user[1]
|
||||
user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
try:
|
||||
user_hits.append(f"{_['nicks'][_user[1]]},{i}")
|
||||
except:
|
||||
pass
|
||||
user_hits.sort()
|
||||
user_hits.reverse()
|
||||
top_hits=int(user_hits[0].split(',')[0])
|
||||
top_index=int(user_hits[0].split(',')[1])
|
||||
top_hits_site=int(bbs_data[top_index]['hits'])
|
||||
top_site=bbs_data[top_index]['site']
|
||||
top_title=bbs_data[top_index]['title']
|
||||
top_token=bbs_data[top_index]['token']
|
||||
top_users.append([top_title,top_site,top_user,top_hits,top_hits_site,top_token,top_index])
|
||||
msg=f'{c4}{self.bot.bbs.tailor(top_title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(top_site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(top_user.lower(),10)} {c1}╏ {c7}{str(top_hits).zfill(2)}{c1}/{c7}{str(top_hits_site).zfill(2)} {c6}plays {c1}╏ {c5}?bb {top_token}'
|
||||
self.bot.privmsg(target,msg)
|
||||
#########################################################################################
|
||||
if command=='site' or command=='all':
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
bbs_sites=self.bot.db.getlist("bbs_sites")
|
||||
msg=f'TOP SITES ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_nicks=self.bot.db.getlist('bbs_nicks')
|
||||
site_nicks=list(bbs_nicks[0].keys())
|
||||
site_users_bandcamp=[]; site_users_soundcloud=[];
|
||||
site_users_youtube=[]; site_users_spotify=[];
|
||||
for _ in [ x for x in site_nicks ]:
|
||||
site_users_bandcamp.append([bbs_nicks[0][_]['bandcamp'],_])
|
||||
site_users_soundcloud.append([bbs_nicks[0][_]['soundcloud'],_])
|
||||
site_users_youtube.append([bbs_nicks[0][_]['youtube'],_])
|
||||
site_users_spotify.append([bbs_nicks[0][_]['spotify'],_])
|
||||
site_users_bandcamp.sort(); site_users_bandcamp.reverse()
|
||||
site_users_soundcloud.sort(); site_users_soundcloud.reverse()
|
||||
site_users_youtube.sort(); site_users_youtube.reverse()
|
||||
site_users_spotify.sort(); site_users_spotify.reverse()
|
||||
######################################################################################################################################################################
|
||||
bandcamp_top_user_hits=[]
|
||||
#########################################################################################
|
||||
if command=='old' or command=='all':
|
||||
# OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD
|
||||
# OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD
|
||||
# OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD SONGS OLD
|
||||
msg=f'OLD SONGS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_data=self.bot.db.getlist('bbs_data')
|
||||
last_songs=[]
|
||||
try:
|
||||
for i,lastdb in enumerate(bbs_last):
|
||||
nick=lastdb[0]
|
||||
site=lastdb[1]
|
||||
title=lastdb[2]
|
||||
token=lastdb[3]
|
||||
url=lastdb[4]
|
||||
try:
|
||||
reverse_index=self.bot.bbs.dbgaze('bbs_data','token',token)
|
||||
hits=bbs_data[reverse_index]['hits']
|
||||
db_key_nicks=list(zip(list(bbs_data[reverse_index]['nicks'].values()),list(bbs_data[reverse_index]['nicks'].keys())))
|
||||
db_key_nicks.sort()
|
||||
user=db_key_nicks[-1][1]
|
||||
plays=user=db_key_nicks[-1][0]
|
||||
if len(lastdb)>0:
|
||||
msg=f'{c4}{self.bot.bbs.tailor(title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(nick.lower(),10)} {c1}╏ {c7}{str(plays).zfill(2)}{c1}/{c7}{str(hits).zfill(2)} {c6}plays {c1}╏ {c5}?bb {token}'
|
||||
last_songs.append(msg)
|
||||
except Exception as e:
|
||||
print(f'{mask.nick}: boombox_plugin:boombox:last - error: {e}')
|
||||
except Exception as e:
|
||||
pass
|
||||
#####################################################################################
|
||||
mode_length=0
|
||||
if command=='old':
|
||||
mode_length=self.bot.bbs.ceiling__last_songs
|
||||
elif command=='all':
|
||||
mode_length=self.bot.bbs.floor__last_songs
|
||||
#####################################################################################
|
||||
try:
|
||||
for i in range(mode_length):
|
||||
self.bot.privmsg(target,last_songs[i])
|
||||
except:
|
||||
pass
|
||||
#########################################################################################
|
||||
if command=='user' or command=='all':
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
# TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP USERS TOP
|
||||
msg=f'TOP USERS ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
self.bot.privmsg(target,msg)
|
||||
top_data=self.bot.db.getlist('bbs_data')
|
||||
bbs_nicks=self.bot.db.getlist("bbs_nicks")
|
||||
top_nicks=list(bbs_nicks[0].keys())
|
||||
top_users_tally=[]; top_users=[]
|
||||
for _ in [ x for x in bbs_nicks[0] ]:
|
||||
top_users_tally.append(bbs_nicks[0][_]['tally'])
|
||||
for _ in [ x for x in bbs_nicks[0] ]:
|
||||
top_users.append(_)
|
||||
userlist=list(zip(top_users_tally,top_users))
|
||||
userlist.sort()
|
||||
userlist.reverse()
|
||||
for i,userdata in enumerate(userlist):
|
||||
tally,user=userdata
|
||||
top_users=[]
|
||||
for _user in userlist:
|
||||
top_user=_user[1]
|
||||
user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='bandcamp':
|
||||
bandcamp_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
bandcamp_top_user_hits.sort()
|
||||
bandcamp_top_user_hits.reverse()
|
||||
bandcamp_index=int(bandcamp_top_user_hits[0].split(',')[1])
|
||||
bandcamp_title=bbs_data[bandcamp_index]['title']
|
||||
bandcamp_site=bbs_data[bandcamp_index]['site']
|
||||
bandcamp_user=site_users_bandcamp[0][1]
|
||||
bandcamp_userhits=bandcamp_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
bandcamp_sitehits=bbs_sites[0]['bandcamp']
|
||||
bandcamp_token=bbs_data[bandcamp_index]['token']
|
||||
site_bandcamp=[bandcamp_title,bandcamp_site,bandcamp_user,bandcamp_userhits,bandcamp_sitehits,bandcamp_token,bandcamp_index]
|
||||
######################################################################################################################################################################
|
||||
soundcloud_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='soundcloud':
|
||||
soundcloud_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
soundcloud_top_user_hits.sort()
|
||||
soundcloud_top_user_hits.reverse()
|
||||
soundcloud_index=int(soundcloud_top_user_hits[0].split(',')[1])
|
||||
soundcloud_title=bbs_data[soundcloud_index]['title']
|
||||
soundcloud_site=bbs_data[soundcloud_index]['site']
|
||||
soundcloud_user=site_users_soundcloud[0][1]
|
||||
soundcloud_userhits=soundcloud_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
soundcloud_sitehits=bbs_sites[0]['soundcloud']
|
||||
soundcloud_token=bbs_data[soundcloud_index]['token']
|
||||
site_soundcloud=[soundcloud_title,soundcloud_site,soundcloud_user,soundcloud_userhits,soundcloud_sitehits,soundcloud_token,soundcloud_index]
|
||||
######################################################################################################################################################################
|
||||
youtube_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='youtube':
|
||||
youtube_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
youtube_top_user_hits.sort()
|
||||
youtube_top_user_hits.reverse()
|
||||
youtube_index=int(youtube_top_user_hits[0].split(',')[1])
|
||||
youtube_title=bbs_data[youtube_index]['title']
|
||||
youtube_site=bbs_data[youtube_index]['site']
|
||||
youtube_user=site_users_youtube[0][1]
|
||||
youtube_userhits=youtube_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
youtube_sitehits=bbs_sites[0]['youtube']
|
||||
youtube_token=bbs_data[youtube_index]['token']
|
||||
site_youtube=[youtube_title,youtube_site,youtube_user,youtube_userhits,youtube_sitehits,youtube_token,youtube_index]
|
||||
######################################################################################################################################################################
|
||||
spotify_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='spotify':
|
||||
spotify_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
spotify_top_user_hits.sort()
|
||||
spotify_top_user_hits.reverse()
|
||||
spotify_index=int(spotify_top_user_hits[0].split(',')[1])
|
||||
spotify_title=bbs_data[spotify_index]['title']
|
||||
spotify_site=bbs_data[spotify_index]['site']
|
||||
spotify_user=site_users_spotify[0][1]
|
||||
spotify_userhits=spotify_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
spotify_sitehits=bbs_sites[0]['spotify']
|
||||
spotify_token=bbs_data[spotify_index]['token']
|
||||
site_spotify=[spotify_title,spotify_site,spotify_user,spotify_userhits,spotify_sitehits,spotify_token,spotify_index]
|
||||
######################################################################################################################################################################
|
||||
bbs_sites=self.bot.db.getlist("bbs_sites")
|
||||
bbs_sites.sort()
|
||||
bbs_sites.reverse()
|
||||
siteorder=list(({bbs_sites[0]['soundcloud']:'soundcloud', bbs_sites[0]['youtube']:'youtube', bbs_sites[0]['spotify']:'spotify', bbs_sites[0]['bandcamp']:'bandcamp'}))
|
||||
siteorder.sort()
|
||||
siteorder.reverse()
|
||||
invertedsites=({bbs_sites[0]['soundcloud']:'soundcloud', bbs_sites[0]['youtube']:'youtube', bbs_sites[0]['spotify']:'spotify', bbs_sites[0]['bandcamp']:'bandcamp'})
|
||||
for _ in siteorder:
|
||||
if invertedsites[_]=='soundcloud':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_soundcloud[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_soundcloud[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_soundcloud[2].lower(),10)} {c1}╏ {c7}{str(site_soundcloud[3]).zfill(2)}{c1}/{c7}{str(site_soundcloud[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_soundcloud[5]}'
|
||||
self.bot.privmsg(target, msg)
|
||||
elif invertedsites[_]=='bandcamp':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_bandcamp[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_bandcamp[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_bandcamp[2].lower(),10)} {c1}╏ {c7}{str(site_bandcamp[3]).zfill(2)}{c1}/{c7}{str(site_bandcamp[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_bandcamp[5]}'
|
||||
self.bot.privmsg(target, msg)
|
||||
elif invertedsites[_]=='youtube':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_youtube[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_youtube[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_youtube[2].lower(),10)} {c1}╏ {c7}{str(site_youtube[3]).zfill(2)}{c1}/{c7}{str(site_youtube[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_youtube[5]}'
|
||||
self.bot.privmsg(target, msg)
|
||||
elif invertedsites[_]=='spotify':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_spotify[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_spotify[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_spotify[2].lower(),10)} {c1}╏ {c7}{str(site_spotify[3]).zfill(2)}{c1}/{c7}{str(site_spotify[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_spotify[5]}'
|
||||
self.bot.privmsg(target, msg)
|
||||
##################################################################################################################################################################################
|
||||
except Exception as e:
|
||||
print(f'error: boombox_plugin:topsite - exception: {e}')
|
||||
try:
|
||||
user_hits.append(f"{_['nicks'][_user[1]]},{i}")
|
||||
except:
|
||||
pass
|
||||
user_hits.sort()
|
||||
user_hits.reverse()
|
||||
top_hits=int(user_hits[0].split(',')[0])
|
||||
top_index=int(user_hits[0].split(',')[1])
|
||||
top_hits_site=int(bbs_data[top_index]['hits'])
|
||||
top_site=bbs_data[top_index]['site']
|
||||
top_title=bbs_data[top_index]['title']
|
||||
top_token=bbs_data[top_index]['token']
|
||||
msg=f'{c4}{self.bot.bbs.tailor(top_title.lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(top_site.lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(top_user.lower(),10)} {c1}╏ {c7}{str(top_hits).zfill(2)}{c1}/{c7}{str(top_hits_site).zfill(2)} {c6}plays {c1}╏ {c5}?bb {top_token}'
|
||||
top_users.append(msg)
|
||||
#####################################################################################
|
||||
mode_length=0
|
||||
if command=='user':
|
||||
mode_length=self.bot.bbs.ceiling__top_users
|
||||
elif command=='all':
|
||||
mode_length=self.bot.bbs.floor__top_users
|
||||
#####################################################################################
|
||||
try:
|
||||
for i in range(mode_length):
|
||||
self.bot.privmsg(target,top_users[i])
|
||||
except:
|
||||
pass
|
||||
#########################################################################################
|
||||
if command=='site' or command=='all':
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
# TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP SITES TOP
|
||||
bbs_sites=self.bot.db.getlist("bbs_sites")
|
||||
msg=f'TOP SITES ◸{c2}◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸◹◸'
|
||||
self.bot.privmsg(target,msg)
|
||||
bbs_nicks=self.bot.db.getlist('bbs_nicks')
|
||||
site_nicks=list(bbs_nicks[0].keys())
|
||||
site_users_bandcamp=[]; site_users_soundcloud=[];
|
||||
site_users_youtube=[]; site_users_spotify=[];
|
||||
for _ in [ x for x in site_nicks ]:
|
||||
site_users_bandcamp.append([bbs_nicks[0][_]['bandcamp'],_])
|
||||
site_users_soundcloud.append([bbs_nicks[0][_]['soundcloud'],_])
|
||||
site_users_youtube.append([bbs_nicks[0][_]['youtube'],_])
|
||||
site_users_spotify.append([bbs_nicks[0][_]['spotify'],_])
|
||||
site_users_bandcamp.sort(); site_users_bandcamp.reverse()
|
||||
site_users_soundcloud.sort(); site_users_soundcloud.reverse()
|
||||
site_users_youtube.sort(); site_users_youtube.reverse()
|
||||
site_users_spotify.sort(); site_users_spotify.reverse()
|
||||
######################################################################################################################################################################
|
||||
bandcamp_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='bandcamp':
|
||||
bandcamp_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
bandcamp_top_user_hits.sort()
|
||||
bandcamp_top_user_hits.reverse()
|
||||
bandcamp_index=int(bandcamp_top_user_hits[0].split(',')[1])
|
||||
bandcamp_title=bbs_data[bandcamp_index]['title']
|
||||
bandcamp_site=bbs_data[bandcamp_index]['site']
|
||||
bandcamp_user=site_users_bandcamp[0][1]
|
||||
bandcamp_userhits=bandcamp_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
bandcamp_sitehits=bbs_sites[0]['bandcamp']
|
||||
bandcamp_token=bbs_data[bandcamp_index]['token']
|
||||
site_bandcamp=[bandcamp_title,bandcamp_site,bandcamp_user,bandcamp_userhits,bandcamp_sitehits,bandcamp_token,bandcamp_index]
|
||||
######################################################################################################################################################################
|
||||
soundcloud_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='soundcloud':
|
||||
soundcloud_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
soundcloud_top_user_hits.sort()
|
||||
soundcloud_top_user_hits.reverse()
|
||||
soundcloud_index=int(soundcloud_top_user_hits[0].split(',')[1])
|
||||
soundcloud_title=bbs_data[soundcloud_index]['title']
|
||||
soundcloud_site=bbs_data[soundcloud_index]['site']
|
||||
soundcloud_user=site_users_soundcloud[0][1]
|
||||
soundcloud_userhits=soundcloud_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
soundcloud_sitehits=bbs_sites[0]['soundcloud']
|
||||
soundcloud_token=bbs_data[soundcloud_index]['token']
|
||||
site_soundcloud=[soundcloud_title,soundcloud_site,soundcloud_user,soundcloud_userhits,soundcloud_sitehits,soundcloud_token,soundcloud_index]
|
||||
######################################################################################################################################################################
|
||||
youtube_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='youtube':
|
||||
youtube_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
youtube_top_user_hits.sort()
|
||||
youtube_top_user_hits.reverse()
|
||||
youtube_index=int(youtube_top_user_hits[0].split(',')[1])
|
||||
youtube_title=bbs_data[youtube_index]['title']
|
||||
youtube_site=bbs_data[youtube_index]['site']
|
||||
youtube_user=site_users_youtube[0][1]
|
||||
youtube_userhits=youtube_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
youtube_sitehits=bbs_sites[0]['youtube']
|
||||
youtube_token=bbs_data[youtube_index]['token']
|
||||
site_youtube=[youtube_title,youtube_site,youtube_user,youtube_userhits,youtube_sitehits,youtube_token,youtube_index]
|
||||
######################################################################################################################################################################
|
||||
spotify_top_user_hits=[]
|
||||
for i,_ in enumerate(bbs_data):
|
||||
if _['site']=='spotify':
|
||||
spotify_top_user_hits.append(f'{_["hits"]},{i}')
|
||||
spotify_top_user_hits.sort()
|
||||
spotify_top_user_hits.reverse()
|
||||
spotify_index=int(spotify_top_user_hits[0].split(',')[1])
|
||||
spotify_title=bbs_data[spotify_index]['title']
|
||||
spotify_site=bbs_data[spotify_index]['site']
|
||||
spotify_user=site_users_spotify[0][1]
|
||||
spotify_userhits=spotify_top_user_hits[0].split(',')[0]
|
||||
bbs_sites=self.bot.db.getlist('bbs_sites')
|
||||
spotify_sitehits=bbs_sites[0]['spotify']
|
||||
spotify_token=bbs_data[spotify_index]['token']
|
||||
site_spotify=[spotify_title,spotify_site,spotify_user,spotify_userhits,spotify_sitehits,spotify_token,spotify_index]
|
||||
######################################################################################################################################################################
|
||||
bbs_sites=self.bot.db.getlist("bbs_sites")
|
||||
hits=[]
|
||||
for i,data in enumerate(bbs_sites[0].keys()):
|
||||
hits.append(bbs_sites[0][data])
|
||||
lot=[(k,v) for k, v in zip(range(len(hits)),hits)]
|
||||
nl=[]
|
||||
while len(lot)> 0:
|
||||
nl.append(max(lot,key=lambda x: x[1]))
|
||||
lot.remove(nl[-1])
|
||||
siteorder=[]
|
||||
for i in range(len(nl)): siteorder.append(list(bbs_sites[0].keys())[nl[i][0]])
|
||||
top_sites=[]
|
||||
for site in siteorder:
|
||||
if site=='soundcloud':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_soundcloud[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_soundcloud[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_soundcloud[2].lower(),10)} {c1}╏ {c7}{str(site_soundcloud[3]).zfill(2)}{c1}/{c7}{str(site_soundcloud[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_soundcloud[5]}'
|
||||
top_sites.append(msg)
|
||||
elif site=='bandcamp':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_bandcamp[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_bandcamp[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_bandcamp[2].lower(),10)} {c1}╏ {c7}{str(site_bandcamp[3]).zfill(2)}{c1}/{c7}{str(site_bandcamp[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_bandcamp[5]}'
|
||||
top_sites.append(msg)
|
||||
elif site=='youtube':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_youtube[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_youtube[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_youtube[2].lower(),10)} {c1}╏ {c7}{str(site_youtube[3]).zfill(2)}{c1}/{c7}{str(site_youtube[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_youtube[5]}'
|
||||
top_sites.append(msg)
|
||||
elif site=='spotify':
|
||||
msg=f'{c4}{self.bot.bbs.tailor(site_spotify[0].lower(),50)} {c1}╏ {c3}{self.bot.bbs.tailor(site_spotify[1].lower(),10)} {c1}╏ {c8}{self.bot.bbs.tailor(site_spotify[2].lower(),10)} {c1}╏ {c7}{str(site_spotify[3]).zfill(2)}{c1}/{c7}{str(site_spotify[4]).zfill(2)} {c6}plays {c1}╏ {c5}?bb {site_spotify[5]}'
|
||||
top_sites.append(msg)
|
||||
#####################################################################################
|
||||
mode_length=0
|
||||
if command=='site':
|
||||
mode_length=self.bot.bbs.ceiling__top_sites
|
||||
elif command=='all':
|
||||
mode_length=self.bot.bbs.floor__top_sites
|
||||
#####################################################################################
|
||||
try:
|
||||
for i in range(mode_length):
|
||||
self.bot.privmsg(target,top_sites[i])
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
##################################################################################################################################################################################
|
||||
######################################################################################################### BOOMBOX CONFIG ENTRY
|
||||
class BOOMBOX_CONFIG:
|
||||
|
@ -7,6 +7,8 @@ import os
|
||||
import re
|
||||
from datetime import datetime, timedelta
|
||||
import timeago
|
||||
from irc3.plugins.cron import cron
|
||||
import ipdb
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
D="\x02\x0315"
|
||||
@ -457,20 +459,27 @@ class Plugin:
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
@command(permission='admin')
|
||||
@irc3.extend
|
||||
def dsa_scan(self,mask,target,args):
|
||||
"""tool to scan and designate
|
||||
%%dsa_scan
|
||||
"""
|
||||
OP_FLAG=False
|
||||
channel=self.bot.channels[target]
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
if not mask.nick==self.bot.nick:
|
||||
for _, nick in channel.modes.items():
|
||||
for __ in _:
|
||||
modes=["%","@","&","~"]
|
||||
if __ in modes:
|
||||
if mask.nick in nick:
|
||||
OP_FLAG=True
|
||||
else:
|
||||
OP_FLAG=True
|
||||
if OP_FLAG:
|
||||
self.log(f'{B}<<< {X}analyzing {target} users for lurkers {B}>>>')
|
||||
# msg=f'{B}<<< {X}analyzing {target} users for lurkers {B}>>>'
|
||||
# self.log(msg)
|
||||
msg=f'<<< analyzing {target} users for lurkers >>>'
|
||||
print(msg)
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
if not target in self.bot.dbio.channel:
|
||||
@ -489,13 +498,23 @@ class Plugin:
|
||||
if USER in self.bot.dbio.negated:
|
||||
if not USER in self.bot.dbio.hardchatters:
|
||||
self.dbentry_add('hardchatters',USER)
|
||||
self.log(f'{B}{USER} {B}>>> {X}whitelisted user {G}- {X}negated')
|
||||
# msg=f'{B}{USER} {B}>>> {X}whitelisted user {G}- {X}negated'
|
||||
# self.log(msg)
|
||||
msg=f'{USER} >>> whitelisted user - negated'
|
||||
print(msg)
|
||||
else:
|
||||
print(f'already in db - {B}{USER} {B}>>> {X}whitelisted user {G}- {X}negated')
|
||||
# msg=f'already in db - {B}{USER} {B}>>> {X}whitelisted user {G}- {X}negated'
|
||||
# self.log(msg)
|
||||
msg=f'already in db - {USER} >>> whitelisted user - negated'
|
||||
print(msg)
|
||||
|
||||
else:
|
||||
if not USER in self.bot.dbio.lurkers:
|
||||
self.dbentry_add('lurkers',USER)
|
||||
self.log(f'{G}{USER} {S}>>> {G}- {S}given a lurker status - no record')
|
||||
#msg=f'{G}{USER} {S}>>> {G}- {S}given a lurker status - no record'
|
||||
#self.log(msg)
|
||||
msg=f'{USER} >>> - given a lurker status - no record'
|
||||
print(msg)
|
||||
else:
|
||||
print(f'already in db - {G}{USER} {S}>>> {S}lurker')
|
||||
cmd=f"MODE {target} -v {USER}"
|
||||
@ -544,19 +563,35 @@ class Plugin:
|
||||
if records_privmsgs==0:
|
||||
self.dbentry_add('lurkers',USER)
|
||||
lurker_status=True
|
||||
self.log(f'{B}{USER} {X}>>> {R}interactions: {records} - {X}last time spoken: never - {R}oldest/newest interaction: {oldest_timestamp}{B}/{R}{newest_timestamp} - {X}idle: {idle_status} - {R}hardchatter: {hardchat_status} - {X}lurker: {lurker_status}')
|
||||
#msg=f'{B}{USER} {X}>>> {R}interactions: {records} - {X}last time spoken: never - {R}oldest/newest interaction: {oldest_timestamp}{B}/{R}{newest_timestamp} - {X}idle: {idle_status} - {R}hardchatter: {hardchat_status} - {X}lurker: {lurker_status}'
|
||||
#self.log(msg)
|
||||
msg=f'{USER} >>> interactions: {records} - last time spoken: never - oldest/newest interaction: {oldest_timestamp}/{newest_timestamp} - idle: {idle_status} - hardchatter: {hardchat_status} - lurker: {lurker_status}'
|
||||
print(msg)
|
||||
else:
|
||||
try:
|
||||
if USER in self.bot.dbio.lurkers:
|
||||
self.log(f'{G}{USER} {B}- {S}has a lurker status')
|
||||
cmd=f"MODE {target} -v {USER}"
|
||||
self.bot.send(cmd)
|
||||
if not USER in self.bot.dbio.hardchatters:
|
||||
#msg=f'{G}{USER} {B}- {S}has a lurker status'
|
||||
#self.log(msg)
|
||||
msg=f'{USER} - has a lurker status'
|
||||
print(msg)
|
||||
cmd=f"MODE {target} -v {USER}"
|
||||
self.bot.send(cmd)
|
||||
if USER in self.bot.dbio.hardchatters:
|
||||
#msg=f'{G}{USER} {B}- {S}has a lurker status yet a hardchatter'
|
||||
#self.log(msg)
|
||||
msg=f'{USER} - has a lurker status yet a hardchatter'
|
||||
print(msg)
|
||||
cmd=f"MODE {target} +v {USER}"
|
||||
self.bot.send(cmd)
|
||||
else:
|
||||
if not USER in self.bot.dbio.hardchatters:
|
||||
self.dbentry_add('hardchatters',USER)
|
||||
cmd=f"MODE {target} +v {USER}"
|
||||
self.bot.send(cmd)
|
||||
self.log(f'{B}{USER} {X}>>> {R}interactions: {records} - {X}last time spoken: {records_privmsgs[-1]} - {R}oldest/newest interaction: {oldest_timestamp}{B}/{R}{newest_timestamp} - {X}idle: {idle_status} - {R}hardchatter: {hardchat_status} - {X}lurker: {lurker_status} - {R}history: {history_status}')
|
||||
#msg=f'{B}{USER} {X}>>> {R}interactions: {records} - {X}last time spoken: {records_privmsgs[-1]} - {R}oldest/newest interaction: {oldest_timestamp}{B}/{R}{newest_timestamp} - {X}idle: {idle_status} - {R}hardchatter: {hardchat_status} - {X}lurker: {lurker_status} - {R}history: {history_status}'
|
||||
msg=f'{USER} >>> interactions: {records} - last time spoken: {records_privmsgs[-1]} - oldest/newest interaction: {oldest_timestamp}/{newest_timestamp} - idle: {idle_status} - hardchatter: {hardchat_status} - lurker: {lurker_status} - history: {history_status}'
|
||||
print(msg)
|
||||
except Exception as e:
|
||||
msg=f'error: dsa_plugin:hardchattting > {e}'
|
||||
print(msg); self.bot.privmsg(target,self.bot.emo(msg))
|
||||
@ -589,5 +624,16 @@ class Plugin:
|
||||
#######################################################################################
|
||||
#### EOF CLASS INSTANCE EOF CLASS INSTANCE EOF CLASS INSTANCE EOF CLASS INSTANCE
|
||||
#### EOF CLASS INSTANCE EOF CLASS INSTANCE EOF CLASS INSTANCE EOF CLASS INSTANCE
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
@cron('*/5 * * * *')
|
||||
def _dsa_scanning(bot):
|
||||
for channel in bot.channels:
|
||||
args=""
|
||||
try:
|
||||
print('cronjob: auto-dsa_scanning')
|
||||
bot.dsa_scan(bot.nick,channel,args)
|
||||
except:
|
||||
print('error - cronjob: auto-dsa_scanning')
|
||||
####################################################################################### EOF
|
||||
####################################################################################### EOF
|
||||
|
Loading…
Reference in New Issue
Block a user