-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix discord.userroles missing from default config * Update user build scripts * Update Readme.md * Start cleaning up the lua scripts * Fix os.exit when generated a default config * Generate a default config on build * Merge builds into a single yml * Update Actions * Remove legacy Discord method * Update Readme and add methods.md * Fix IRC Method Typo * Fix lua script typo's and fix some spacing. * Add an enableInteractiveConsole for running goTES3MP headless * Update and tidy up the tes3mp scripts * Add Migration code to newer config layout (Untested) * Actually run the Migration on OnServerInit * Fix missing checks for IrcBridge.SendSystemMessage * Add update checking * Dependency updates * Add VPN Api checks and warning if none are set but vpnChecker is enabled * Remove DataManager Requirement * Fix missing Sync Method send to tes3mp * Add ready event to Discord.go * Fix and overhaul of scripting after removing DataManager * Implement sendDiscordMessage * [Spelling Fix] responce - > response * Update Readme * Add build status and discord link * Add missing staffRole back in * Add Features - Mention and Channel Link conversion for Discord Relay (#4) * Added functionality to convert mentions --------- Co-authored-by: Shigbeard <[email protected]>
- Loading branch information
1 parent
06e2831
commit e781516
Showing
30 changed files
with
818 additions
and
466 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Build | |
|
||
on: | ||
release: | ||
types: [released] | ||
types: [published] | ||
|
||
env: | ||
IMAGE_REGISTRY: ghcr.io | ||
|
@@ -14,30 +14,34 @@ jobs: | |
name: Build Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ^1.20 | ||
stable: true | ||
id: linux-build | ||
- name: Build-Linux | ||
run: go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux src/*.go | ||
- name: Generate default config | ||
run: cd build/ &&chmod +x goTES3MP-Linux && ./goTES3MP-Linux | ||
|
||
- name: GH Release | ||
uses: softprops/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: build/goTES3MP-Linux | ||
files: | | ||
build/goTES3MP-Linux | ||
build/config.yaml | ||
build-windows: | ||
name: Build Windows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ^1.20 | ||
stable: true | ||
|
@@ -56,10 +60,10 @@ jobs: | |
name: Add Scripts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Compress scripts | ||
uses: papeloto/action-zip@v1 | ||
uses: papeloto/action-zip@v1.1 | ||
with: | ||
files: tes3mp/ | ||
dest: build/tes3mp-scripts.zip | ||
|
@@ -78,7 +82,7 @@ jobs: | |
env: | ||
DOCKER_CONFIG: $HOME/.docker | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
|
This file was deleted.
Oops, something went wrong.
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
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,74 @@ | ||
# GoTES3MP Methods | ||
|
||
### Note: syncid is not used however it hasnt been fully removed from the source code and still has to be included in some places, however can be a blank string. | ||
|
||
# "Sync" Method: [Link](../tes3mp/scripts/custom/goTES3MP\sync.lua) | ||
```lua | ||
local messageJson = { | ||
ServerID = ServerID, | ||
method = "Sync", | ||
source = "TES3MP", | ||
data = { | ||
MaxPlayers = tostring(tes3mp.GetMaxPlayers()), | ||
CurrentPlayerCount = tostring(logicHandler.GetConnectedPlayerCount()), | ||
Forced = tostring(forceResync), | ||
Status = "Ping", | ||
} | ||
} | ||
``` | ||
The Sync method is very importent to goTES3MP, this is designed to make sure the communications are working correctly, aswell as keeping the player count updated. | ||
|
||
You may also threat this as a Ping/Pong system, as goTES3MP will respond with a pong if it reads and is able to process what it received. | ||
|
||
The **Forced** variable is used with the command `/forceSync` and will force goTES3MP to accept the data thats being sent with it, this is useful if your ServerID has changed or you restarted/updated goTES3MP, however this is usually not needed and will be handled automatically. | ||
|
||
# "IRC" Method: | ||
This script used to support using IRC to **<u>Chat with Discord and tes3mp</u>**. However when this was rewritten with a more refined system, this method was never reimplemented, It's been left in as it may be reimplemented in the future. | ||
|
||
# "rawDiscord" Method: | ||
```lua | ||
local messageJson = | ||
method = "rawDiscord", | ||
source = "TES3MP", | ||
serverid = goTES3MP.GetServerID(), | ||
syncid = GoTES3MPSyncID, | ||
data = { | ||
channel = discordChannel, | ||
server = discordServer, | ||
message = "**" .. "[TES3MP] " .. tes3mp.GetName(pid) .. " has connected" .. "**" | ||
} | ||
``` | ||
This method is the main one you will be using for tes3mp->discord, as this method is very flexible with its use. | ||
|
||
channel: The desired discord channel you want the bot to send the message to. | ||
server: The desired discord server you want the bot to use. | ||
|
||
message: This is what you want the bot to send to discord as a message. Note that this also supports multilined inputs and any discord formatting tips. This should also work with emotes however they can be a little buggy, so it's **<u>recommended that you use Discord emoticons and not default unicode, such as smiley faces</u>** | ||
|
||
|
||
# "VPNCheck" Method: [Link](../tes3mp/scripts/custom/goTES3MP/VPNChecker.lua) | ||
```lua | ||
local messageJson = { | ||
method = "VPNCheck", | ||
source = "TES3MP", | ||
serverid = goTES3MP.GetServerID(), | ||
syncid = GoTES3MPSyncID, | ||
data = { | ||
channel = discordChannel, | ||
server = discordServer, | ||
message = IP, | ||
playerpid = tostring(pid) | ||
} | ||
} | ||
``` | ||
Now, this method is quite simple, all this method does is send goTES3MP the players PID and IP to goTES3MP with a VPNCheck method. | ||
|
||
goTES3MP will then check that against multiple sources to see how trustworthy an ip is. Using the following websites:<br> | ||
https://iphub.info<br> | ||
https://ipqualityscore.com | ||
|
||
You may find the related goTES3MP code [here](../src/vpnChecker.go), However theirs not much to read, it will just show you the api responses and how the bot is building/handling it. | ||
|
||
Note that currently, if you wish to use Anti-VPN you should use both services, as iphub can miss some ip's that ipqualityscore will catch. | ||
|
||
If an IP is deamed to be an VPN or seemingly bad, such as a proxy, it will send a VPNCheck method back to tes3mp, with a modified data packet, telling it to kick that pid. You can find this [Here](../tes3mp/scripts/custom/IrcBridge/IrcBridge.lua#L107-L130) |
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
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
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,13 @@ | ||
# Commit hash | ||
$commitHash = (git rev-parse HEAD) | ||
|
||
# Path Resolving | ||
$goFiles = Get-ChildItem -Path 'src\' -Name '*.go' -File | ||
$goFiles = $goFiles | ForEach-Object {"src/$_"} | ||
|
||
# Build variables for go build | ||
Set-Variable GOOS=windows | ||
Set-Variable GOARCH=amd64 | ||
|
||
# Build command | ||
go build -ldflags="-X 'main.Build=v0.0.0-Dev' -X 'main.GitCommit=$commitHash'" -o build/goTES3MP-Windows.exe $goFiles |
Oops, something went wrong.