You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
Move to Renderer V2
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { ForumData } from './ForumData';
|
||||
|
||||
export class ExtendedForumData extends ForumData
|
||||
{
|
||||
private _readPermissions: number;
|
||||
private _postMessagePermissions: number;
|
||||
private _postThreadPermissions: number;
|
||||
private _moderatePermissions: number;
|
||||
private _readPermissionError: string;
|
||||
private _postMessagePermissionError: string;
|
||||
private _postThreadPermissionError: string;
|
||||
private _moderatePermissionError: string;
|
||||
private _reportPermissionError: string;
|
||||
private _canChangeSettings: boolean;
|
||||
private _isStaff: boolean;
|
||||
|
||||
public static parse(wrapper: IMessageDataWrapper): ExtendedForumData
|
||||
{
|
||||
const extendedForumData: ExtendedForumData = new ExtendedForumData();
|
||||
|
||||
ForumData.fillFromMessage(extendedForumData, wrapper);
|
||||
|
||||
extendedForumData._readPermissions = wrapper.readInt();
|
||||
extendedForumData._postMessagePermissions = wrapper.readInt();
|
||||
extendedForumData._postThreadPermissions = wrapper.readInt();
|
||||
extendedForumData._moderatePermissions = wrapper.readInt();
|
||||
extendedForumData._readPermissionError = wrapper.readString();
|
||||
extendedForumData._postMessagePermissionError = wrapper.readString();
|
||||
extendedForumData._postThreadPermissionError = wrapper.readString();
|
||||
extendedForumData._moderatePermissionError = wrapper.readString();
|
||||
extendedForumData._reportPermissionError = wrapper.readString();
|
||||
extendedForumData._canChangeSettings = wrapper.readBoolean();
|
||||
extendedForumData._isStaff = wrapper.readBoolean();
|
||||
|
||||
return extendedForumData;
|
||||
}
|
||||
|
||||
public get readPermissions(): number
|
||||
{
|
||||
return this._readPermissions;
|
||||
}
|
||||
|
||||
public get postMessagePermissions(): number
|
||||
{
|
||||
return this._postMessagePermissions;
|
||||
}
|
||||
|
||||
public get postThreadPermissions(): number
|
||||
{
|
||||
return this._postThreadPermissions;
|
||||
}
|
||||
|
||||
public get moderatePermissions(): number
|
||||
{
|
||||
return this._moderatePermissions;
|
||||
}
|
||||
|
||||
public get hasReadPermissionError(): boolean
|
||||
{
|
||||
return (this._readPermissionError.length === 0);
|
||||
}
|
||||
|
||||
public get canReport(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public get hasPostMessagePermissionError(): boolean
|
||||
{
|
||||
return (this._postMessagePermissionError.length === 0);
|
||||
}
|
||||
|
||||
public get hasPostThreadPermissionError(): boolean
|
||||
{
|
||||
return (this._postThreadPermissionError.length === 0);
|
||||
}
|
||||
|
||||
public get hasModeratePermissionError(): boolean
|
||||
{
|
||||
return (this._moderatePermissionError.length === 0);
|
||||
}
|
||||
|
||||
public get canChangeSettings(): boolean
|
||||
{
|
||||
return this._canChangeSettings;
|
||||
}
|
||||
|
||||
public get isStaf(): boolean
|
||||
{
|
||||
return this._isStaff;
|
||||
}
|
||||
|
||||
public get readPermissionError(): string
|
||||
{
|
||||
return this._readPermissionError;
|
||||
}
|
||||
|
||||
public get postMessagePermissionError(): string
|
||||
{
|
||||
return this._postMessagePermissionError;
|
||||
}
|
||||
|
||||
public get postThreadPermissionError(): string
|
||||
{
|
||||
return this._postThreadPermissionError;
|
||||
}
|
||||
|
||||
public get moderatePermissionError(): string
|
||||
{
|
||||
return this._moderatePermissionError;
|
||||
}
|
||||
|
||||
public get reportPermissionError(): string
|
||||
{
|
||||
return this._reportPermissionError;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { GuildForumThread } from './GuildForumThread';
|
||||
|
||||
export class ForumData
|
||||
{
|
||||
private _groupId: number;
|
||||
private _name: string;
|
||||
private _description: string;
|
||||
private _icon: string;
|
||||
private _totalThreads: number;
|
||||
private _leaderboardScore: number;
|
||||
private _totalMessages: number;
|
||||
private _unreadMessages: number;
|
||||
private _lastMessageId: number;
|
||||
private _lastMessageAuthorId: number;
|
||||
private _lastMessageAuthorName: string;
|
||||
private _lastMessageTimeAsSecondsAgo: number;
|
||||
|
||||
public static parse(wrapper: IMessageDataWrapper): ForumData
|
||||
{
|
||||
return this.fillFromMessage(new ForumData(), wrapper);
|
||||
}
|
||||
|
||||
protected static fillFromMessage(data: ForumData, wrapper: IMessageDataWrapper): ForumData
|
||||
{
|
||||
data._groupId = wrapper.readInt();
|
||||
data._name = wrapper.readString();
|
||||
data._description = wrapper.readString();
|
||||
data._icon = wrapper.readString();
|
||||
data._totalThreads = wrapper.readInt();
|
||||
data._leaderboardScore = wrapper.readInt();
|
||||
data._totalMessages = wrapper.readInt();
|
||||
data._unreadMessages = wrapper.readInt();
|
||||
data._lastMessageId = wrapper.readInt();
|
||||
data._lastMessageAuthorId = wrapper.readInt();
|
||||
data._lastMessageAuthorName = wrapper.readString();
|
||||
data._lastMessageTimeAsSecondsAgo = wrapper.readInt();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get description(): string
|
||||
{
|
||||
return this._description;
|
||||
}
|
||||
|
||||
public get icon(): string
|
||||
{
|
||||
return this._icon;
|
||||
}
|
||||
|
||||
public get totalThreads(): number
|
||||
{
|
||||
return this._totalThreads;
|
||||
}
|
||||
|
||||
public get leaderboardScore(): number
|
||||
{
|
||||
return this._leaderboardScore;
|
||||
}
|
||||
|
||||
public get totalMessages(): number
|
||||
{
|
||||
return this._totalMessages;
|
||||
}
|
||||
|
||||
public get unreadMessages(): number
|
||||
{
|
||||
return this._unreadMessages;
|
||||
}
|
||||
|
||||
public get lastMessageId(): number
|
||||
{
|
||||
return this._lastMessageId;
|
||||
}
|
||||
|
||||
public get lastMessageAuthorId(): number
|
||||
{
|
||||
return this._lastMessageAuthorId;
|
||||
}
|
||||
|
||||
public get lastMessageAuthorName(): string
|
||||
{
|
||||
return this._lastMessageAuthorName;
|
||||
}
|
||||
|
||||
public get lastMessageTimeAsSecondsAgo(): number
|
||||
{
|
||||
return this._lastMessageTimeAsSecondsAgo;
|
||||
}
|
||||
|
||||
public updateFrom(forum: ForumData): void
|
||||
{
|
||||
this._totalThreads = forum._totalThreads;
|
||||
this._totalMessages = forum._totalMessages;
|
||||
this._unreadMessages = forum._unreadMessages;
|
||||
this._lastMessageAuthorId = forum._lastMessageAuthorId;
|
||||
this._lastMessageAuthorName = forum._lastMessageAuthorName;
|
||||
this._lastMessageId = forum._lastMessageId;
|
||||
this._lastMessageTimeAsSecondsAgo = forum._lastMessageTimeAsSecondsAgo;
|
||||
}
|
||||
|
||||
public get lastReadMessageId(): number
|
||||
{
|
||||
return (this._totalMessages - this._unreadMessages);
|
||||
}
|
||||
|
||||
public set lastReadMessageId(k: number)
|
||||
{
|
||||
this._unreadMessages = (this._totalMessages - k);
|
||||
|
||||
if(this._unreadMessages < 0) this._unreadMessages = 0;
|
||||
}
|
||||
|
||||
public addNewThread(thread: GuildForumThread): void
|
||||
{
|
||||
this._lastMessageAuthorId = thread.lastUserId;
|
||||
this._lastMessageAuthorName = thread.lastUserName;
|
||||
this._lastMessageId = thread.lastMessageId;
|
||||
this._lastMessageTimeAsSecondsAgo = thread.lastCommentTime;
|
||||
this._totalThreads++;
|
||||
this._totalMessages++;
|
||||
this._unreadMessages = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { ExtendedForumData } from './ExtendedForumData';
|
||||
|
||||
export class ForumDataMessageParser implements IMessageParser
|
||||
{
|
||||
private _extendedForumData: ExtendedForumData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._extendedForumData = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._extendedForumData = ExtendedForumData.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get extendedForumData(): ExtendedForumData
|
||||
{
|
||||
return this._extendedForumData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { ForumData } from './ForumData';
|
||||
|
||||
export class GetForumsListMessageParser implements IMessageParser
|
||||
{
|
||||
private _listCode: number;
|
||||
private _totalAmount: number;
|
||||
private _startIndex: number;
|
||||
private _amount: number;
|
||||
private _forums: ForumData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._listCode = -1;
|
||||
this._totalAmount = 0;
|
||||
this._startIndex = -1;
|
||||
this._amount = 0;
|
||||
this._forums = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._listCode = wrapper.readInt();
|
||||
this._totalAmount = wrapper.readInt();
|
||||
this._startIndex = wrapper.readInt();
|
||||
this._amount = wrapper.readInt();
|
||||
this._forums = [];
|
||||
|
||||
let i = 0;
|
||||
|
||||
while(i < this._amount)
|
||||
{
|
||||
this._forums.push(ForumData.parse(wrapper));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get listCode(): number
|
||||
{
|
||||
return this._listCode;
|
||||
}
|
||||
|
||||
public get totalAmount(): number
|
||||
{
|
||||
return this._totalAmount;
|
||||
}
|
||||
|
||||
public get startIndex(): number
|
||||
{
|
||||
return this._startIndex;
|
||||
}
|
||||
|
||||
public get amount(): number
|
||||
{
|
||||
return this._amount;
|
||||
}
|
||||
|
||||
public get forums(): ForumData[]
|
||||
{
|
||||
return this._forums;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class GuildForumThread
|
||||
{
|
||||
private _threadId: number;
|
||||
private _authorId: number;
|
||||
private _authorName: string;
|
||||
private _creationTimeAsSecondsAgo: number;
|
||||
private _header: string;
|
||||
private _totalMessages: number;
|
||||
private _unreadMessagesCount: number;
|
||||
private _lastMessageId: number;
|
||||
private _lastUserId: number;
|
||||
private _lastUserName: string;
|
||||
private _lastCommentTime: number;
|
||||
private _state: number;
|
||||
private _adminId: number;
|
||||
private _adminName: string;
|
||||
private _adminOperationTimeAsSecondsAgo: number;
|
||||
private _isPinned: boolean;
|
||||
private _isLocked: boolean;
|
||||
|
||||
public static parse(wrapper: IMessageDataWrapper): GuildForumThread
|
||||
{
|
||||
const thread = new GuildForumThread();
|
||||
|
||||
thread._threadId = wrapper.readInt();
|
||||
thread._authorId = wrapper.readInt();
|
||||
thread._authorName = wrapper.readString();
|
||||
thread._header = wrapper.readString();
|
||||
thread._isPinned = wrapper.readBoolean();
|
||||
thread._isLocked = wrapper.readBoolean();
|
||||
thread._creationTimeAsSecondsAgo = wrapper.readInt();
|
||||
thread._totalMessages = wrapper.readInt();
|
||||
thread._unreadMessagesCount = wrapper.readInt();
|
||||
thread._lastMessageId = wrapper.readInt();
|
||||
thread._lastUserId = wrapper.readInt();
|
||||
thread._lastUserName = wrapper.readString();
|
||||
thread._lastCommentTime = wrapper.readInt();
|
||||
thread._state = wrapper.readByte();
|
||||
thread._adminId = wrapper.readInt();
|
||||
thread._adminName = wrapper.readString();
|
||||
thread._adminOperationTimeAsSecondsAgo = wrapper.readInt();
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
public get adminOperationTimeAsSecondsAgo(): number
|
||||
{
|
||||
return this._adminOperationTimeAsSecondsAgo;
|
||||
}
|
||||
|
||||
public set adminOperationTimeAsSecondsAgo(k: number)
|
||||
{
|
||||
this._adminOperationTimeAsSecondsAgo = k;
|
||||
}
|
||||
|
||||
public get lastCommentTime(): number
|
||||
{
|
||||
return this._lastCommentTime;
|
||||
}
|
||||
|
||||
public set lastCommentTime(time: number)
|
||||
{
|
||||
this._lastCommentTime = time;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public set threadId(id: number)
|
||||
{
|
||||
this._threadId = id;
|
||||
}
|
||||
|
||||
public get authorId(): number
|
||||
{
|
||||
return this._authorId;
|
||||
}
|
||||
|
||||
public set authorId(id: number)
|
||||
{
|
||||
this._authorId = id;
|
||||
}
|
||||
|
||||
public get authorName(): string
|
||||
{
|
||||
return this._authorName;
|
||||
}
|
||||
|
||||
public set authorName(name: string)
|
||||
{
|
||||
this._authorName = name;
|
||||
}
|
||||
|
||||
public get creationTimeAsSecondsAgo(): number
|
||||
{
|
||||
return this._creationTimeAsSecondsAgo;
|
||||
}
|
||||
|
||||
public set creationTimeAsSecondsAgo(time: number)
|
||||
{
|
||||
this._creationTimeAsSecondsAgo = time;
|
||||
}
|
||||
|
||||
public get header(): string
|
||||
{
|
||||
return this._header;
|
||||
}
|
||||
|
||||
public set header(header: string)
|
||||
{
|
||||
this._header = header;
|
||||
}
|
||||
|
||||
public get lastMessageId(): number
|
||||
{
|
||||
return this._lastMessageId;
|
||||
}
|
||||
|
||||
public set lastMessageId(id: number)
|
||||
{
|
||||
this._lastMessageId = id;
|
||||
}
|
||||
|
||||
public get lastUserId(): number
|
||||
{
|
||||
return this._lastUserId;
|
||||
}
|
||||
|
||||
public set lastUserId(id: number)
|
||||
{
|
||||
this._lastUserId = id;
|
||||
}
|
||||
|
||||
public get lastUserName(): string
|
||||
{
|
||||
return this._lastUserName;
|
||||
}
|
||||
|
||||
public set lastUserName(name: string)
|
||||
{
|
||||
this._lastUserName = name;
|
||||
}
|
||||
|
||||
public get totalMessages(): number
|
||||
{
|
||||
return this._totalMessages;
|
||||
}
|
||||
|
||||
public set totalMessages(total: number)
|
||||
{
|
||||
this._totalMessages = total;
|
||||
}
|
||||
|
||||
public get unreadMessagesCount(): number
|
||||
{
|
||||
return this._unreadMessagesCount;
|
||||
}
|
||||
|
||||
public set unreadMessagesCount(count: number)
|
||||
{
|
||||
this._unreadMessagesCount = count;
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public set state(state: number)
|
||||
{
|
||||
this._state = state;
|
||||
}
|
||||
|
||||
public get adminId(): number
|
||||
{
|
||||
return this._adminId;
|
||||
}
|
||||
|
||||
public set adminId(id: number)
|
||||
{
|
||||
this._adminId = id;
|
||||
}
|
||||
|
||||
public get adminName(): string
|
||||
{
|
||||
return this._adminName;
|
||||
}
|
||||
|
||||
public set adminName(name: string)
|
||||
{
|
||||
this._adminName = name;
|
||||
}
|
||||
|
||||
public get isPinned(): boolean
|
||||
{
|
||||
return this._isPinned;
|
||||
}
|
||||
|
||||
public set isPinned(k: boolean)
|
||||
{
|
||||
this._isPinned = k;
|
||||
}
|
||||
|
||||
public get isLocked(): boolean
|
||||
{
|
||||
return this._isLocked;
|
||||
}
|
||||
|
||||
public set isLocked(flag: boolean)
|
||||
{
|
||||
this._isLocked = flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { GuildForumThread } from './GuildForumThread';
|
||||
|
||||
export class GuildForumThreadsParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _startIndex: number;
|
||||
private _amount: number;
|
||||
private _threads: GuildForumThread[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._startIndex = -1;
|
||||
this._amount = 0;
|
||||
this._threads = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._startIndex = wrapper.readInt();
|
||||
this._amount = wrapper.readInt();
|
||||
this._threads = [];
|
||||
|
||||
let i = 0;
|
||||
|
||||
while(i < this._amount)
|
||||
{
|
||||
this._threads.push(GuildForumThread.parse(wrapper));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get startIndex(): number
|
||||
{
|
||||
return this._startIndex;
|
||||
}
|
||||
|
||||
public get amount(): number
|
||||
{
|
||||
return this._amount;
|
||||
}
|
||||
|
||||
public get threads(): GuildForumThread[]
|
||||
{
|
||||
return this._threads;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class MessageData
|
||||
{
|
||||
private _groupId: number;
|
||||
private _messageId: number;
|
||||
private _messageIndex: number;
|
||||
private _authorId: number;
|
||||
private _threadId: number;
|
||||
private _creationTime: number;
|
||||
private _messageText: string;
|
||||
private _authorName: string;
|
||||
private _authorFigure: string;
|
||||
private _state: number;
|
||||
private _adminId: number;
|
||||
private _adminName: string;
|
||||
private _adminOperationTimeAsSeccondsAgo: number;
|
||||
private _authorPostCount: number;
|
||||
|
||||
public static parse(wrapper: IMessageDataWrapper): MessageData
|
||||
{
|
||||
const messageData = new MessageData();
|
||||
|
||||
messageData._messageId = wrapper.readInt();
|
||||
messageData._messageIndex = wrapper.readInt();
|
||||
messageData._authorId = wrapper.readInt();
|
||||
messageData._authorName = wrapper.readString();
|
||||
messageData._authorFigure = wrapper.readString();
|
||||
messageData._creationTime = wrapper.readInt();
|
||||
messageData._messageText = wrapper.readString();
|
||||
messageData._state = wrapper.readByte();
|
||||
messageData._adminId = wrapper.readInt();
|
||||
messageData._adminName = wrapper.readString();
|
||||
messageData._adminOperationTimeAsSeccondsAgo = wrapper.readInt();
|
||||
messageData._authorPostCount = wrapper.readInt();
|
||||
|
||||
return messageData;
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public set state(state: number)
|
||||
{
|
||||
this._state = state;
|
||||
}
|
||||
|
||||
public get adminId(): number
|
||||
{
|
||||
return this._adminId;
|
||||
}
|
||||
|
||||
public set adminId(id: number)
|
||||
{
|
||||
this._adminId = id;
|
||||
}
|
||||
|
||||
public get adminName(): string
|
||||
{
|
||||
return this._adminName;
|
||||
}
|
||||
|
||||
public set adminName(name: string)
|
||||
{
|
||||
this._adminName = name;
|
||||
}
|
||||
|
||||
public get adminOperationTimeAsSeccondsAgo(): number
|
||||
{
|
||||
return this._adminOperationTimeAsSeccondsAgo;
|
||||
}
|
||||
|
||||
public set adminOperationTimeAsSeccondsAgo(time: number)
|
||||
{
|
||||
this._adminOperationTimeAsSeccondsAgo = time;
|
||||
}
|
||||
|
||||
public get messageId(): number
|
||||
{
|
||||
return this._messageId;
|
||||
}
|
||||
|
||||
public set messageId(id: number)
|
||||
{
|
||||
this._messageId = id;
|
||||
}
|
||||
|
||||
public get creationTime(): number
|
||||
{
|
||||
return this._creationTime;
|
||||
}
|
||||
|
||||
public set creationTime(time: number)
|
||||
{
|
||||
this._creationTime = time;
|
||||
}
|
||||
|
||||
public get authorName(): string
|
||||
{
|
||||
return this._authorName;
|
||||
}
|
||||
|
||||
public set authorName(name: string)
|
||||
{
|
||||
this._authorName = name;
|
||||
}
|
||||
|
||||
public get authorFigure(): string
|
||||
{
|
||||
return this._authorFigure;
|
||||
}
|
||||
|
||||
public set authorFigure(figure: string)
|
||||
{
|
||||
this._authorFigure = figure;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public set threadId(id: number)
|
||||
{
|
||||
this._threadId = id;
|
||||
}
|
||||
|
||||
public get messageIndex(): number
|
||||
{
|
||||
return this._messageIndex;
|
||||
}
|
||||
|
||||
public set messageIndex(index: number)
|
||||
{
|
||||
this._messageIndex = index;
|
||||
}
|
||||
|
||||
public set groupID(id: number)
|
||||
{
|
||||
this._groupId = id;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get authorId(): number
|
||||
{
|
||||
return this._authorId;
|
||||
}
|
||||
|
||||
public set authorId(id: number)
|
||||
{
|
||||
this._authorId = id;
|
||||
}
|
||||
|
||||
public get messageText(): string
|
||||
{
|
||||
return this._messageText;
|
||||
}
|
||||
|
||||
public set messageText(text: string)
|
||||
{
|
||||
this._messageText = text;
|
||||
}
|
||||
|
||||
public get authorPostCount(): number
|
||||
{
|
||||
return this._authorPostCount;
|
||||
}
|
||||
|
||||
public set authorPostCount(count: number)
|
||||
{
|
||||
this._authorPostCount = count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { MessageData } from './MessageData';
|
||||
|
||||
export class PostMessageMessageParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _threadId: number;
|
||||
private _message: MessageData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._threadId = -1;
|
||||
this._message = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._threadId = wrapper.readInt();
|
||||
this._message = MessageData.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public get message(): MessageData
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { GuildForumThread } from './GuildForumThread';
|
||||
|
||||
export class PostThreadMessageParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _thread: GuildForumThread;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._thread = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._thread = GuildForumThread.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get thread(): GuildForumThread
|
||||
{
|
||||
return this._thread;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { MessageData } from './MessageData';
|
||||
|
||||
export class ThreadMessagesMessageParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _threadId: number;
|
||||
private _startIndex: number;
|
||||
private _amount: number;
|
||||
private _messages: MessageData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._threadId = -1;
|
||||
this._startIndex = -1;
|
||||
this._amount = 0;
|
||||
this._messages = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._threadId = wrapper.readInt();
|
||||
this._startIndex = wrapper.readInt();
|
||||
this._amount = wrapper.readInt();
|
||||
this._messages = [];
|
||||
|
||||
let i = 0;
|
||||
|
||||
while(i < this._amount)
|
||||
{
|
||||
const message = MessageData.parse(wrapper);
|
||||
|
||||
message.groupID = this._groupId;
|
||||
message.threadId = this._threadId;
|
||||
|
||||
this._messages.push(message);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public get startIndex(): number
|
||||
{
|
||||
return this._startIndex;
|
||||
}
|
||||
|
||||
public get amount(): number
|
||||
{
|
||||
return this._amount;
|
||||
}
|
||||
|
||||
public get messages(): MessageData[]
|
||||
{
|
||||
return this._messages;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class UnreadForumsCountMessageParser implements IMessageParser
|
||||
{
|
||||
private _count: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._count = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._count = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get count(): number
|
||||
{
|
||||
return this._count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { MessageData } from './MessageData';
|
||||
|
||||
export class UpdateMessageMessageParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _threadId: number;
|
||||
private _message: MessageData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._threadId = -1;
|
||||
this._message = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._threadId = wrapper.readInt();
|
||||
this._message = MessageData.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get threadId(): number
|
||||
{
|
||||
return this._threadId;
|
||||
}
|
||||
|
||||
public get message(): MessageData
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { GuildForumThread } from './GuildForumThread';
|
||||
|
||||
export class UpdateThreadMessageParser implements IMessageParser
|
||||
{
|
||||
private _groupId: number;
|
||||
private _thread: GuildForumThread;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._groupId = -1;
|
||||
this._thread = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._groupId = wrapper.readInt();
|
||||
this._thread = GuildForumThread.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get groupId(): number
|
||||
{
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
public get thread(): GuildForumThread
|
||||
{
|
||||
return this._thread;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export * from './ExtendedForumData';
|
||||
export * from './ForumData';
|
||||
export * from './ForumDataMessageParser';
|
||||
export * from './GetForumsListMessageParser';
|
||||
export * from './GuildForumThread';
|
||||
export * from './GuildForumThreadsParser';
|
||||
export * from './MessageData';
|
||||
export * from './PostMessageMessageParser';
|
||||
export * from './PostThreadMessageParser';
|
||||
export * from './ThreadMessagesMessageParser';
|
||||
export * from './UnreadForumsCountMessageParser';
|
||||
export * from './UpdateMessageMessageParser';
|
||||
export * from './UpdateThreadMessageParser';
|
||||
Reference in New Issue
Block a user