fix default channel Ids and radix in event.js
This commit is contained in:
parent
86eb394ef1
commit
1e9307cc47
|
@ -14,6 +14,7 @@ export class ChatProvider {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.defaultChannels = [];
|
this.defaultChannels = [];
|
||||||
this.defaultChannelIds = [];
|
this.defaultChannelIds = [];
|
||||||
|
this.intChannelId = 0;
|
||||||
this.caseCheck = /^[A-Z !.]*$/;
|
this.caseCheck = /^[A-Z !.]*$/;
|
||||||
this.cyrillic = new RegExp('[\u0436-\u043B]');
|
this.cyrillic = new RegExp('[\u0436-\u043B]');
|
||||||
this.filters = [
|
this.filters = [
|
||||||
|
@ -64,6 +65,9 @@ export class ChatProvider {
|
||||||
raw: true,
|
raw: true,
|
||||||
});
|
});
|
||||||
const { id } = channel[0];
|
const { id } = channel[0];
|
||||||
|
if (name === 'int') {
|
||||||
|
this.intChannelId = id;
|
||||||
|
}
|
||||||
this.defaultChannels.push([
|
this.defaultChannels.push([
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
@ -194,7 +198,7 @@ export class ChatProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.match(this.cyrillic) && channelId === 0) {
|
if (message.match(this.cyrillic) && channelId === this.intChannelId) {
|
||||||
return 'Please use int channel';
|
return 'Please use int channel';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +251,7 @@ export class ChatProvider {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static automute(name, channelId = 0) {
|
static automute(name, channelId = 1) {
|
||||||
ChatProvider.mute(name, channelId, 60);
|
ChatProvider.mute(name, channelId, 60);
|
||||||
webSockets.broadcastChatMessage(
|
webSockets.broadcastChatMessage(
|
||||||
'info',
|
'info',
|
||||||
|
@ -262,7 +266,7 @@ export class ChatProvider {
|
||||||
return ttl;
|
return ttl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async mute(plainName, channelId = 0, timeMin = null) {
|
static async mute(plainName, channelId = 1, timeMin = null) {
|
||||||
const name = (plainName.startsWith('@')) ? plainName.substr(1) : plainName;
|
const name = (plainName.startsWith('@')) ? plainName.substr(1) : plainName;
|
||||||
const id = await User.name2Id(name);
|
const id = await User.name2Id(name);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@ -291,7 +295,7 @@ export class ChatProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async unmute(plainName, channelId = 0) {
|
static async unmute(plainName, channelId = 1) {
|
||||||
const name = (plainName.startsWith('@')) ? plainName.substr(1) : plainName;
|
const name = (plainName.startsWith('@')) ? plainName.substr(1) : plainName;
|
||||||
const id = await User.name2Id(name);
|
const id = await User.name2Id(name);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ export function setSuccess(success) {
|
||||||
}
|
}
|
||||||
export async function getSuccess() {
|
export async function getSuccess() {
|
||||||
const success = await redis.getAsync(EVENT_SUCCESS_KEY);
|
const success = await redis.getAsync(EVENT_SUCCESS_KEY);
|
||||||
return (success) ? parseInt(success) : 0;
|
return (success) ? parseInt(success, 10) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user