135 lines
8.0 KiB
Python
135 lines
8.0 KiB
Python
# -*- coding: utf-8 -*-
|
||
############################################################################################################ SOF
|
||
################################################################################################################
|
||
from irc3.plugins.command import command
|
||
import irc3
|
||
import random
|
||
import os
|
||
################################################################################################################
|
||
################################################################################################################
|
||
@irc3.plugin
|
||
class Plugin:
|
||
############################################################################################################
|
||
def __init__(self, bot):
|
||
self.bot=bot
|
||
############################################################################################################
|
||
def __color(self,c):
|
||
try:
|
||
c=str(c.lower())
|
||
if c=='0': return '\x0300'
|
||
if c=='1': return '\x0301'
|
||
if c=='2': return '\x0302'
|
||
if c=='3': return '\x0303'
|
||
if c=='4': return '\x0304'
|
||
if c=='5': return '\x0305'
|
||
if c=='6': return '\x0306'
|
||
if c=='7': return '\x0307'
|
||
if c=='8': return '\x0308'
|
||
if c=='9': return '\x0309'
|
||
if c=='a': return '\x0310'
|
||
if c=='b': return '\x0311'
|
||
if c=='c': return '\x0312'
|
||
if c=='d': return '\x0313'
|
||
if c=='e': return '\x0314'
|
||
if c=='f': return '\x0315'
|
||
if c=='n': return ''
|
||
if c=='t': return '\x0f'
|
||
print('_color: empty')
|
||
return '\x0f'
|
||
except:
|
||
print('_color: error')
|
||
return '\x0f'
|
||
############################################################################################################
|
||
############################################################################################################
|
||
@command(permission='view',public=True,show_in_help_list=True)
|
||
def hl(self, mask, target, args):
|
||
"""hl - use a chosen or random color palette that will iterate a message to whichever ircnick you pick.
|
||
c1-c4 are the different index of colors, meaning four different colors will be used.
|
||
s1-s6 are the symbols by index, s1-s3 are the first set, s4-s6 are the second set.
|
||
these are not needed if you randomize values but if you want the same colors, symbols later you now have record.
|
||
c1,c2,c3,c4,s1,s2,s3,s4,s5,s6 accept a color range of 0-15 and symbol range of 0-30. usage: ?hl c1,c2,c3,c4,s1,s2,s3,s4,s5,s6 ircnick n message.
|
||
uses specified colors & symbols, tags ircnick dr1p with hello message 10 times. example 1: ?hl 8,12,9,13,3,4,5,9,8,7 dr1p 10 hello.
|
||
uses a random color palette, tags ircnick dr1p with hello message 10 times. example 2: ?hl dr1p 10 hello.
|
||
uses a random color palette, tags ircnick dr1p with hello message 1 time. example 3: ?hl dr1p hello.
|
||
%%hl <message>...
|
||
"""
|
||
########################################################################################################
|
||
try:
|
||
message=' '.join(args['<message>']).strip()
|
||
channel=self.bot.channels[target]
|
||
c1=random.randint(0,15)
|
||
c2=random.randint(0,15)
|
||
c3=random.randint(0,15)
|
||
c4=random.randint(0,15)
|
||
symbols=['╲╱','══','╀╀','▓▓','◨◧','◎◎','╳╳','░░','◅▻','▖▗','▤▤','╼╾','▒▒','┹┺','╮╭','╷╷','┒┎','┿┿','▛▜','◸◹','▚▞','┓┏','╏╏','┥┝','╽╽','┛┗','◊◊','╌','║║','◫◫','▭▭']
|
||
n1=random.randint(0,len(symbols)-1),random.randint(0,len(symbols)-1),random.randint(0,len(symbols)-1)
|
||
s1=[f'{symbols[n1[0]][0]}{symbols[n1[1]][0]}{symbols[n1[2]][0]}',f'{symbols[n1[2]][1]}{symbols[n1[1]][1]}{symbols[n1[0]][1]}']
|
||
n2=random.randint(0,len(symbols)-1),random.randint(0,len(symbols)-1),random.randint(0,len(symbols)-1)
|
||
s2=[f'{symbols[n2[0]][0]}{symbols[n2[1]][0]}{symbols[n2[2]][0]}',f'{symbols[n2[2]][1]}{symbols[n2[1]][1]}{symbols[n2[0]][1]}']
|
||
GOT_PALETTE=''; palette=''
|
||
GOT_IRCNICK=''; ircnick=mask.nick
|
||
GOT_ITERATIONS=''; iterations=1
|
||
####################################################################################################
|
||
for palette in message.split():
|
||
try:
|
||
if len(palette.split(','))==10:
|
||
GOT_PALETTE=palette
|
||
break
|
||
except:
|
||
pass
|
||
####################################################################################################
|
||
for ircnick in message.split():
|
||
try:
|
||
if ircnick in channel:
|
||
GOT_IRCNICK=ircnick
|
||
break
|
||
except:
|
||
pass
|
||
####################################################################################################
|
||
for iterations in message.split():
|
||
try:
|
||
if int(iterations)>0:
|
||
GOT_ITERATIONS=int(iterations)
|
||
break
|
||
except:
|
||
pass
|
||
####################################################################################################
|
||
if GOT_IRCNICK:
|
||
message=message.replace(GOT_IRCNICK,'')
|
||
ircnick=GOT_IRCNICK
|
||
else:
|
||
ircnick=mask.nick
|
||
if GOT_PALETTE:
|
||
message=message.replace(GOT_PALETTE,'')
|
||
palette=GOT_PALETTE
|
||
c1=int(palette.split(',')[0])
|
||
c2=int(palette.split(',')[1])
|
||
c3=int(palette.split(',')[2])
|
||
c4=int(palette.split(',')[3])
|
||
n1=int(palette.split(',')[4]),int(palette.split(',')[5]),int(palette.split(',')[6])
|
||
n2=int(palette.split(',')[7]),int(palette.split(',')[8]),int(palette.split(',')[9])
|
||
s1=[f'{symbols[n1[0]][0]}{symbols[n1[1]][0]}{symbols[n1[2]][0]}',f'{symbols[n1[2]][1]}{symbols[n1[1]][1]}{symbols[n1[0]][1]}']
|
||
s2=[f'{symbols[n2[0]][0]}{symbols[n2[1]][0]}{symbols[n2[2]][0]}',f'{symbols[n2[2]][1]}{symbols[n2[1]][1]}{symbols[n2[0]][1]}']
|
||
if GOT_ITERATIONS:
|
||
message=message.replace(str(GOT_ITERATIONS),'')
|
||
iterations=GOT_ITERATIONS
|
||
else:
|
||
iterations=1
|
||
####################################################################################################
|
||
message=message.strip()
|
||
for i in range(int(iterations)):
|
||
h1=self.__color(hex(c1)[2:])
|
||
h2=self.__color(hex(c2)[2:])
|
||
h3=self.__color(hex(c3)[2:])
|
||
h4=self.__color(hex(c4)[2:])
|
||
msg=f'{h1}{s1[0]} {h2}{ircnick} {h1}{s1[1]} {h3}{s2[0]} {h4}{message} {h3}{s2[1]} {h1}{s1[0]} {h2}{ircnick} {h1}{s1[1]}\x20'
|
||
if not GOT_PALETTE: msg+=f"{h1}{str(c1).zfill(2)},{h2}{str(c2).zfill(2)},{h3}{str(c3).zfill(2)},{h4}{str(c4).zfill(2)},{h1}{str(n1[0]).zfill(2)},{str(n1[1]).zfill(2)},{str(n1[2]).zfill(2)},{h3}{str(n2[0]).zfill(2)},{str(n2[1]).zfill(2)},{str(n2[2]).zfill(2)}"
|
||
self.bot.privmsg(target,self.bot.emo(msg))
|
||
####################################################################################################
|
||
########################################################################################################
|
||
except Exception as e:
|
||
msg=f"{mask.nick}: highlight_plugin:hl - error: {e}"
|
||
self.bot.privmsg(target,self.bot.emo(msg))
|
||
################################################################################################################
|
||
############################################################################################################ EOF
|