Re-add things that were accidentally removed

This commit is contained in:
Aaron Franke 2021-05-21 08:29:43 -04:00
parent 65aacbcf2a
commit 25c2bbc80a
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
14 changed files with 127 additions and 30 deletions

11
.gitattributes vendored Normal file
View File

@ -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

50
.github/workflows/file_format.sh vendored Executable file
View File

@ -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 <hash>'\n"
rm -f patch.patch
exit 1

19
.github/workflows/static_checks.yml vendored Normal file
View File

@ -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

17
.gitignore vendored Normal file
View File

@ -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
*~

View File

@ -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

26
Gift.gd
View File

@ -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 (<channel_name>)
# Fails, if connected to more than one channel.
# chat("TEST")
# Send a chat message to channel <channel_name>
# chat("TEST", initial_channel)
# Send a whisper to target user
# whisper("TEST", initial_channel)

View File

@ -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(<channel_name>)
# 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 (<channel_name>)
# Fails, if connected to more than one channel.
chat("TEST")
# Send a chat message to channel <channel_name>
chat("TEST", <channel_name>)
# Send a whisper to target user
whisper("TEST", <target_name>)
@ -104,7 +104,7 @@ func greet_me(cmd_info : CommandInfo) -> void:
func list(cmd_info : CommandInfo, arg_ary : PoolStringArray) -> void:
chat(arg_ary.join(", "))
```
***

View File

@ -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):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 90 B

View File

@ -13,4 +13,4 @@ func _init(f_ref : FuncRef, perm_lvl : int, mx_args : int, mn_args : int, whr :
max_args = mx_args
min_args = mn_args
where = whr

View File

@ -9,4 +9,4 @@ func _init(sndr_dt, cmd, whspr):
sender_data = sndr_dt
command = cmd
whisper = whspr

View File

@ -187,7 +187,7 @@ class Entry extends Reference:
var type : int
var filename : String
var data : Array
func _init(path : String, type : int, filename : String, data : Array):
self.path = path
self.type = type

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 271 B