mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-14 01:50:54 +00:00
4.6.0
* Added: Custom Chat Commands now have an option to paste their output into chat input rather than immediately sending the message. * Added: The option to tab-complete emotes without the use of a colon (:). Please note that this feature still has limitations due to limitations in how Twitch's tab-completion system is implemented, and may not work as you expect. * Added: The number of results from emote tab-completion will now be limited to 25 by default to mitigate its performance impact. This may be disabled in settings.
This commit is contained in:
parent
3120d586d2
commit
86b0b624f7
6 changed files with 59 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "frankerfacez",
|
||||
"author": "Dan Salvato LLC",
|
||||
"version": "4.5.5",
|
||||
"version": "4.6.0",
|
||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
|
|
|
@ -149,13 +149,13 @@ export default class ExperimentManager extends Module {
|
|||
if ( window.__twilightSettings )
|
||||
return window.__twilightSettings.experiments;
|
||||
|
||||
const core = this.resolve('site').getCore();
|
||||
const core = this.resolve('site')?.getCore();
|
||||
return core && core.experiments.experiments;
|
||||
}
|
||||
|
||||
|
||||
usingTwitchExperiment(key) {
|
||||
const core = this.resolve('site').getCore();
|
||||
const core = this.resolve('site')?.getCore();
|
||||
return core && has(core.experiments.assignments, key)
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ export default class ExperimentManager extends Module {
|
|||
overrides[key] = value;
|
||||
Cookie.set(OVERRIDE_COOKIE, overrides, COOKIE_OPTIONS);
|
||||
|
||||
const core = this.resolve('site').getCore();
|
||||
const core = this.resolve('site')?.getCore();
|
||||
if ( core )
|
||||
core.experiments.overrides[key] = value;
|
||||
|
||||
|
@ -181,7 +181,7 @@ export default class ExperimentManager extends Module {
|
|||
delete overrides[key];
|
||||
Cookie.set(OVERRIDE_COOKIE, overrides, COOKIE_OPTIONS);
|
||||
|
||||
const core = this.resolve('site').getCore();
|
||||
const core = this.resolve('site')?.getCore();
|
||||
if ( core )
|
||||
delete core.experiments.overrides[key];
|
||||
|
||||
|
@ -194,7 +194,7 @@ export default class ExperimentManager extends Module {
|
|||
}
|
||||
|
||||
getTwitchAssignment(key) {
|
||||
const core = this.resolve('site').getCore(),
|
||||
const core = this.resolve('site')?.getCore(),
|
||||
exps = core && core.experiments;
|
||||
|
||||
if ( ! exps )
|
||||
|
@ -235,7 +235,7 @@ export default class ExperimentManager extends Module {
|
|||
}
|
||||
|
||||
_rebuildTwitchKey(key, is_set, new_val) {
|
||||
const core = this.resolve('site').getCore(),
|
||||
const core = this.resolve('site')?.getCore(),
|
||||
exps = core.experiments,
|
||||
|
||||
old_val = has(exps.assignments, key) ?
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<template lang="html">
|
||||
<div class="tw-flex tw-align-items-start">
|
||||
<label for="edit_chat" class="tw-mg-y-05">
|
||||
<label :for="'edit_chat$' + id" class="tw-mg-y-05">
|
||||
{{ t('setting.actions.chat', 'Chat Command') }}
|
||||
</label>
|
||||
|
||||
<div class="tw-full-width">
|
||||
<input
|
||||
id="edit_chat"
|
||||
:id="'edit_chat$' + id"
|
||||
v-model="value.command"
|
||||
:placeholder="defaults.command"
|
||||
class="tw-border-radius-medium tw-font-size-6 tw-full-width tw-input tw-pd-x-1 tw-pd-y-05 tw-mg-y-05"
|
||||
|
@ -16,14 +16,36 @@
|
|||
<div class="tw-c-text-alt-2 tw-mg-b-1">
|
||||
{{ t('setting.actions.variables', 'Available Variables: {vars}', {vars}) }}
|
||||
</div>
|
||||
|
||||
<div class="tw-checkbox">
|
||||
<input
|
||||
:id="'chat-paste$' + id"
|
||||
v-model="value.paste"
|
||||
type="checkbox"
|
||||
class="tw-checkbox__input"
|
||||
@change="$emit('input', value)"
|
||||
>
|
||||
|
||||
<label :for="'chat-paste$' + id" class="tw-checkbox__label">
|
||||
{{ t('setting.actions.set-chat', 'Paste this message into chat rather than sending it directly.') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
let last_id = 0;
|
||||
|
||||
export default {
|
||||
props: ['value', 'defaults', 'vars'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
id: last_id++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
|
@ -636,6 +636,11 @@ export default class Actions extends Module {
|
|||
}
|
||||
|
||||
|
||||
pasteMessage(room, message) {
|
||||
return this.resolve('site.chat.input').pasteMessage(room, message);
|
||||
}
|
||||
|
||||
|
||||
sendMessage(room, message) {
|
||||
return this.resolve('site.chat').sendMessage(room, message);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ export const chat = {
|
|||
required_context: ['room'],
|
||||
|
||||
defaults: {
|
||||
command: '@{{user.login}} HeyGuys'
|
||||
command: '@{{user.login}} HeyGuys',
|
||||
paste: false
|
||||
},
|
||||
|
||||
title: 'Chat Command',
|
||||
|
@ -86,6 +87,9 @@ export const chat = {
|
|||
|
||||
click(event, data) {
|
||||
const msg = this.replaceVariables(data.options.command, data);
|
||||
if ( data.options.paste )
|
||||
this.pasteMessage(data.room.login, msg);
|
||||
else
|
||||
this.sendMessage(data.room.login, msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,4 +352,20 @@ export default class Input extends Module {
|
|||
|
||||
return results;
|
||||
}
|
||||
|
||||
pasteMessage(room, message) {
|
||||
for(const inst of this.ChatInput.instances) {
|
||||
if ( inst?.props?.channelLogin !== room )
|
||||
continue;
|
||||
|
||||
if ( ! inst.autocompleteInputRef || ! inst.state )
|
||||
return;
|
||||
|
||||
if ( inst.state.value )
|
||||
message = `${inst.state.value} ${message}`;
|
||||
|
||||
inst.autocompleteInputRef.setValue(message);
|
||||
inst.autocompleteInputRef.componentRef?.focus?.();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue