lightings 9e9a9f9519 ...
2023-04-19 18:49:58 +08:00

34 lines
735 B
JavaScript

module.exports = function(app) {
return new ChatRemote(app, app.get('chatService'));
}
class ChatRemote {
constructor(app, chatService) {
this.app = app;
this.chatService = chatService;
this.channelService = app.get('channelService');
}
add = function (uid, name, channelName, cb) {
this.chatService.add(uid, name, channelName, cb);
cb();
};
leave = function(uid, channelName, cb) {
this.chatService.leave(uid, channelName, cb);
cb();
}
kick = function(uid, sid, cb) {
const channelId = "worldChannel";
const channel = this.channelService.getChannel(channelId, false);
if (channel) {
channel.leave(uid, sid);
}
this.chatService.kick(uid, cb);
cb();
}
}