lightings c24617788d ...
2023-05-15 12:44:59 +08:00

35 lines
781 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.gcs = this.app.get("globalChannelService");
}
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, teamId, cb) {
const channelId = "worldChannel";
this.gcs.leave(channelId, uid, sid);
if (teamId) {
const teamChannelId = `teamChannel_${teamId}`
this.gcs.leave(teamChannelId, uid, sid);
}
this.chatService.kick(uid, cb);
cb();
}
}