mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-02 17:18:31 +00:00
Add command to rename group chats
This commit is contained in:
parent
70ec6d5348
commit
cb88ac9cac
1 changed files with 36 additions and 1 deletions
|
@ -444,6 +444,41 @@ FFZ.prototype.get_banned_users = function() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Group Chat Renaming
|
||||
// ---------------------
|
||||
FFZ.chat_commands.renamegroup = function(room, args) {
|
||||
// Get the current room.
|
||||
var controller = utils.ember_lookup('controller:chat'),
|
||||
room_id = controller.get('currentRoom.id'),
|
||||
room = this.rooms[room_id],
|
||||
has_product = false,
|
||||
f = this;
|
||||
|
||||
//Join the arguments and check to see if something was entered
|
||||
newname = args.join(' ');
|
||||
if ( encodeURI(newname).split(/%..|./).length-1 == 0 ) {
|
||||
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 ( ! f.rooms[room_id].room.get('isGroupRoom') ) {
|
||||
return "You must be in a group chat to use renamegroup."
|
||||
}
|
||||
if ( ! f.rooms[room_id].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 ( encodeURI(newname).split(/%..|./).length-1 > 120 ) {
|
||||
return "You entered a room name that was too long."
|
||||
}
|
||||
|
||||
//Set the group name
|
||||
f.rooms[room_id].room.tmiRoom.session._depotApi.put("/rooms/"+[room_id],{display_name: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) )
|
||||
|
@ -458,4 +493,4 @@ FFZ.prototype.get_banned_users = function() {
|
|||
|
||||
|
||||
|
||||
}*/
|
||||
}*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue