Skip to content

Commit

Permalink
V2!
Browse files Browse the repository at this point in the history
  • Loading branch information
FaeyUmbrea committed Sep 27, 2024
1 parent 2712e95 commit 0707a18
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
patreon: voidmonster
patreon: voidmonster
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ jobs:
+: xc
node
yarnpkg.com
- name: Lint
run: |
yarn
yarn lint
- name: Substitute Manifest and Download Links For Versioned Ones
run: |
cat ./public/module.json | jq '.version="${{ github.ref_name }}" | .url="https://github.com/${{github.repository}}" | .manifest="https://github.com/${{github.repository}}/releases/latest/download/module.json" | .download="https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/module.zip"' > ./public/module.json.tmp
Expand All @@ -33,7 +29,7 @@ jobs:
run: xc build
- run: (cd dist && zip -r ../module.zip *)
- run: zip -ur module.zip LICENSE README.md
- run: awk '/##/{p++} p==2{exit} p>=1' ./CHANGELOG.md >> body.md
- run: awk '/^## /{p++} p==2{exit} p>=1' ./CHANGELOG.md >> body.md
- name: Update Release with Files
id: create_version_release
uses: ncipollo/release-action@v1
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Version 2.0

### Added

- Multi stream Support

### Changed

- Everything! Ethereal Plane now has an all-new and improved backend!
2 changes: 1 addition & 1 deletion public/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"compatibility": {
"maximum": 12,
"verified": 12,
"minimum": 11.292
"minimum": 10
},
"authors": [
{
Expand Down
10 changes: 7 additions & 3 deletions src/server/patreon.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export class PatreonConnector {
};
}

/**
* @returns {(function(*): Promise<void>)|*}
*/
getPollUpdateCallback() {
return async (pollUpdate) => {
/**
Expand All @@ -141,8 +144,9 @@ export class PatreonConnector {
: pollUpdate.finalized
? PollStatus.stopped
: PollStatus.started;
poll.tally = pollUpdate.options.map((entry) => {
return entry.count;
poll.tally = poll.options.map((entry) => {
return pollUpdate.options.find((option) => option.name === entry.name)
.count;
});
if (wasRunning && poll.status === PollStatus.stopped) {
executePollMacro();
Expand Down Expand Up @@ -208,7 +212,7 @@ export class PatreonConnector {
const pollId = await createPoll(
poll.duration * 1000,
poll.options.map((option) => {
return { name: option.text, title: option.text };
return { name: option.name, title: option.text };
}),
"!vote",
poll.title,
Expand Down
2 changes: 1 addition & 1 deletion src/server/poll_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let connection = null;
* @property {Date} startTimeStamp - Start Time Stamp
* @property {boolean} aborted - Is Poll Aborted
* @property {boolean} finalized - Is Poll Finalized
* @property {Array<{count:int}>} options - List of Poll Options
* @property {Array<{count:int,name:string}>} options - List of Poll Options
*/

/**
Expand Down
8 changes: 7 additions & 1 deletion src/svelte/components/PollEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
import { TJSDocument } from "@typhonjs-fvtt/runtime/svelte/store/fvtt/document";
import { getConnectionManager } from "../../server/connectionManager.js";
/**
* @type {Poll}
*/
const poll = settings.getStore("currentPoll");
let title = "";
let duration = 30;
function addOption() {
if ($poll.options.length >= 5) return;
const newPoll = $poll;
newPoll.options.push({ key: "new option" });
newPoll.options.push({
text: "",
name: ($poll.options.length + 1).toString(),
});
setSetting("currentPoll", newPoll);
}
Expand Down
18 changes: 11 additions & 7 deletions src/utils/polls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import { getGame } from "./helpers.js";

/** */
export class Poll {
/** */
/** @type string */
title = undefined;
/** @default [{ text: 'yes' }, { text: 'no' }] */
options = [{ text: "yes" }, { text: "no" }];
/** @default [0, 0] */
/** @type Array<PollOption> */
options = [
{ text: "yes", name: "1" },
{ text: "no", name: "2" },
];
/** @type Array<number> @default [0, 0] */
tally = [0, 0];
/** */
/** @type number */
duration = undefined;
/** */
/** @type Date */
createdAt = undefined;
/** @default PollStatus.notStarted */
status = PollStatus.notStarted;
/** */
/** @type string */
id = undefined;
}

Expand Down Expand Up @@ -53,5 +56,6 @@ export function executePollMacro() {

/** @typedef {Object} PollOption
* @property {string} text
* @property {string} name
* @property {string} [macro]
*/

0 comments on commit 0707a18

Please sign in to comment.