Giter VIP home page Giter VIP logo

Comments (8)

avatarkava avatar avatarkava commented on August 12, 2024

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?

from plugapi.

moongoesrawr avatar moongoesrawr commented on August 12, 2024

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. :)

from plugapi.

moongoesrawr avatar moongoesrawr commented on August 12, 2024

Gentle reminder nudge. :)

from plugapi.

Talos51 avatar Talos51 commented on August 12, 2024

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}`);
    }
});

Capture

Regards,
Talos.

from plugapi.

thedark1337 avatar thedark1337 commented on August 12, 2024

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

from plugapi.

Talos51 avatar Talos51 commented on August 12, 2024

#164

@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".

from plugapi.

thedark1337 avatar thedark1337 commented on August 12, 2024

No offense taken, thanks for your help! I'll be updating dependencies as well, before releasing a version that will fix this issue

from plugapi.

moongoesrawr avatar moongoesrawr commented on August 12, 2024

Wow, thanks guys!

from plugapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.