From 25c2bbc80a2e0f1322a1d90673268066ca1b87c3 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Fri, 21 May 2021 08:29:43 -0400 Subject: [PATCH] Re-add things that were accidentally removed --- .gitattributes | 11 ++++++ .github/workflows/file_format.sh | 50 ++++++++++++++++++++++++++++ .github/workflows/static_checks.yml | 19 +++++++++++ .gitignore | 17 ++++++++++ ChatContainer.gd | 2 +- Gift.gd | 26 +++++++-------- README.md | 24 ++++++------- addons/gift/gift_node.gd | 2 +- addons/gift/icon.png | Bin 2090 -> 188 bytes addons/gift/placeholder.png | Bin 120 -> 90 bytes addons/gift/util/cmd_data.gd | 2 +- addons/gift/util/cmd_info.gd | 2 +- addons/gift/util/image_cache.gd | 2 +- icon.png | Bin 2201 -> 271 bytes 14 files changed, 127 insertions(+), 30 deletions(-) create mode 100644 .gitattributes create mode 100755 .github/workflows/file_format.sh create mode 100644 .github/workflows/static_checks.yml create mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5a749fd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf + +# Ignore some files when exporting. +/.github export-ignore +/.gitattributes export-ignore +/default_env.tres export-ignore +/icon.png export-ignore +/icon.png.import export-ignore +/project.godot export-ignore +/README.md export-ignore diff --git a/.github/workflows/file_format.sh b/.github/workflows/file_format.sh new file mode 100755 index 0000000..5eedbac --- /dev/null +++ b/.github/workflows/file_format.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +# This script ensures proper POSIX text file formatting and a few other things. + +# We need dos2unix and recode. +if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then + printf "Install 'dos2unix' and 'recode' to use this script.\n" +fi + +set -uo pipefail +IFS=$'\n\t' + +# Loops through all text files tracked by Git. +git grep -zIl '' | +while IFS= read -rd '' f; do + # Exclude some files. + if [[ "$f" == *"csproj"* ]]; then + continue + fi + # Ensure that files are UTF-8 formatted. + recode UTF-8 "$f" 2> /dev/null + # Ensure that files have LF line endings and do not contain a BOM. + dos2unix "$f" 2> /dev/null + # Remove trailing space characters and ensures that files end + # with newline characters. -l option handles newlines conveniently. + perl -i -ple 's/\s*$//g' "$f" + # We don't want to change lines around braces in godot/tscn files. + if [[ "$f" == *"godot" ]]; then + continue + elif [[ "$f" == *"tscn" ]]; then + continue + fi +done + +git diff > patch.patch + +# If no patch has been generated all is OK, clean up, and exit. +if [ ! -s patch.patch ] ; then + printf "Files in this commit comply with the formatting rules.\n" + rm -f patch.patch + exit 0 +fi + +# A patch has been created, notify the user, clean up, and exit. +printf "\n*** The following differences were found between the code " +printf "and the formatting rules:\n\n" +cat patch.patch +printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\n" +rm -f patch.patch +exit 1 diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml new file mode 100644 index 0000000..b8bd5e3 --- /dev/null +++ b/.github/workflows/static_checks.yml @@ -0,0 +1,19 @@ +name: 📊 Static Checks +on: [push, pull_request] + +jobs: + format: + name: File formatting (file_format.sh) + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -qq dos2unix recode + + - name: File formatting checks (file_format.sh) + run: | + bash ./.github/workflows/file_format.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bded6b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Godot 4+ specific ignores +.godot/ + +# Godot-specific ignores +.import/ + +# Imported translations (automatically generated from CSV files) +*.translation + +# Mono-specific ignores +.mono/ +data_*/ +mono_crash.*.json + +# System/tool-specific ignores +.directory +*~ diff --git a/ChatContainer.gd b/ChatContainer.gd index d98a390..09aa1ea 100644 --- a/ChatContainer.gd +++ b/ChatContainer.gd @@ -30,7 +30,7 @@ class EmoteLocation extends Reference: var id : String var start : int var end : int - + func _init(emote_id, start_idx, end_idx): self.id = emote_id self.start = start_idx diff --git a/Gift.gd b/Gift.gd index 241152c..36ab56c 100644 --- a/Gift.gd +++ b/Gift.gd @@ -13,10 +13,10 @@ func _ready() -> void: var botname := authfile.get_line() var token := authfile.get_line() var initial_channel = authfile.get_line() - + connect_to_twitch() yield(self, "twitch_connected") - + # Login using your username and an oauth token. # You will have to either get a oauth token yourself or use # https://twitchapps.com/tokengen/ @@ -26,27 +26,27 @@ func _ready() -> void: print("Invalid username or token.") return join_channel(initial_channel) - + connect("cmd_no_permission", get_parent(), "no_permission") connect("chat_message", get_parent(), "chat_message") - + # Adds a command with a specified permission flag. # All implementations must take at least one arg for the command info. # Implementations that recieve args requrires two args, # the second arg will contain all params in a PoolStringArray # This command can only be executed by VIPS/MODS/SUBS/STREAMER add_command("test", get_parent(), "command_test", 0, 0, PermissionFlag.NON_REGULAR) - + # These two commands can be executed by everyone add_command("helloworld", get_parent(), "hello_world") add_command("greetme", get_parent(), "greet_me") - + # This command can only be executed by the streamer add_command("streamer_only", get_parent(), "streamer_only", 0, 0, PermissionFlag.STREAMER) - + # Command that requires exactly 1 arg. add_command("greet", get_parent(), "greet", 1, 1) - + # Command that prints every arg seperated by a comma (infinite args allowed), at least 2 required add_command("list", get_parent(), "list", -1, 2) @@ -56,10 +56,10 @@ func _ready() -> void: add_alias("test","test3") # Or do it in a single line # add_aliases("test", ["test1", "test2", "test3"]) - + # Remove a single command remove_command("test2") - + # Now only knows commands "test", "test1" and "test3" remove_command("test") # Now only knows commands "test1" and "test3" @@ -67,13 +67,13 @@ func _ready() -> void: # Remove all commands that call the same function as the specified command purge_command("test1") # Now no "test" command is known - + # Send a chat message to the only connected channel () # Fails, if connected to more than one channel. # chat("TEST") - + # Send a chat message to channel # chat("TEST", initial_channel) - + # Send a whisper to target user # whisper("TEST", initial_channel) diff --git a/README.md b/README.md index eec9a6b..62dc4f1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ func _ready() -> void: connect("cmd_no_permission", self, "no_permission") connect_to_twitch() yield(self, "twitch_connected") - + # Login using your username and an oauth token. # You will have to either get a oauth token yourself or use # https://twitchapps.com/tokengen/ @@ -34,24 +34,24 @@ func _ready() -> void: print("Invalid username or token.") return join_channel() - + # Adds a command with a specified permission flag. # All implementations must take at least one arg for the command info. # Implementations that recieve args requrires two args, # the second arg will contain all params in a PoolStringArray # This command can only be executed by VIPS/MODS/SUBS/STREAMER add_command("test", self, "command_test", 0, 0, PermissionFlag.NON_REGULAR) - + # These two commands can be executed by everyone add_command("helloworld", self, "hello_world") add_command("greetme", self, "greet_me") - + # This command can only be executed by the streamer add_command("streamer_only", self, "streamer_only", 0, 0, PermissionFlag.STREAMER) - + # Command that requires exactly 1 arg. add_command("greet", self, "greet", 1, 1) - + # Command that prints every arg seperated by a comma (infinite args allowed), at least 2 required add_command("list", self, "list", -1, 2) @@ -61,10 +61,10 @@ func _ready() -> void: add_alias("test","test3") # Or do it in a single line # add_aliases("test", ["test1", "test2", "test3"]) - + # Remove a single command remove_command("test2") - + # Now only knows commands "test", "test1" and "test3" remove_command("test") # Now only knows commands "test1" and "test3" @@ -72,14 +72,14 @@ func _ready() -> void: # Remove all commands that call the same function as the specified command purge_command("test1") # Now no "test" command is known - + # Send a chat message to the only connected channel () # Fails, if connected to more than one channel. chat("TEST") - + # Send a chat message to channel chat("TEST", ) - + # Send a whisper to target user whisper("TEST", ) @@ -104,7 +104,7 @@ func greet_me(cmd_info : CommandInfo) -> void: func list(cmd_info : CommandInfo, arg_ary : PoolStringArray) -> void: chat(arg_ary.join(", ")) - + ``` *** diff --git a/addons/gift/gift_node.gd b/addons/gift/gift_node.gd index 4b76685..0d3690f 100644 --- a/addons/gift/gift_node.gd +++ b/addons/gift/gift_node.gd @@ -208,7 +208,7 @@ func handle_command(sender_data : SenderData, msg : PoolStringArray, whisper : b if(whisper == true && cmd_data.where & WhereFlag.WHISPER != WhereFlag.WHISPER): return elif(whisper == false && cmd_data.where & WhereFlag.CHAT != WhereFlag.CHAT): - return + return var args = "" if msg.size() < 5 else msg[4] var arg_ary : PoolStringArray = PoolStringArray() if args == "" else args.split(" ") if(arg_ary.size() > cmd_data.max_args && cmd_data.max_args != -1 || arg_ary.size() < cmd_data.min_args): diff --git a/addons/gift/icon.png b/addons/gift/icon.png index ca073b333d39fd1a27368c8e5d18e35f917f4a27..73b70ff1e2e73942687419726d43c7aa24b32af5 100755 GIT binary patch delta 172 zcmZ1_u!nJiL_G^L0|Ud`yN`l^lxToYh%1mzp8Y?j^;2}-!>oW^LAI0a?Ms$SQj`Wt zFqQ=Q1v5B2yO9RugnGI-hE&{2c3{il46wSX!|1bIO1fRO;YZ@hw3QAURTShkmK~e0 zfM;#62^=Q WNu!_VS3d{Zz~JfX=d#Wzp$Pz?^E*TU delta 2089 zcmV+^2-f$!0jdy?7=H)`0000V^Z#K000i}VR9JLUVRs;Ka&Km7Y-J#Hd2nSQWq4_3 z004N}y;oV1?ujxmu&W|72u5|F0-^LICY z;bD%}I1SM!?=2peT;dEN+V!OQChO*Vf7nxaYByI0qe)Q9`hN_0kI!h=$Ar@c9nbA1 z?jCrz6w#%4J~Av1x!#>bJFj+fTTyCD@F|A7tH)MU_Q2`N{<+JoRgG`+)DVDDRTvWH zCM0&g0)7fP z%#u)|&9;E@YKuKk3MFE&(hWJPl&Mpjb)f-r0}PNVS2)Q|#Ip$;dDzCBKyxfBdmhc$n?Qt$mjG^(WRT^YB7TC4 zh@q^aPJdOs28~9OW-s1(_1*_RHn|)mxS+v@5MoFnM~NzrDB_?zJ?lWs=1MA*eRN8 z+I$Nww$yS*taa(GYxh0$*i+9JYn#A=UkbLtt=dvT0!=qzr}1g=5eUy|62dgin`Mw@KJ+^ono|7TAux#vHzJr z;D5}l&3ncVyBoX2cn$?e%Oi-@yms{GewlCl;G*P|w8ns=#;uQ*Qp46bWMtW+HdCN- z)HTdg%So5ZO(d0T$�62+aSZnatKs^r(Yw3KUZ+fomuu^>^Fq9Rp!8!jG6INdUE zr^fAdPsL4NaT5#Frxb9``nZ>X>|VYW$$z%xZO4@kjGmx>jrC@vRIbInWX*BZKBL1ntqR#c^od)(~E z;x8TXhI0Fi@&?)bXOuUv20Li1%c<;&>)f_|mReq?$jJ$2V&B@s4Ppp8@?N#NHh=Cg z%ec31;x{AAyb7^&?A7HwlEbc^>Oy26<_B8&83S_%?0dYvQy;6DUpRYwSc;r4ry6v> z=nbjwytLE~I<=dr9=DG9rS!;bD&d+?^W~#oQaD3dyms+m~Y|uh|rbgY5a-E zll~EWvJ=j>B=IEFjK=n!pcaq4 z(B}PAG@O663;zsl(|&-q?oBtA7Cs(0=KHh${VRp}U4(z=(fcttRyMK=fvX%U6A;Z>$1yloQn?o zd1lzir00pl#6q!ygLnWRfjwq@|`TnfS3g<1(YNf_n_v9}O<$tx6Wv5bWxZDATpLEHP94SE4 zUnl_YXY@@uVDJ{`U4L_XYwhFo0mx8SsT<(n5Qr8jd)?#RJ)OP%d#2Uj52s{uy!2f= zyZ`_I24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2jvA7 z3p4@c0wl};00AaRL_t(I%e9lgYQj(y#((z`&NZ43WNA&W5i@S#d;Mdy=nM|>Tgk8}DmK}V|rUE0F|oza*&thB#nl_lu)mi=Z&HQr`dkycr9 zfR{}MF{{`MK1<--__Kf$$B`(ldTy9Ta!hL~73xf;^de7?GnpP+x#^hfs5_<~`(A+8 TvYm`h00000NkvXXu0mjfWqkZ} diff --git a/addons/gift/placeholder.png b/addons/gift/placeholder.png index 35719d5e0d3d509c4547ac79562f5f655aad1e97..c156f907e0d6269a2a2ac3878ffc3cf399984eb4 100644 GIT binary patch delta 71 zcmb=3njqoC$jrdNplX||1f`kB!N$PAApiM)B9LM%4sv&5Sa(k5C6Hs}>Eak-(VOg381rjBBma!O`dsr( zn1$mal@6?6Y(B_v?EnA&kA2x!`kl^r-4w{o*38JT^E_t?Pw0UXpl$|FS3j3^P6mn@m2C=HZgED7=pW^j0RBMrz|;pyTSQgQ3;)q|Xe4Fp^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