Closed moongoesrawr closed 5 years ago
I believe it does, but I'm not in front of the computer to test right now - does your bot have a high enough role (permissions level) in the room to be able to change the description?
Yes, it is a co-host. I think I'm not very good with this. There is a lot I want to do, but frankly have no clue how to do. I kind of just brute force my way through things sometimes. I figured this would be straight forward like bot.changeRoomName(); and bot.changeRoomWelcome(); are. Thanks in advance for any help. :)
Gentle reminder nudge. :)
Hi @moongoesrawr ,
Just ran some test and i can confirm it seems that bot.changeRoomDescription("your description") does nothing even with co-host permissions. PlugAPI is deprecated on that point and need some update on changeRoomDescription() method since Plug.DJ does now have a "short description" and "detailed description" in room info meta ( https://plug.dj/_/rooms/state ) and not using actively description anymore.
I think an update is needed in client.js to include some new methods ChangeRoomDescription ( for short description ) and ChangeRoomLongDescription ( for detailed description ).
Maybe something like that ?
changeRoomDescription(description, callback) {
if (!store(this)._room.getRoomMeta().slug || !this.havePermission(undefined, PlugAPI.ROOM_ROLE.COHOST) || Object.is(store(this)._room.getRoomMeta().short_description, description) || this.guest) {
return false;
}
store(this)._queueREST('POST', endpoints.ROOM_INFO, {
name: undefined,
short_description: description,
long_description: undefined,
minChatLevel: undefined,
welcome: undefined
}, callback);
return true;
}
changeRoomLongDescription(longDescription, callback) {
if (!store(this)._room.getRoomMeta().slug || !this.havePermission(undefined, PlugAPI.ROOM_ROLE.COHOST) || Object.is(store(this)._room.getRoomMeta().longDescription, longDescription) || this.guest) {
return false;
}
store(this)._queueREST('POST', endpoints.ROOM_INFO, {
name: undefined,
short_description: undefined,
long_description: longDescription,
minChatLevel: undefined,
welcome: undefined
}, callback);
return true;
}
I've tested this modification on test environment and it worked fine.
const PlugAPI = require('plugapi');
new PlugAPI({
email: 'Your_MAIL',
password: 'Your_PASSWORD'
}, (err, bot) => {
if (!err) {
bot.connect('YourRoom'); // The part after https://plug.dj
bot.on(PlugAPI.events.ROOM_JOIN, (room) => {
console.log(`Joined ${room}`);
bot.multiLine = true;
bot.multiLineLimit = 5;
bot.sendChat("#1 - Changing Room Short Description");
bot.changeRoomDescription("THIS IS MY SHORT DESC", function(){
bot.sendChat("Changed room description !");
});
bot.sendChat("Sleeping for 5sec !");
setTimeout(function() {
bot.sendChat("#2 - Changing Room Long Description");
bot.changeRoomLongDescription("THIS IS A DETAILED DESCRIPTION ALSO CALLED LONG DESCRIPTION", function(){
bot.sendChat("Changed room long description !");
});
}, 5000);
});
} else {
console.log(`Error initializing plugAPI: ${err}`);
}
});
Regards, Talos.
Hi,
We aren't deprecated as much as ... busy with life. I apologize for not having responded in a timely manner but you're right, Plug changed it so that there's both a long and short description now. A lot of stuff still needs to be fixed with plugAPI to get it working 100% and any help we can get is much appreciated.
If you'd like to, you can either pull request to have that added or I can add it in myself and release a minor version to add it in.
Thanks,
@thedark1337 Just did a pull request to address this issue. Once again thanks for bringing us PlugAPI and I didn't mean to disrespect you when i mentioned this project as "deprecated".
No offense taken, thanks for your help! I'll be updating dependencies as well, before releasing a version that will fix this issue
Wow, thanks guys!
I apologize if this has been covered, I can't find anything, and I hope I'm just missing something. Does bot.changeRoomDescription(); work? I have tried bot.changeRoomDescription('text'); and it does not change my room description. Any insight would be helpful. Thank you!