-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
2,195 additions
and
801 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Branches | ||
The `master` branch is reserved for the current latest release. We will not accept Pull Requests made to it. | ||
|
||
For developement, work from the `v5` branch and then Pull Request against it. | ||
|
||
# Formatting | ||
We use Unix-style end of line character: Line-Feed(`\n` aka `\x0A`) | ||
|
||
We use 4 spaces for indents |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"[javascript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"files.eol": "\n" | ||
}, | ||
"editor.formatOnSave": true | ||
} |
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
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,102 @@ | ||
'use strict'; | ||
|
||
const path = require("path"); | ||
|
||
const electron = require("electron"); | ||
const { Menu, Tray, app } = electron; | ||
|
||
const frontendCommunicator = require('../../common/frontend-communicator.js'); | ||
const { settings } = require("../../common/settings-access"); | ||
|
||
let mainTray; | ||
let minimizedToTray = false; | ||
|
||
module.exports = function createTray(mainWindow) { | ||
if (mainTray != null) { | ||
return; | ||
} | ||
|
||
const trayMenu = Menu.buildFromTemplate([ | ||
{ | ||
label: 'Show', | ||
type: 'normal', | ||
click: () => { | ||
if (minimizedToTray) { | ||
mainWindow.show(); | ||
minimizedToTray = false; | ||
} else { | ||
mainWindow.focus(); | ||
} | ||
} | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Exit', | ||
type: 'normal', | ||
click: () => { | ||
app.quit(); | ||
} | ||
} | ||
]); | ||
mainTray = new Tray(path.join(__dirname, "../../../gui/images/logo_transparent_2.png")); | ||
mainTray.setToolTip('Firebot'); | ||
mainTray.setContextMenu(trayMenu); | ||
|
||
mainTray.on('double-click', () => { | ||
if (minimizedToTray) { | ||
mainWindow.show(); | ||
minimizedToTray = false; | ||
} else { | ||
mainWindow.focus(); | ||
} | ||
}); | ||
|
||
mainWindow.on('minimize', () => { | ||
if (settings.getMinimizeToTray() && minimizedToTray !== true) { | ||
mainWindow.hide(); | ||
minimizedToTray = true; | ||
} | ||
}); | ||
|
||
mainWindow.on('restore', () => { | ||
if (minimizedToTray) { | ||
if (!mainWindow.isVisible()) { | ||
mainWindow.show(); | ||
} | ||
minimizedToTray = false; | ||
} | ||
|
||
}); | ||
mainWindow.on('show', () => { | ||
if (minimizedToTray) { | ||
if (mainWindow.isMinimized()) { | ||
mainWindow.restore(); | ||
} | ||
minimizedToTray = false; | ||
} | ||
}); | ||
mainWindow.on('focus', () => { | ||
if (minimizedToTray) { | ||
if (mainWindow.isMinimized()) { | ||
mainWindow.restore(); | ||
} | ||
if (!mainWindow.isVisible()) { | ||
mainWindow.show(); | ||
} | ||
minimizedToTray = false; | ||
} | ||
}); | ||
|
||
frontendCommunicator.on('settings-updated-renderer', (evt) => { | ||
if ( | ||
evt.path === '/settings/minimizeToTray' && | ||
evt.data !== true && | ||
minimizedToTray === true | ||
) { | ||
mainWindow.show(); | ||
minimizedToTray = false; | ||
} | ||
}); | ||
}; |
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
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
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,71 @@ | ||
"use strict"; | ||
|
||
const twitchChannels = require("../../twitch-api/resource/channels"); | ||
const quotesManager = require("../../quotes/quotes-manager"); | ||
const { EffectCategory } = require('../../../shared/effect-constants'); | ||
const moment = require("moment"); | ||
|
||
const addQuoteEffect = { | ||
definition: { | ||
id: "firebot:add-quote", | ||
name: "Add Quote", | ||
description: "Adds a quote to the quote database.", | ||
icon: "fad fa-quote-right", | ||
categories: [EffectCategory.FUN], | ||
dependencies: [] | ||
}, | ||
globalSettings: {}, | ||
optionsTemplate: ` | ||
<eos-container header="Quote Creator"> | ||
<p class="muted">This is the name of the person who is creating the quote entry.</p> | ||
<input ng-model="effect.creator" type="text" class="form-control" id="chat-text-setting" placeholder="Enter quote creator" replace-variables/> | ||
</eos-container> | ||
<eos-container header="Quote Originator" pad-top="true"> | ||
<p class="muted">This is the name of the person who actually said the quote.</p> | ||
<input ng-model="effect.originator" type="text" class="form-control" id="chat-text-setting" placeholder="Enter quote originator" replace-variables/> | ||
</eos-container> | ||
<eos-container header="Quote Text" pad-top="true"> | ||
<p class="muted">This is the actual quote text.</p> | ||
<input ng-model="effect.text" type="text" class="form-control" id="chat-text-setting" placeholder="Enter quote text" replace-variables/> | ||
</eos-container> | ||
`, | ||
optionsController: () => {}, | ||
optionsValidator: effect => { | ||
let errors = []; | ||
if (effect.creator == null || effect.creator === "") { | ||
errors.push("Please provide a quote creator."); | ||
} | ||
|
||
if (effect.originator == null || effect.originator === "") { | ||
errors.push("Please provide a quote originator."); | ||
} | ||
|
||
if (effect.text == null || effect.text === "") { | ||
errors.push("Please provide a value for quote text."); | ||
} | ||
return errors; | ||
}, | ||
onTriggerEvent: async event => { | ||
const { effect } = event; | ||
|
||
const channelData = await twitchChannels.getChannelInformation(); | ||
|
||
const currentGameName = channelData && channelData.gameName ? channelData.gameName : "Unknown game"; | ||
|
||
const newQuote = { | ||
text: effect.text, | ||
originator: effect.originator.replace(/@/g, ""), | ||
creator: effect.creator.replace(/@/g, ""), | ||
game: currentGameName, | ||
createdAt: moment().toISOString() | ||
} | ||
|
||
quotesManager.addQuote(newQuote); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
module.exports = addQuoteEffect; |
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
Oops, something went wrong.