Voice Recognition plugin for hexchat

This plugin uses the linux say command to say chat messages, lets you know when some joins or quits, etc.. It requires the gnustep-gui-runtime and python

To install the gnustep runtime you can type this in on ubuntu:

sudo apt-get install gnustep-gui-runtime

then you can test to see if the say command works by typing

say hi im chucky wanna play?

Then if that works then the next step is to know where to put the plugin. Find the path type in, if the folder doesn’t exist create it.

hexchat -p

Next download and unzip the source code to the plugins folder.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

__module_name__ = "GNUStep-speech"
__module_version__ = "0.1.0"
__module_description__ = "Speech engine script for hexchat"

import hexchat # HexChat IRC interface
import subprocess
import random
import sys
import os
import time
import threading

DeleteMinutes = 15 #number of minutes after text file is created to delete it
TalkID = round(random.random()*100000,0)

def TalkTimer(fn):
	time.sleep(60*DeleteMinutes)
	os.remove(fn)
def MSGTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")
	myfile.write(user+" says "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def ATalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def JoinTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" has joined "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def NickTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" is now "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def PartTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" has parted from "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def PMSGTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" whispered "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
def QTalk(word, word_eol, userdata):
	# STRIP word
	for i in range(len(word)):
		# strips the colours and the format
		word[i] = hexchat.strip(word[i], -1, 3)
	# in "word", the first part is the user who issued the message
	user = word[0]
	msg = word[1][0:]
	fn = "/tmp/.hcsay"+str(TalkID+random.random())
	myfile = open(fn,"w+")	
	myfile.write(user+" quit chat "+msg)
	myfile.close()
	timerThread=threading.Thread(target=TalkTimer, args=(fn,))
	timerThread.start()
	subprocess.Popen(["say","-f",fn])
	return hexchat.EAT_NONE
# Finally, the hook that will link the function above to the action of receiving a channel message
hexchat.hook_print("Channel Message", MSGTalk)
hexchat.hook_print("Private Message to Dialog", PMSGTalk)
hexchat.hook_print("Join", JoinTalk)
hexchat.hook_print("Change Nick", NickTalk)
hexchat.hook_print("Part with Reason", PartTalk)
hexchat.hook_print("Private Action to Dialog", ATalk)
hexchat.hook_print("Channel Action", ATalk)
hexchat.hook_print("Quit", QTalk)
# You can find the words "Channel Message" and many other events in HexChat menu "Settings > Text Events..."

Published by Justin Roeder

I am an electronics engineer and computer programmer that has autism. I learned by myself

delphijustin Industries is an Autism Supported Business
Social Media Auto Publish Powered By : XYZScripts.com
All in one
Start
Microsoft Corporation AZ Phoenix
Your cart is empty.
Loading...