Skip to content

Commit

Permalink
・棒読みちゃんに対応
Browse files Browse the repository at this point in the history
・VOICEVOXに対応
・翻訳したらサウンドカード選択が動かなくなったので、IDなし=デフォルトになるよう動作変更
・翻訳を少し進めた
  • Loading branch information
nmori committed Dec 13, 2023
1 parent 0e6d9d7 commit fdcb1c5
Show file tree
Hide file tree
Showing 14 changed files with 461 additions and 15 deletions.
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"sanitize-filename": "^1.6.3",
"socket.io-client": "^2.3.0",
"tiny-typed-emitter": "^2.1.0",
"tmp": "*",
"ui-select": "^0.19.8",
"underscore": "^1.13.1",
"unzipper": "^0.9.15",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/chat/third-party/7tv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SevenTVEmoteProvider extends ThirdPartyEmoteProvider<SevenTVEmotesR

globalEmoteUrl = "https://7tv.io/v3/emotes/global";
getChannelEmotesUrl(streamerUserId: number): string {
return `https://7tv.io/v3/users/${streamerUserId}/emotes`;
return `https://7tv.io/v3/users/twitch/${streamerUserId}`;
}

private emoteMapper(response: SevenTVEmotesResponse): ThirdPartyEmote[] {
Expand Down
16 changes: 16 additions & 0 deletions src/backend/common/EffectType.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ const effectDefinitions = [
dependencies: [],
description: "音を再生する"
},
{
id: "PLAY_BOUYOMICHAN",
v5Id: "firebot:playbouyomichan",
name: "棒読みちゃんで再生",
triggers: ALL_TRIGGERS,
dependencies: [],
description: "音を再生する"
},
{
id: "PLAY_VOICEVOX",
v5Id: "firebot:playvoicevox",
name: "VOICEVOXで再生",
triggers: ALL_TRIGGERS,
dependencies: [],
description: "音を再生する"
},
{
id: "RANDOM_EFFECT",
v5Id: "firebot:randomeffect",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/common/handlers/mediaProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function soundProcessor(effect) {
let selectedOutputDevice = effect.audioOutputDevice;
if (
selectedOutputDevice == null ||
selectedOutputDevice.label === "App Default"
selectedOutputDevice.deviceId === ""
) {
selectedOutputDevice = settings.getAudioOutputDevice();
}
Expand Down
2 changes: 2 additions & 0 deletions src/backend/effects/builtin-effect-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ exports.loadEffects = () => {
'moderator-purge',
'moderator-timeout',
'pause-resume-effect-queue',
'play-bouyomichan',
'play-sound',
'play-video', // No migration needed.
'play-voicevox',
'raid',
'random-effect',
'random-reddit-image',
Expand Down
4 changes: 2 additions & 2 deletions src/backend/effects/builtin/chat-feed-alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const { EffectCategory, EffectDependency } = require('../../../shared/effect-con
const effect = {
definition: {
id: "firebot:chat-feed-alert",
name: "チャットフィード警告",
name: "チャットアラート",
description: "Firebotのチャットフィードにアラートを表示する",
icon: "fad fa-comment-exclamation",
categories: [EffectCategory.COMMON, EffectCategory.CHAT_BASED],
dependencies: [EffectDependency.CHAT]
},
optionsTemplate: `
<eos-container>
<p>このエフェクトを使うと、実際のチャットメッセージを使わずにFirebotのチャットフィードにアラートを送ることができます。つまり、アラートはあなただけに表示されます。</p>
<p>この演出を使うと、実際のチャットメッセージを使わずにFirebotのチャットフィードにアラートを送ることができます。つまり、アラートはあなただけに表示されます。</p>
</eos-container>
<eos-container header="アラート" pad-top="true">
<textarea ng-model="effect.message" class="form-control" name="text" placeholder="Enter message" rows="4" cols="40" replace-variables></textarea>
Expand Down
6 changes: 3 additions & 3 deletions src/backend/effects/builtin/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const currency = {
*/
optionsTemplate: `
<eos-container header="Currency">
<eos-container header="通貨">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="currency-name">{{effect.currency ? getCurrencyName(effect.currency) : 'Pick one'}}</span> <span class="caret"></span>
<span class="currency-name">{{effect.currency ? getCurrencyName(effect.currency) : '選択...'}}</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu currency-name-dropdown">
<li ng-repeat="currency in currencies"
Expand All @@ -52,7 +52,7 @@ const currency = {
</eos-container>
<div ng-if="effect.currency">
<eos-container header="Operation" pad-top="true">
<eos-container header="操作内容" pad-top="true">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="currency-action">{{effect.action ? effect.action : 'Pick one'}}</span> <span class="caret"></span>
Expand Down
127 changes: 127 additions & 0 deletions src/backend/effects/builtin/play-bouyomichan.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"use strict";

const { EffectCategory } = require('../../../shared/effect-constants');
const axiosDefault = require("axios").default;

const axios = axiosDefault.create({
headers: {
'User-Agent': 'Firebot v5 - HTTP Request Effect'
}
});

axios.interceptors.request.use(request => {
//logger.debug('HTTP Request Effect [Request]: ', JSON.parse(JSON.stringify(request)));
return request;
});

axios.interceptors.response.use(response => {
//logger.debug('HTTP Request Effect [Response]: ', JSON.parse(JSON.stringify(response)));
return response;
});

const effect = {
definition: {
id: "firebot:playbouyomichan",
name: "棒読みちゃんで発話",
description: "指定した文章を読み上げます",
icon: "fad fa-terminal",
categories: [EffectCategory.ADVANCED, EffectCategory.SCRIPTING],
dependencies: []
},
globalSettings: {},
optionsTemplate: `
<eos-container header="メッセージ" pad-top="true">
<textarea ng-model="effect.message" class="form-control" name="text" placeholder="メッセージの入力" rows="4" cols="40" replace-variables></textarea>
</eos-container>
<eos-container header="通信設定" pad-top="true">
<dropdown-select options="['HTTP']" selected="effect.communicateMode"></dropdown-select>
<div class="form-group" ng-class="{'has-error': $ctrl.formFieldHasError('cost')}">
<label for="port" class="control-label">ポート</label>
<input
type="number"
class="form-control input-lg"
id="port"
name="port"
placeholder="ポート"
ng-model="effect.port"
required
min="0"
style="width: 50%;"
/>
<p class="help-block">通常は50080を指定</p>
</div>
<div class="form-group" ng-class="{'has-error': $ctrl.formFieldHasError('cost')}">
<label for="voiceid" class="control-label">音声ID</label>
<input
type="number"
class="form-control input-lg"
id="voiceid"
name="voiceid"
placeholder="音声ID(初期値をつかうなら-1)"
ng-model="effect.voiceid"
required
min="0"
style="width: 50%;"
/>
<p class="help-block">音声番号を指定</p>
</div>
</eos-container>
`,
optionsController: ($scope, utilityService) => {
if ($scope.effect.communicateMode == null) {
$scope.effect.communicateMode = "HTTP";
}
if ($scope.effect.port == null) {
$scope.effect.port = 50080;
}
if ($scope.effect.voiceid == null) {
$scope.effect.voiceid = -1;
}
},
optionsValidator: (effect) => {
const errors = [];
if (effect.port === "" || effect.port == null) {
errors.push("ポート番号を指定してください");
}
if (effect.voiceid === "" || effect.voiceid == null) {
errors.push("音声IDを入れてください。");
}
return errors;
},
onTriggerEvent: async event => {

const logger = require("../../logwrapper");
const twitchAuth = require("../../auth/twitch-auth");
const accountAccess = require("../../common/account-access");
const customVariableManager = require("../../common/custom-variable-manager");
const effectRunner = require("../../common/effect-runner");

const { effect, trigger } = event;

try {
const response = await axios({
method:'get',
url: 'http://localhost:'+effect.port+'/talk?text=' +encodeURIComponent(effect.message) + '&voice=' +String(effect.voiceid)
});

} catch (error) {
logger.error("Error running http request", error.message);
}

return {
success: true
};
},
overlayExtension: {
dependencies: {
css: [],
js: []
},
event: {}
}
};

module.exports = effect;
8 changes: 4 additions & 4 deletions src/backend/effects/builtin/play-sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const playSound = {
},
globalSettings: {},
optionsTemplate: `
<eos-container header="Type">
<eos-container header="メディアタイプ">
<firebot-radios
options="{ local: 'Local file', folderRandom: 'Random from folder', url: 'Url' }"
options="{ local: 'ローカルファイル', folderRandom: 'フォイル内のファイルをランダム再生', url: 'ネット上のものを再生' }"
model="effect.soundType"
inline="true"
style="padding-bottom: 5px;"
Expand All @@ -50,7 +50,7 @@ const playSound = {
</div>
<div style="padding-top:20px">
<label class="control-fb control--checkbox"> Wait for sound to finish <tooltip text="'音が鳴り終わるのを待ってから、次の効果をかける。'"></tooltip>
<label class="control-fb control--checkbox">再生終了を待つ <tooltip text="'音が鳴り終わるのを待ってから、次の効果に移ります'"></tooltip>
<input type="checkbox" ng-model="effect.waitForSound">
<div class="control__indicator"></div>
</label>
Expand Down Expand Up @@ -132,7 +132,7 @@ const playSound = {

// Set output device.
let selectedOutputDevice = effect.audioOutputDevice;
if (selectedOutputDevice == null || selectedOutputDevice.label === "App Default") {
if (selectedOutputDevice == null || selectedOutputDevice.deviceId === "") {
selectedOutputDevice = settings.getAudioOutputDevice();
}
data.audioOutputDevice = selectedOutputDevice;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/effects/builtin/play-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const playVideo = {
* You can alternatively supply a url to a html file via optionTemplateUrl
*/
optionsTemplate: `
<eos-container header="Video">
<eos-container header="ビデオ">
<div style="padding-bottom: 10px">
<div ng-if="shouldShowVideoPlaceholder()" >
<img src="../images/placeholders/video.png" style="width: 350px;object-fit: scale-down;background: #d7d7d7">
Expand Down
Loading

0 comments on commit fdcb1c5

Please sign in to comment.