This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wettortoise
committed
Oct 26, 2021
0 parents
commit 0b8870f
Showing
43 changed files
with
1,208 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def mrdestructoid(message): | ||
return ' '.join(format(ord(x), 'b') for x in message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
# todo: if a word is wrapped by quotes then treat it like an emote and do not capitilise it | ||
# e.g. HeLoO GuYs Pepege (so you can type emotes with the setting enabled and not have them ruined by it) | ||
# or have a list of emotes from ffz/7tv/bttv combined and check if its there then dont capitilise it | ||
|
||
|
||
def pepege(message): | ||
number_for_letters = 0 | ||
new_message = [] | ||
for letters in message: | ||
number_for_letters += 1 | ||
|
||
if number_for_letters % 2 == 0: # if its even | ||
new_message.append(letters.upper()) | ||
else: | ||
new_message.append(letters.lower()) | ||
|
||
return "".join(new_message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#hsl and hsv (hue saturation lightness) | ||
import colorsys | ||
import webcolors | ||
from twitch.irc.connect_socket import socket_list | ||
import json | ||
def HsvToRgb(hue, saturation, value): | ||
""" | ||
Returns RGB colour tuple from HSV (Hue, Saturation, Value). | ||
""" | ||
red, green, blue = colorsys.hsv_to_rgb(hue, saturation, value) | ||
return ( | ||
int(round(red * 255.0)), | ||
int(round(green * 255.0)), | ||
int(round(blue * 255.0)) | ||
) | ||
|
||
|
||
|
||
def hsv_to_hex(h,s,v): | ||
h = h / 100 | ||
s = s / 100 | ||
v = v / 100 | ||
# dived because colorsys is from 0 to 1 NOT from 0 to 255 | ||
hsv_to_rgb = HsvToRgb(h,s,v) | ||
return webcolors.rgb_to_hex(hsv_to_rgb) | ||
|
||
|
||
|
||
with open("settings/settings.json","r+") as settings: | ||
load_data = json.load(settings) | ||
rainbow_timer = load_data['settings']['user_rainbow_settings']['rainbow_timer'] | ||
starting_hue = load_data['settings']['user_rainbow_settings']['rainbow_hue_start'] | ||
starting_saturation = load_data['settings']['user_rainbow_settings']['rainbow_saturation_start'] | ||
starting_lightness = load_data['settings']['user_rainbow_settings']['rainbow_lightness_start'] | ||
|
||
|
||
|
||
h = starting_hue | ||
s = starting_saturation | ||
l = starting_lightness | ||
forwards = True | ||
|
||
def change_user_rainbow_colour(): | ||
global h | ||
global s | ||
global l | ||
global forwards | ||
|
||
with open("settings/settings.json","r+") as settings: | ||
load_data = json.load(settings) | ||
checkboxes = load_data['settings']['gui']['checkboxes'] | ||
|
||
# goes from the start to end in increments someone chooses | ||
starting_hue = load_data['settings']['user_rainbow_settings']['rainbow_hue_start'] | ||
starting_saturation = load_data['settings']['user_rainbow_settings']['rainbow_saturation_start'] | ||
starting_lightness = load_data['settings']['user_rainbow_settings']['rainbow_lightness_start'] | ||
|
||
ending_hue = load_data['settings']['user_rainbow_settings']['rainbow_hue_end'] | ||
ending_saturation = load_data['settings']['user_rainbow_settings']['rainbow_saturation_end'] | ||
ending_lightness = load_data['settings']['user_rainbow_settings']['rainbow_lightness_end'] | ||
|
||
hue_increment = load_data['settings']['user_rainbow_settings']['rainbow_hue_increment'] | ||
saturation_increment = load_data['settings']['user_rainbow_settings']['rainbow_saturation_increment'] | ||
lightness_increment = load_data['settings']['user_rainbow_settings']['rainbow_lightness_increment'] | ||
|
||
|
||
hue_decrease = load_data['settings']['user_rainbow_settings']['rainbow_hue_decrease'] # when it hits the end then go back to the start | ||
|
||
|
||
if len(socket_list()) > 1: | ||
if forwards is True: | ||
if h > ending_hue or h > 100: | ||
forwards = False | ||
|
||
if s > ending_saturation or s > 100: | ||
s = starting_saturation | ||
|
||
if l > ending_saturation or l > 100: | ||
l = starting_lightness | ||
|
||
h += hue_increment | ||
s += saturation_increment | ||
l += lightness_increment | ||
|
||
else: | ||
if h < starting_hue: | ||
forwards = True | ||
|
||
h -= hue_decrease | ||
|
||
|
||
return f"/color {hsv_to_hex(h,s,l)}" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import PyQt5.QtWidgets as qtw | ||
import PyQt5.QtGui as qtg | ||
from PyQt5.QtCore import Qt | ||
import json | ||
from settings.update_settings import add_key_value | ||
|
||
background_colour = "QWidget {background-color: #212121; color: white;} QHeaderView::section { background-color: #212121; } QTableWidget QTableCornerButton::section {background-color: #212121; }" | ||
|
||
# i mixed up the meaning of trigger when writing this 🤦🏼 | ||
class commands_window(qtw.QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
self.layout = qtw.QGridLayout() | ||
|
||
self.setLayout(self.layout) | ||
self.table = qtw.QTableWidget() | ||
|
||
self.layout.addWidget(self.table,0,0) | ||
|
||
|
||
self.setWindowIcon(qtg.QIcon("static/commands.png")) | ||
self.setStyleSheet(background_colour) | ||
self.setWindowTitle("Commands") | ||
self.resize(500,500) | ||
|
||
self.table.resizeColumnsToContents() | ||
self.table.resizeRowsToContents() | ||
|
||
self.table.setColumnCount(2) | ||
self.table.setRowCount(len(self.commands_list())) | ||
|
||
self.table.setHorizontalHeaderLabels(["Command name","message to be sent"]) | ||
self.table.horizontalHeader().setSectionResizeMode(1,qtw.QHeaderView.Stretch) | ||
self.table.horizontalHeader().setSectionResizeMode(1,qtw.QHeaderView.Stretch) | ||
self.table.setEditTriggers(qtw.QAbstractItemView.NoEditTriggers) | ||
|
||
|
||
# create table | ||
row = 0 | ||
for commands in self.commands_list(): | ||
command_in_table = self.table.setItem(row,0,qtw.QTableWidgetItem(commands)) | ||
trigger_in_table = self.table.setItem(row,1,qtw.QTableWidgetItem(self.commands_list()[commands])) | ||
row+= 1 | ||
|
||
self.table.resizeRowsToContents() | ||
|
||
command_name_title = qtw.QLabel("new or previous command name") | ||
command_trigger_title = qtw.QLabel("new message (can be pastebin links and can contain * for a newline)") | ||
delete_command_title = qtw.QLabel("remove command") | ||
|
||
self.character_counter_label = qtw.QLabel() | ||
self.command_name_textbox = qtw.QLineEdit() | ||
self.command_trigger_textbox = qtw.QLineEdit() | ||
|
||
self.delete_command_textbox = qtw.QLineEdit() | ||
|
||
self.command_trigger_textbox.textChanged.connect(self.character_counter) | ||
|
||
self.layout.addWidget(command_name_title,1,0) | ||
self.layout.addWidget(self.command_name_textbox,2,0) | ||
self.layout.addWidget(command_trigger_title,3,0) | ||
self.layout.addWidget(self.character_counter_label,4,0) | ||
self.layout.addWidget(self.command_trigger_textbox,5,0) | ||
self.layout.addWidget(delete_command_title,6,0) | ||
self.layout.addWidget(self.delete_command_textbox,7,0) | ||
|
||
|
||
self.command_trigger_textbox.returnPressed.connect(self.write_custom_command) | ||
|
||
self.delete_command_textbox.returnPressed.connect(self.delete_command) | ||
|
||
def character_counter(self): # doesnt detect mouse double click highlight + type a word (need to bind on mouse double click event) | ||
self.count_characters = len(self.command_trigger_textbox.text()) | ||
|
||
if len(self.command_trigger_textbox.text().split()) > 1: | ||
if "*" in self.command_trigger_textbox.text().split()[-1]: # checks if user writes * | ||
self.count_characters = 0 | ||
|
||
if self.count_characters > 499: | ||
self.character_counter_label.setStyleSheet("color: red;") | ||
elif self.count_characters < 499: | ||
self.character_counter_label.setStyleSheet("color: white;") | ||
|
||
self.character_counter_label.setText(f"{str(self.count_characters)} (500 character twitch limit)") | ||
|
||
def commands_list(self): | ||
with open("settings/settings.json","r+") as self.settings: | ||
load_data = json.load(self.settings) | ||
return load_data['settings']['commands'] | ||
|
||
|
||
def add_to_table(self,command,command_trigger): | ||
row_count = self.table.rowCount() | ||
if command not in list(self.commands_list().keys()): # if the command writing to the table isnt already in the file | ||
|
||
self.table.insertRow(row_count) | ||
self.table.setItem(row_count,0,qtw.QTableWidgetItem(command)) | ||
self.table.setItem(row_count,1,qtw.QTableWidgetItem(command_trigger)) | ||
|
||
else: | ||
row_count -= 1 # if the command is already specified then go back one row and set the trigger again | ||
self.table.setItem(row_count,1,qtw.QTableWidgetItem(command_trigger)) | ||
|
||
|
||
def remove_table_item(self,command_name): | ||
for i in range(self.table.rowCount()): | ||
find_command = self.table.item(i,0) | ||
if find_command is not None: | ||
if find_command.text() == command_name: # goes through every command to find where in the table the command is located | ||
self.table.removeRow(i) | ||
|
||
def delete_command(self): | ||
command_to_delete = self.delete_command_textbox.text() | ||
if command_to_delete != "": | ||
if command_to_delete in self.commands_list(): | ||
with open("settings/settings.json","r+") as settings: | ||
load_data = json.load(settings) | ||
current_commands = load_data['settings']['commands'] | ||
remove_unwanted_command = current_commands.pop(command_to_delete,None) | ||
|
||
settings.seek(0) | ||
settings.truncate() # remove old content | ||
rewrite_file = json.dump(load_data,settings,indent=4) # rewrite the file with the new data | ||
|
||
self.remove_table_item(command_to_delete) | ||
|
||
def write_custom_command(self): | ||
new_command = self.command_name_textbox.text() | ||
new_trigger = self.command_trigger_textbox.text() | ||
if new_trigger != "" and new_trigger != " " and new_command != "" and new_command != " ": # needs to have something in both boxes | ||
self.add_to_table(new_command,new_trigger) | ||
add_key_value("commands",new_command,new_trigger) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import PyQt5.QtWidgets as qtw | ||
import PyQt5.QtGui as qtg | ||
from PyQt5.QtCore import Qt | ||
import json | ||
|
||
background_colour = "background-color: #212121; color: white;" | ||
|
||
class login_window(qtw.QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
self.verticle_layout = qtw.QVBoxLayout() | ||
self.setLayout(self.verticle_layout) | ||
self.setWindowTitle("login") | ||
self.resize(470,70) | ||
self.setFixedSize(self.size()) | ||
self.setWindowIcon(qtg.QIcon("static/wrench.png")) | ||
self.setStyleSheet(background_colour) | ||
|
||
self.horizontal_layout = qtw.QHBoxLayout() | ||
|
||
self.oauth_title = qtw.QLabel('<a href="https://twitchapps.com/tmi/" style="color:green"> Click this link to get the oauth token needed to send messages in chat (do not show anyone)</a>') | ||
self.oauth_title.setOpenExternalLinks(True) | ||
self.verticle_layout.addWidget(self.oauth_title, alignment=Qt.AlignTop) | ||
|
||
self.oauth_input_box = qtw.QLineEdit() | ||
self.oauth_input_box.returnPressed.connect(self.write_oauth) | ||
self.verticle_layout.addWidget(self.oauth_input_box) | ||
|
||
|
||
def write_oauth(self): | ||
oauth_box = self.oauth_input_box.text() | ||
if "oauth:" in oauth_box: | ||
oauth = oauth_box.split("oauth:")[1] | ||
else: | ||
oauth = oauth_box | ||
|
||
with open("settings/settings.json","r+") as settings: | ||
load_data = json.load(settings) | ||
load_data['settings']['account_information']['oauth'] = oauth | ||
|
||
settings.seek(0) | ||
settings.truncate() # remove old content | ||
rewrite_file = json.dump(load_data,settings,indent=4) # rewrite the file with the new data | ||
|
||
|
||
|
Oops, something went wrong.