m4pl1mp/plugins/emote_plugin.py
2022-02-01 22:44:42 -06:00

41 lines
1.8 KiB
Python

# -*- coding: utf-8 -*-
from irc3.plugins.command import command
import irc3
import random
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
###########################################################################################
###########################################################################################
@irc3.plugin
class Plugin:
#######################################################################################
#######################################################################################
def __init__(self, bot):
self.bot = bot
#######################################################################################
#######################################################################################
@irc3.extend
def emo(self,s):
emote_db = '%s/../databases/emote.db' % dir_path
emoj = random.choice(list(open(emote_db)))
random.randint(0,1)
if random.randint(0,1) == 0:
emoj = "\x0304{}\x0F".format(emoj)
else:
emoj = "\x0303{}\x0F".format(emoj)
s = s + '\x0303 ▶ ' + emoj
return s
#######################################################################################
#######################################################################################
@command(permission='view')
def emote(self, mask, target, args):
"""Show Emotion
%%emote
"""
def __random_line():
emote_db = '%s/../databases/emote.db' % dir_path
return random.choice(list(open(emote_db)))
emoj = __random_line()
self.bot.privmsg(target, "%s" % emoj)
###########################################################################################
###########################################################################################