mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
3.5.395. Clean up /renamegroup command. Hard-coded modifier emotes still suck. Fix modifiers sticking to emoji.
This commit is contained in:
parent
0fbd226788
commit
439f2c32ae
8 changed files with 66 additions and 52 deletions
|
@ -1,3 +1,12 @@
|
|||
<div class="list-header">3.5.395 <time datetime="2016-12-10">(2016-12-10)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: <code>/renamegroup</code> chat command to rename the current group chat room.</li>
|
||||
<li>Changed: Add a few more hard-coded modifier emoticons. (Why haven't I made an API yet? NotLikeThis)</li>
|
||||
<li>Fixed: Modifiers sticking to the master emoji token, causing all emoji to become decorated with modifiers.</li>
|
||||
<li>Fixed: Incorrect detection of certain dashboard pages causing FFZ to do an incomplete initialization.</li>
|
||||
<li>Fixed: Bug when testing to see if a chat command should be accessible.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.394 <time datetime="2016-12-08">(2016-12-08)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: The <code>/card</code> command and the link in whisper windows to Open Moderation Card were not working.</li>
|
||||
|
@ -53,15 +62,5 @@
|
|||
<li>Fixed: Mod cards not properly initializing in channels where you're not a mod.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.384 <time datetime="2016-11-29">(2016-11-29)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Issue causing empty chat lines when badge data has not yet loaded.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.383 <time datetime="2016-11-29">(2016-11-29)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Update moderation card after Twitch made some changes.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header" id="ffz-old-news-button"><a href="#">View Older</a></div>
|
||||
<div id="ffz-old-news"></div>
|
|
@ -3,6 +3,7 @@
|
|||
<li><a href="//twitch.tv/fugi" target="_blank">Fugi</a> - Wrote the Chat Delay feature.</li>
|
||||
<li><a href="//twitch.tv/daxterspeed" target="_blank">DaxterSpeed</a> - Wrote a method for adjusting username colors.</li>
|
||||
<li><a href="//twitch.tv/riking27" target="_blank">Riking</a> - Wrote a large part of the socket server system.</li>
|
||||
<li><a href="//twitch.tv/walle303" target="_blank">walle303</a> - Wrote a chat command to rename group chats. Also reported a bug or two.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
<div class="list-header">3.5.384 <time datetime="2016-11-29">(2016-11-29)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Issue causing empty chat lines when badge data has not yet loaded.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.383 <time datetime="2016-11-29">(2016-11-29)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Update moderation card after Twitch made some changes.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.382 <time datetime="2016-11-28">(2016-11-28)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Bits breaking chat.</li>
|
||||
|
|
|
@ -2,7 +2,7 @@ var FFZ = window.FrankerFaceZ,
|
|||
constants = require('./constants'),
|
||||
utils = require('./utils'),
|
||||
|
||||
KNOWN_COMMANDS = ['ffz', 'unban', 'ban', 'timeout', 'r9kbeta', 'r9kbetaoff', 'slow', 'slowoff', 'subscribers', 'subscribersoff', 'mod', 'unmod', 'me', 'emotesonly', 'emotesonlyoff', 'host', 'unhost', 'commercial'],
|
||||
KNOWN_COMMANDS = ['ffz', 'unban', 'ban', 'timeout', 'r9kbeta', 'r9kbetaoff', 'slow', 'slowoff', 'subscribers', 'subscribersoff', 'mod', 'unmod', 'me', 'emoteonly', 'emoteonlyoff', 'host', 'unhost', 'commercial'],
|
||||
|
||||
STATUS_CODES = {
|
||||
400: "Bad Request",
|
||||
|
@ -355,6 +355,39 @@ FFZ.chat_commands.fetch_link.label = '/fetch_link <url> <i>[template]</i>'
|
|||
FFZ.chat_commands.fetch_link.info = 'Fetch URL and Display in Chat';
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Group Chat Renaming
|
||||
// ---------------------
|
||||
|
||||
FFZ.chat_commands.renamegroup = function(room, args) {
|
||||
var f = this,
|
||||
new_name = args.join(' ');
|
||||
if ( ! new_name.length )
|
||||
return "Usage: /renamegroup <name>\nGroup owner only. Rename a group chat.";
|
||||
|
||||
// Check that the length of the arguments is less than 120 bytes
|
||||
else if ( utils.utf8_encode(new_name).length > 120 )
|
||||
return "You entered a room name that is too long.";
|
||||
|
||||
// Set the group name
|
||||
room.room.tmiRoom.session._depotApi.put("/rooms/" + room.id, {
|
||||
display_name: new_name
|
||||
}).then(function(result) {
|
||||
if ( result && result.room && result.room.display_name === new_name )
|
||||
f.room_message(room, 'The room was renamed to: ' + new_name);
|
||||
else
|
||||
f.room_message(room, 'The room name was not changed successfully.')
|
||||
});
|
||||
}
|
||||
|
||||
FFZ.chat_commands.renamegroup.label = '/renamegroup <name>';
|
||||
FFZ.chat_commands.renamegroup.info = 'Rename a group chat. Group owner only.'
|
||||
FFZ.chat_commands.renamegroup.enabled = function(room) {
|
||||
// Are we in a group chat and are we the owner?
|
||||
return room && room.room && room.room.get('isGroupRoom') && room.room.get('isOwner');
|
||||
}
|
||||
|
||||
|
||||
// -----------------
|
||||
// Mass Moderation
|
||||
// -----------------
|
||||
|
@ -443,42 +476,6 @@ FFZ.prototype.get_banned_users = function() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Group Chat Renaming
|
||||
// ---------------------
|
||||
FFZ.chat_commands.renamegroup = function(room, args) {
|
||||
// Shorten the FFZ instance
|
||||
var f = this;
|
||||
|
||||
// Join the arguments and check to see if something was entered
|
||||
var newname = args.join(' ');
|
||||
if ( ! newname.length ) {
|
||||
return "Usage: /renamegroup <name>\nThis command must be used inside a group chat that you are owner of."
|
||||
}
|
||||
|
||||
// Are we in a group chat and are we the owner?
|
||||
if ( ! room.room.get('isGroupRoom') ) {
|
||||
return "You must be in a group chat to use renamegroup."
|
||||
}
|
||||
if ( ! room.room.get('isOwner') ) {
|
||||
return "You must be the owner of the current group chat to use renamegroup."
|
||||
}
|
||||
|
||||
// Check that the length of the arguments is less than 120 bytes
|
||||
if ( unescape(encodeURIComponent(newname)).length > 120 ) {
|
||||
return "You entered a room name that was too long."
|
||||
}
|
||||
|
||||
// Set the group name
|
||||
room.room.tmiRoom.session._depotApi.put(
|
||||
"/rooms/" + room.id,
|
||||
{display_name:newname}
|
||||
)
|
||||
return( "Room renamed to \"" + newname + "\"" )
|
||||
}
|
||||
|
||||
/*FFZ.ffz_commands.massunban = function(room, args) {
|
||||
var user = this.get_user();
|
||||
if ( ! user || (user.login !== room.id && ! user.is_admin && ! user.is_staff) )
|
||||
|
@ -491,6 +488,4 @@ FFZ.chat_commands.renamegroup = function(room, args) {
|
|||
/*FFZ.ffz_commands.massunban = function(room, args) {
|
||||
args = args.join(" ").trim();
|
||||
|
||||
|
||||
|
||||
}*/
|
||||
|
|
|
@ -699,6 +699,7 @@ FFZ.prototype.modify_chat_input = function(component) {
|
|||
var commands = _.extend({}, DEFAULT_COMMANDS),
|
||||
in_conversation = ConvoInput && this.parentView instanceof ConvoInput,
|
||||
room = this.get('parentView.room'),
|
||||
ffz_room = room && f.rooms[room.get('id')],
|
||||
is_moderator = room && room.get('isModeratorOrHigher'),
|
||||
user = f.get_user(),
|
||||
is_broadcaster = room && user && user.login === room.get('name');
|
||||
|
@ -722,7 +723,7 @@ FFZ.prototype.modify_chat_input = function(component) {
|
|||
var enabled = data.hasOwnProperty('enabled') ? data.enabled : true;
|
||||
if ( typeof enabled === "function" )
|
||||
try {
|
||||
enabled = data.enabled.call(f, room, [])
|
||||
enabled = data.enabled.call(f, ffz_room, [])
|
||||
} catch(err) {
|
||||
f.error('command "' + cmd + '" enabled', err);
|
||||
enabled = false;
|
||||
|
|
|
@ -61,7 +61,7 @@ FFZ.channel_metadata = {};
|
|||
|
||||
// Version
|
||||
var VER = FFZ.version_info = {
|
||||
major: 3, minor: 5, revision: 394,
|
||||
major: 3, minor: 5, revision: 395,
|
||||
toString: function() {
|
||||
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
|
||||
}
|
||||
|
|
|
@ -1334,7 +1334,7 @@ FFZ.prototype.tokenize_emoji = function(tokens) {
|
|||
if ( data ) {
|
||||
if ( text && text.length )
|
||||
new_tokens.push(text);
|
||||
new_tokens.push(data.token);
|
||||
new_tokens.push(_.extend({modifiers: []}, data.token));
|
||||
text = null;
|
||||
} else
|
||||
text = (text || '') + match;
|
||||
|
|
|
@ -973,6 +973,14 @@ module.exports = FFZ.utils = {
|
|||
}
|
||||
},
|
||||
|
||||
utf8_encode: function(text) {
|
||||
return unescape(encodeURIComponent(text))
|
||||
},
|
||||
|
||||
utf8_decode: function(text) {
|
||||
return decodeURIComponent(escape(text));
|
||||
},
|
||||
|
||||
emote_css: function(emote) {
|
||||
var output = '';
|
||||
if ( ! emote.margins && (!emote.modifier || (! emote.modifier_offset && ! emote.extra_width && ! emote.shrink_to_fit)) && ! emote.css )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue