Closed KstreakOG closed 8 years ago
As you can see in the wiki there's an event called 'Userjoin' which is triggered when a user is entering your room. https://github.com/plugCubed/plugAPI/wiki/[events]%20userJoin
An example could be (extracted from my bot in October 2015):
bot.on('userJoin', function(data){
if(data != null && data != undefined) {
var user = data.from || data.username;
var room = bot.getRoomMeta();
if(user !== bot.getSelf().username && user !== undefined) // don't poke bot himself and guests
bot.sendChat(":wave: Hi @" + user + " nice to see you here in " + room.name + " :exclamation:");
}
});
Dunno if it's still working since i've not been following actively PlugAPI since PlugDJ has first closed it's doors months ago.
PS: If it can help you here's the old version of my bot before PlugDJ close => https://github.com/Talos51/WatchPlug
@KstreakOG is there anything else you need help with?
@thedark1337 sup! how i can do an automatic woot? idk, i'm not that good with js i only know python and i tried something but it doesn't work
@pukapy
bot.on(PlugAPI.events.ADVANCE, function(data) {
if (bot.getDJ() && data.media) {
if (bot.getSelf()) {
var dj = bot.getDJ();
if (dj == null || dj.id == null || dj.id === bot.getSelf().id) return;
bot.woot();
return;
}
}
});
but why plugapi.events.advance and not "djAdvance" ?
if you want to use just the string it would be advance
, we have an object defined in plugAPI so that if the events change , you won't need to change your code
thank u very much :p i'm playing with it from 1 hour and it's very good that someone is helping xD
Np, if you have any further questions feel free to ask on a new issue or join our slack here
Hello I have been working on my bot on dubtrack using the dubapi and now when I move over I need some help on something that would usually be :
bot.on(bot.events.chatMessage, function(data) { if(data.message === '/trap') { bot.sendChat('Here is a great trap channel!'); var yomomma = quotes.yomomma; random = yomomma[Math.floor(Math.random() * yomomma.length)]; bot.sendChat(random); } });
but I need some help how would I do this in plugAPI for example getting the username of the person who joined etc.