-
-
Notifications
You must be signed in to change notification settings - Fork 0
V1.2 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Draft
V1.2 #5
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a9868cc
Separated config from actual script.
spikehidden d436177
Create SpikeCodeRedeemAutoGenerate.dsc
spikehidden bf81408
Update README.md
spikehidden dabc295
Merge branch 'main' into v1.2
spikehidden bce6b2d
Updated Updater Settings
spikehidden 7a119cc
➡️📂 Moved scripts to new directory.
spikehidden 56e68a4
✨ Added first snippets for Wizebot Addon
spikehidden a85b39b
Update .gitignore
spikehidden b94a10d
✨ Added duration.
spikehidden 32d55a8
Wizebot API Integration AddOn ready
spikehidden 728bd22
Merge branch 'main' into v1.2
spikehidden c9b4658
Merge branch 'main' into v1.2
spikehidden cfab727
Update FUNDING.yml
spikehidden 9916549
Don't ask
spikehidden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
.github/FUNDING.yml
This file contains hidden or 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
3 changes: 2 additions & 1 deletion
.gitignore
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| *.psd | ||
| *.bat | ||
| *.ps1 | ||
| *_ignore.* | ||
| *_ignore.* | ||
| *.psd |
This file contains hidden or 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
160 changes: 160 additions & 0 deletions
plugins/Denizen/scripts/SpikeCodeRedeem-Config.dsc
This file contains hidden or 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,160 @@ | ||
| # ++++++ License Notice ++++++ | ||
| # | ||
| # The following code is distributed under | ||
| # the CC-BY-SA-4.0 license (Attribution-ShareAlike 4.0 International). | ||
| # | ||
| # | You are free to: | ||
| # - Share | ||
| # copy and redistribute the material in any medium or format | ||
| # | ||
| # - Adapt | ||
| # remix, transform, and build upon the material | ||
| # for any purpose, even commercially. | ||
| # | ||
| # | Under the following terms: | ||
| # - Attribution | ||
| # You must give appropriate credit, | ||
| # provide a link to the license, and indicate if changes were made. | ||
| # You may do so in any reasonable manner, | ||
| # but not in any way that suggests the licensor endorses you or your use. | ||
| # | ||
| # - ShareAlike | ||
| # If you remix, transform, or build upon the material, | ||
| # you must distribute your contributions under the same license as the original. | ||
| # | ||
| # - A copy of the full license can be found here: https://creativecommons.org/licenses/by-sa/4.0/ | ||
| # | ||
| # ++++++ License End ++++++ | ||
| # | ||
| # +---------------------------------+ | ||
| # | | | ||
| # | Redeemable Codes - Configs | | ||
| # | | | ||
| # | This is only the config file | | ||
| # | DO NOT DELETE THIS FILE! | | ||
| # | | | ||
| # +---------------------------------+ | ||
| # | ||
| # @author Spikehidden | ||
| # @date 2022年06月10日 | ||
| # @denizen-build 1.2.4-SNAPSHOT (build 1766-REL) | ||
| # @script-version 1.0 | ||
| # | ||
| # + REQUIREMENTS + | ||
| # - None | ||
| # | ||
| # + Required or recommended for some features + | ||
| # - A Pastebin Account + DevKey if you want to use that feature. | ||
|
|
||
| # + CONTACT + | ||
| # | ||
| # If you need help with the setup | ||
| # or want me to add a feature please | ||
| # contact me via Twitter or Discord | ||
| # or open an issue at GitHub! | ||
| # | ||
| # - Twitter: https://spikey.biz/twitter | ||
| # - Discord: https://spikey.biz/discord | ||
| # - Twitch: https://spikey.biz/twitch | ||
| # - Ko-Fi: https://spikey.biz/kofi | ||
|
|
||
| # ++++++ Config ++++++ | ||
| SpikeCodeRedeemData: | ||
| type: data | ||
| # + Core configs | ||
| # ------ Pastebin ------ | ||
| # Do you want to use private or public pastes on Pastebin.com ? | ||
| # You can find more info in the readme at https://github.com/spikehidden/CodeRedeemScript | ||
| # Default is false as it is not recommended to use this feature when bulk creating codes! | ||
| UsePastebin: false | ||
| # Put your pastebin devKey in here as it's not possible to retrieve it from the "secrets.secret" file at the moment. | ||
| # As soon as it is possible we'll do it that way. | ||
| devKey: Put Your Key Here! | ||
|
|
||
| # + Not AddOn specific configs | ||
| # This setting is used by the following AddOns: | ||
| # - Wizebot API | ||
| server: | ||
| name: My Minecraft Server | ||
| ip: mc.example.tld | ||
|
|
||
| # + Add-On configs. | ||
| # ------ Auto Generate ------ | ||
| # For these feature you need the Auto Generate Addon | ||
| auto: | ||
| # The prefix of the auto genereated code. | ||
| # Set to "none" (without quotes) to disable. | ||
| prefix: daily- | ||
|
|
||
| # The name of the code after the prefix. | ||
| # Use "random" (without quotes) to generate a random code | ||
| code: random | ||
|
|
||
| # A list of commands that should be executed when redeeming the code. | ||
| commands: | ||
| - say this is a command. | ||
| - minecraft:give <p> 64 diamonds | ||
|
|
||
| # The intervall in hours of when the code gets generated. | ||
| interval: 24 | ||
|
|
||
| # Amount of how many players can use the code. | ||
| # Set to "unlimited" (without quotes) to have no limit. | ||
| amount: unlimited | ||
|
|
||
| # Should we delete the old code? | ||
| # Set to false to keep the old one but you need to | ||
| # set auto.code to random then or it will throw errors. | ||
| delete: true | ||
|
|
||
| # ------ Wizebot API ------- | ||
| # For these feature you need the Wizebot Addon | ||
| wizebot: | ||
| web: | ||
| # Only change this if you use nginx or something similar. If you do it anyway Wizebot won't be able to connect to your server. | ||
| port: 80 | ||
| API: | ||
| # Set here a SECURE API key. | ||
| # If set to none it's not usable | ||
| key: none | ||
|
|
||
| shop: | ||
| # ID = Uses the item_id to check which commands to assign. | ||
| # group = Uses the "group" query parameter to get the - Easier | ||
| # For more info and to get t know how to get the item IDs take a look at the wiki on Github | ||
| # https://github.com/spikehidden/coderedeemscript/wiki | ||
| mode: ID | ||
|
|
||
| # Map of group IDs which will be used for group mode. | ||
| groups: | ||
| # Group ID | ||
| group_01: | ||
| # List of Wizebot item IDs that shall be part of this group. | ||
| # Won't be used if mode is set to group | ||
| ids: | ||
| - 64509 | ||
| commands: | ||
| # The amount of random commands to choose. | ||
| amount: 1 | ||
| # The commands to randomly assign. | ||
| # Set amount to 0 to disable | ||
| random: | ||
| - minecraft:give <<>p<>> diamond 64 | ||
| # A list of commands that are always assigned to a code. | ||
| # Set to "alwaysCommand: none" to disable | ||
| always: | ||
| - minecraft:say <<>p<>> redeemed <[code]> | ||
|
|
||
|
|
||
| #+ ------ Debug & Log ------ | ||
| # Shall redemption be logged? | ||
| redemptionLog: true | ||
| logPath: spikehidden/logs/ | ||
|
|
||
| #+ ------ Advanced Settings ------ | ||
| # Don't change this unless Pastebin changed their API endpoints | ||
| API: | ||
| endpoint: pastebin.com/api/ | ||
| data: api_raw.php | ||
| login: api_login.php | ||
| paste: api_post.php |
179 changes: 179 additions & 0 deletions
plugins/Denizen/scripts/SpikeCodeRedeem-Wizebot.dsc
This file contains hidden or 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,179 @@ | ||
| # ++++++ License Notice ++++++ | ||
| # | ||
| # The following code is distributed under | ||
| # the CC-BY-SA-4.0 license (Attribution-ShareAlike 4.0 International). | ||
| # | ||
| # | You are free to: | ||
| # - Share | ||
| # copy and redistribute the material in any medium or format | ||
| # | ||
| # - Adapt | ||
| # remix, transform, and build upon the material | ||
| # for any purpose, even commercially. | ||
| # | ||
| # | Under the following terms: | ||
| # - Attribution | ||
| # You must give appropriate credit, | ||
| # provide a link to the license, and indicate if changes were made. | ||
| # You may do so in any reasonable manner, | ||
| # but not in any way that suggests the licensor endorses you or your use. | ||
| # | ||
| # - ShareAlike | ||
| # If you remix, transform, or build upon the material, | ||
| # you must distribute your contributions under the same license as the original. | ||
| # | ||
| # - A copy of the full license can be found here: https://creativecommons.org/licenses/by-sa/4.0/ | ||
| # | ||
| # ++++++ License End ++++++ | ||
| # | ||
| # +---------------------------------+ | ||
| # | | | ||
| # | Redeemable Codes - Configs | | ||
| # | | | ||
| # | This is only the config file | | ||
| # | DO NOT DELETE THIS FILE! | | ||
| # | | | ||
| # +---------------------------------+ | ||
| # | ||
| # @author Spikehidden | ||
| # @date 2022年06月10日 | ||
| # @denizen-build 1.2.4-SNAPSHOT (build 1766-REL) | ||
| # @script-version 1.2 | ||
| # | ||
| # + REQUIREMENTS + | ||
| # - Spikehidden Redeemable Codes | https://github.com/spikehidden/ | ||
| # | ||
| # + Required or recommended for some features + | ||
| # - A Pastebin Account + DevKey if you want to use that feature. | ||
|
|
||
| # + CONTACT + | ||
| # | ||
| # If you need help with the setup | ||
| # or want me to add a feature please | ||
| # contact me via Twitter or Discord | ||
| # or open an issue at GitHub! | ||
| # | ||
| # - Twitter: https://spikey.biz/twitter | ||
| # - Discord: https://spikey.biz/discord | ||
| # - Twitch: https://spikey.biz/twitch | ||
| # - Ko-Fi: https://spikey.biz/kofi | ||
|
|
||
| # ++++++ World ++++++ | ||
| SpikeCodeRedeemWizebotSystem: | ||
| type: world | ||
| debug: true | ||
| events: | ||
| #- Check if core script is loaded | ||
| on scripts loaded: | ||
| - if <server.has_flag[SpikehiddenUpdater]>: | ||
| - announce "<&ss>9[SpikeCodeRedeem]<&ss>r Spikehidden's Auto Updater has been found!" to_console | ||
| - flag server SpikeCodeRedeemAutoUpdate:github | ||
| - flag server SpikehiddenUpdater.data:->:SpikeCodeRedeemAutoUpdate | ||
| - announce "<&ss>9[SpikeCodeRedeem]<&ss>r Providing Update data of Auto Generate Addon for Spikehidden's Auto Updater" to_console | ||
| after scripts loaded: | ||
| - if <server.has_flag[SpikeCodeRedeem]>: | ||
| - define port <script[SpikeCodeRedeemData].data_key[wizebot.web.port]> | ||
| - flag server SpikeCodeRedeem.addon.wizebot | ||
| - announce "<&ss>9[SpikeCodeRedeem]<&ss>r Add-On <&dq>Wizebot<&dq> is loaded." to_console | ||
| - webserver start port:<[port]> | ||
| - else: | ||
| - announce "<&ss>9[SpikeCodeRedeem]<&ss>r Add-On <&dq>Wizebot<&dq> can't be used without core script." to_console | ||
| - announce "<&ss>9[SpikeCodeRedeem]<&ss>r Download core script from https://github.com/spikehidden/CodeRedeemScript" to_console | ||
|
|
||
| SpikeCodeRedeemWizebotAPI: | ||
| type: world | ||
| debug: true | ||
| events: | ||
| on webserver web request method:post path:/wizebot/create: | ||
| # Get query parameters | ||
| - define query <context.query> | ||
| - define code <[query].get[code].if_null[random]> | ||
| - define queryKey <[query].get[key].if_null[null]> | ||
| - define duration <[query].get[duration].if_null[unlimited]> | ||
| - define prefix <[query].get[prefix].if_null[<empty>]> | ||
| - define group <[query].get[group].if_null[null]> | ||
|
|
||
| #headers | ||
| - define heads <context.headers> | ||
| - define type <[heads].get[content-type].get[1]> | ||
| - define boundary <[type].replace_text[multipart/form-data; boundary=]> | ||
|
|
||
| # Map POST parameters: | ||
| - define prepost <context.body.replace_text[Content-Disposition: form-data; name=<&dq>]> | ||
| - define prepost <[prepost].split[<&chr[000D]><&chr[000A]>]> | ||
| - define prepost <[prepost].separated_by[]> | ||
| - define post_list <[prepost].split[--<[boundary]>].remove[first].remove[last]> | ||
| - define post <[post_list].to_map[<&dq>]> | ||
| - define item_id <[post].get[item_id].if_null[null]> | ||
| - define item_name <[post].get[item_name].if_null[null]> | ||
| - define viewer_id <[post].get[item_id].if_null[null]> | ||
| - define viewer_name <[post].get[item_id].if_null[null]> | ||
|
|
||
| # Get stuff from config | ||
| - define key <script[SpikeCodeRedeemData].data_key[wizebot.api.key].if_null[none]> | ||
| - define mode <script[SpikeCodeRedeemData].data_key[wizebot.shop.mode].if_null[ID]> | ||
| - define groupList <script[SpikeCodeRedeemData].data_key[wizebot.shop.groups].if_null[none]> | ||
|
|
||
| # If key is missing, invalid or not configerured send 401 ERROR | ||
| - if <[key]> == none || <[queryKey]> != <[key]>: | ||
| - define answer "UNAUTHORIZED - KEY IS MISSING OR INVALID" | ||
| - determine code:401 passively | ||
| - determine headers:[Content-Type=text/plain] passively | ||
| - determine RAW_TEXT_CONTENT:<[answer]> | ||
|
|
||
| # If nothing is set up in the Config send KO status and ERROR | ||
| - if <[groupList]> == none: | ||
| - define text "Configuration Error! - Please tell the Streamer that something went wrong." | ||
| - define status KO | ||
| - definemap answer: | ||
| status: <[status]> | ||
| text_to_return: <[text]> | ||
| - determine code:200 passively | ||
| - determine headers:[Content-Type=application/json] passively | ||
| - determine RAW_TEXT_CONTENT:<[answer].to_json> | ||
|
|
||
| # Get group if in ID mode | ||
| - if <[mode]> == ID: | ||
| - foreach <[groupList]>: | ||
| - if <[value].get[ids].contains_text[<[item_id]>]>: | ||
| - define group <[key]> | ||
| - foreach stop | ||
|
|
||
| # Get group Data | ||
| - define groupData <script[SpikeCodeRedeemData].data_key[wizebot.shop.groups.<[group]>].if_null[none]> | ||
| - define randomAmount <[groupData].deep_get[commands.amount].if_null[0]> | ||
| - define random <[groupData].deep_get[commands.random].if_null[null]> | ||
| - define always <[groupData].deep_get[commands.always].if_null[none]> | ||
|
|
||
| # Add always commands. | ||
| - if <[always]> != none: | ||
| - define commands <[always].as[list]> | ||
|
|
||
| # Choose radnom commands. | ||
| - if <[randomAmount]> >= 1 && <[random]> != null: | ||
| - define commands:->:<[random].random[<[randomAmount]>]> | ||
|
|
||
| # If commands are empty run error. | ||
| - if <[commands].if_null[<list>].is_empty>: | ||
| - define text "Configuration Error! - Please tell the Streamer that something went wrong." | ||
| - define status KO | ||
| - definemap answer: | ||
| text_to_return: <[text]> | ||
| status: <[status]> | ||
| - determine code:200 passively | ||
| - determine headers:[Content-Type=application/json] passively | ||
| - determine RAW_TEXT_CONTENT:<[answer].to_json> | ||
|
|
||
| #Inject Code Creation Task | ||
| - define amount 1 | ||
| - define permission null | ||
| - inject SpikeCodeCreateCode | ||
|
|
||
| # Finaly send the code to Wizebot | ||
| - definemap answer: | ||
| text_to_return: Your code for Foxcraft is: <[code]> | ||
| status: OK | ||
| - determine passively code:200 | ||
| - determine passively headers:[Content-Type=application/json] | ||
| - determine RAW_TEXT_CONTENT:<[answer].to_json> | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.