Merge pull request #307 from CodingWithAnxiety/master
fix roll inf bug + reformatting
This commit is contained in:
		
						commit
						e5243efef4
					
				@ -107,253 +107,349 @@ export interface Command {
 | 
				
			|||||||
    exec(context: Conversation, ...params: (string | number | undefined)[]): void
 | 
					    exec(context: Conversation, ...params: (string | number | undefined)[]): void
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const commands: {readonly [key: string]: Command | undefined} = {
 | 
					const commands: { readonly [key: string]: Command | undefined } = {
 | 
				
			||||||
    me: {
 | 
					    me: {
 | 
				
			||||||
        exec: () => 'stub',
 | 
					        exec: () => "stub",
 | 
				
			||||||
        context: CommandContext.Channel | CommandContext.Private,
 | 
					        context: CommandContext.Channel | CommandContext.Private,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    reward: {
 | 
					    reward: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('RWD', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("RWD", { character }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    greports: {
 | 
					    greports: {
 | 
				
			||||||
        permission: Permission.ChannelMod,
 | 
					        permission: Permission.ChannelMod,
 | 
				
			||||||
        exec: () => core.connection.send('PCR')
 | 
					        exec: () => core.connection.send("PCR"),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    join: {
 | 
					    join: {
 | 
				
			||||||
        exec: (_, channel: string) => core.connection.send('JCH', {channel}),
 | 
					        exec: (_, channel: string) => core.connection.send("JCH", { channel }),
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    close: {
 | 
					    close: {
 | 
				
			||||||
        exec: (conv: PrivateConversation | ChannelConversation) => conv.close(),
 | 
					        exec: (conv: PrivateConversation | ChannelConversation) => conv.close(),
 | 
				
			||||||
        context: CommandContext.Private | CommandContext.Channel
 | 
					        context: CommandContext.Private | CommandContext.Channel,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    priv: {
 | 
					    priv: {
 | 
				
			||||||
        exec: (_, character: string) => core.conversations.getPrivate(core.characters.get(character)).show(),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					            core.conversations
 | 
				
			||||||
 | 
					                .getPrivate(core.characters.get(character))
 | 
				
			||||||
 | 
					                .show(),
 | 
				
			||||||
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    uptime: {
 | 
					    uptime: {
 | 
				
			||||||
        exec: () => core.connection.send('UPT')
 | 
					        exec: () => core.connection.send("UPT"),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    clear: {
 | 
					    clear: {
 | 
				
			||||||
        exec: (conv: Conversation) => conv.clear()
 | 
					        exec: (conv: Conversation) => conv.clear(),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    status: {
 | 
					    status: {
 | 
				
			||||||
        exec: (_, status: Character.Status, statusmsg: string = '') => core.connection.send('STA', {status, statusmsg}),
 | 
					        exec: (_, status: Character.Status, statusmsg: string = "") =>
 | 
				
			||||||
        params: [{type: ParamType.Enum, options: userStatuses}, {type: ParamType.String, optional: true}]
 | 
					            core.connection.send("STA", { status, statusmsg }),
 | 
				
			||||||
 | 
					        params: [
 | 
				
			||||||
 | 
					            { type: ParamType.Enum, options: userStatuses },
 | 
				
			||||||
 | 
					            { type: ParamType.String, optional: true },
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    roll: {
 | 
					    roll: {
 | 
				
			||||||
        exec: (conv: ChannelConversation | PrivateConversation, dice: string) => {
 | 
					        exec: (
 | 
				
			||||||
            if(Conversation.isChannel(conv)) core.connection.send('RLL', {channel: conv.channel.id, dice});
 | 
					            conv: ChannelConversation | PrivateConversation,
 | 
				
			||||||
            else core.connection.send('RLL', {recipient: conv.character.name, dice});
 | 
					            dice: string
 | 
				
			||||||
 | 
					        ) => { 
 | 
				
			||||||
 | 
					            if (dice.toLocaleLowerCase() === "inf") {
 | 
				
			||||||
 | 
					                conv.infoText = "Inf took many lives during its reign. Thankfully, you have been spared.";
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else if (Conversation.isChannel(conv))
 | 
				
			||||||
 | 
					                core.connection.send("RLL", { channel: conv.channel.id, dice });
 | 
				
			||||||
 | 
					            else 
 | 
				
			||||||
 | 
					                core.connection.send("RLL", {
 | 
				
			||||||
 | 
					                    recipient: conv.character.name,
 | 
				
			||||||
 | 
					                    dice,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        context: CommandContext.Channel | CommandContext.Private,
 | 
					        context: CommandContext.Channel | CommandContext.Private,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    bottle: {
 | 
					    bottle: {
 | 
				
			||||||
        exec: (conv: ChannelConversation | PrivateConversation) => {
 | 
					        exec: (conv: ChannelConversation | PrivateConversation) => {
 | 
				
			||||||
            if(Conversation.isChannel(conv)) core.connection.send('RLL', {channel: conv.channel.id, dice: 'bottle'});
 | 
					            if (Conversation.isChannel(conv))
 | 
				
			||||||
            else core.connection.send('RLL', {recipient: conv.character.name, dice: 'bottle'});
 | 
					                core.connection.send("RLL", {
 | 
				
			||||||
 | 
					                    channel: conv.channel.id,
 | 
				
			||||||
 | 
					                    dice: "bottle",
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                core.connection.send("RLL", {
 | 
				
			||||||
 | 
					                    recipient: conv.character.name,
 | 
				
			||||||
 | 
					                    dice: "bottle",
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        context: CommandContext.Channel | CommandContext.Private
 | 
					        context: CommandContext.Channel | CommandContext.Private,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    warn: {
 | 
					    warn: {
 | 
				
			||||||
        exec: () => 'stub',
 | 
					        exec: () => "stub",
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    kick: {
 | 
					    kick: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('CKU', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("CKU", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ban: {
 | 
					    ban: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('CBU', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("CBU", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    unban: {
 | 
					    unban: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('CUB', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("CUB", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    banlist: {
 | 
					    banlist: {
 | 
				
			||||||
        exec: (conv: ChannelConversation) => core.connection.send('CBL', {channel: conv.channel.id}),
 | 
					        exec: (conv: ChannelConversation) =>
 | 
				
			||||||
 | 
					            core.connection.send("CBL", { channel: conv.channel.id }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    timeout: {
 | 
					    timeout: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string, length: number) =>
 | 
					        exec: (conv: ChannelConversation, character: string, length: number) =>
 | 
				
			||||||
            core.connection.send('CTU', {channel: conv.channel.id, character, length}),
 | 
					            core.connection.send("CTU", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					                length,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character, delimiter: ','}, {type: ParamType.Number, validator: (x) => x >= 1}]
 | 
					        params: [
 | 
				
			||||||
 | 
					            { type: ParamType.Character, delimiter: "," },
 | 
				
			||||||
 | 
					            { type: ParamType.Number, validator: (x) => x >= 1 },
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gkick: {
 | 
					    gkick: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('KIK', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("KIK", { character }),
 | 
				
			||||||
        permission: Permission.ChatOp,
 | 
					        permission: Permission.ChatOp,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gban: {
 | 
					    gban: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('ACB', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("ACB", { character }),
 | 
				
			||||||
        permission: Permission.ChatOp,
 | 
					        permission: Permission.ChatOp,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gunban: {
 | 
					    gunban: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('UNB', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("UNB", { character }),
 | 
				
			||||||
        permission: Permission.ChatOp,
 | 
					        permission: Permission.ChatOp,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gtimeout: {
 | 
					    gtimeout: {
 | 
				
			||||||
        exec: (_, character: string, time: number, reason: string) =>
 | 
					        exec: (_, character: string, time: number, reason: string) =>
 | 
				
			||||||
            core.connection.send('TMO', {character, time, reason}),
 | 
					            core.connection.send("TMO", { character, time, reason }),
 | 
				
			||||||
        permission: Permission.ChatOp,
 | 
					        permission: Permission.ChatOp,
 | 
				
			||||||
        params: [{type: ParamType.Character, delimiter: ','}, {type: ParamType.Number, validator: (x) => x >= 1}, {type: ParamType.String}]
 | 
					        params: [
 | 
				
			||||||
 | 
					            { type: ParamType.Character, delimiter: "," },
 | 
				
			||||||
 | 
					            { type: ParamType.Number, validator: (x) => x >= 1 },
 | 
				
			||||||
 | 
					            { type: ParamType.String },
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    setowner: {
 | 
					    setowner: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('CSO', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("CSO", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ignore: {
 | 
					    ignore: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('IGN', {action: 'add', character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					            core.connection.send("IGN", { action: "add", character }),
 | 
				
			||||||
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    unignore: {
 | 
					    unignore: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('IGN', {action: 'delete', character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					            core.connection.send("IGN", { action: "delete", character }),
 | 
				
			||||||
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ignorelist: {
 | 
					    ignorelist: {
 | 
				
			||||||
        exec: (conv: Conversation) => conv.infoText = l('chat.ignoreList', core.characters.ignoreList.join(', '))
 | 
					        exec: (conv: Conversation) =>
 | 
				
			||||||
 | 
					            (conv.infoText = l(
 | 
				
			||||||
 | 
					                "chat.ignoreList",
 | 
				
			||||||
 | 
					                core.characters.ignoreList.join(", ")
 | 
				
			||||||
 | 
					            )),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    makeroom: {
 | 
					    makeroom: {
 | 
				
			||||||
        exec: (_, channel: string) => core.connection.send('CCR', {channel}),
 | 
					        exec: (_, channel: string) => core.connection.send("CCR", { channel }),
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gop: {
 | 
					    gop: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('AOP', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("AOP", { character }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    gdeop: {
 | 
					    gdeop: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('DOP', {character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("DOP", { character }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    op: {
 | 
					    op: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('COA', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("COA", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    deop: {
 | 
					    deop: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('COR', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("COR", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    scop: {
 | 
					    scop: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('SCP', {action: 'add', character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("SCP", { action: "add", character }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    scdeop: {
 | 
					    scdeop: {
 | 
				
			||||||
        exec: (_, character: string) => core.connection.send('SCP', {action: 'remove', character}),
 | 
					        exec: (_, character: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("SCP", { action: "remove", character }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    oplist: {
 | 
					    oplist: {
 | 
				
			||||||
        exec: (conv: ChannelConversation) => core.connection.send('COL', {channel: conv.channel.id}),
 | 
					        exec: (conv: ChannelConversation) =>
 | 
				
			||||||
        context: CommandContext.Channel
 | 
					            core.connection.send("COL", { channel: conv.channel.id }),
 | 
				
			||||||
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    invite: {
 | 
					    invite: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, character: string) =>
 | 
					        exec: (conv: ChannelConversation, character: string) =>
 | 
				
			||||||
            core.connection.send('CIU', {channel: conv.channel.id, character}),
 | 
					            core.connection.send("CIU", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                character,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Character}]
 | 
					        params: [{ type: ParamType.Character }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    closeroom: {
 | 
					    closeroom: {
 | 
				
			||||||
        exec: (conv: ChannelConversation) => core.connection.send('RST', {channel: conv.channel.id, status: 'private'}),
 | 
					        exec: (conv: ChannelConversation) =>
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					            core.connection.send("RST", {
 | 
				
			||||||
        context: CommandContext.Channel
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
    },
 | 
					                status: "private",
 | 
				
			||||||
    openroom: {
 | 
					            }),
 | 
				
			||||||
        exec: (conv: ChannelConversation) => core.connection.send('RST', {channel: conv.channel.id, status: 'public'}),
 | 
					 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					 | 
				
			||||||
        context: CommandContext.Channel
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    setmode: {
 | 
					 | 
				
			||||||
        exec: (conv: ChannelConversation, mode: 'ads' | 'chat' | 'both') =>
 | 
					 | 
				
			||||||
            core.connection.send('RMO', {channel: conv.channel.id, mode}),
 | 
					 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.Enum, options: ['ads', 'chat', 'both']}]
 | 
					    },
 | 
				
			||||||
 | 
					    openroom: {
 | 
				
			||||||
 | 
					        exec: (conv: ChannelConversation) =>
 | 
				
			||||||
 | 
					            core.connection.send("RST", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                status: "public",
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    setmode: {
 | 
				
			||||||
 | 
					        exec: (conv: ChannelConversation, mode: "ads" | "chat" | "both") =>
 | 
				
			||||||
 | 
					            core.connection.send("RMO", { channel: conv.channel.id, mode }),
 | 
				
			||||||
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
 | 
					        params: [{ type: ParamType.Enum, options: ["ads", "chat", "both"] }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    setdescription: {
 | 
					    setdescription: {
 | 
				
			||||||
        exec: (conv: ChannelConversation, description: string) =>
 | 
					        exec: (conv: ChannelConversation, description: string) =>
 | 
				
			||||||
            core.connection.send('CDS', {channel: conv.channel.id, description}),
 | 
					            core.connection.send("CDS", {
 | 
				
			||||||
 | 
					                channel: conv.channel.id,
 | 
				
			||||||
 | 
					                description,
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        permission: Permission.RoomOp,
 | 
					        permission: Permission.RoomOp,
 | 
				
			||||||
        context: CommandContext.Channel,
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    code: {
 | 
					    code: {
 | 
				
			||||||
        exec: (conv: ChannelConversation) => {
 | 
					        exec: (conv: ChannelConversation) => {
 | 
				
			||||||
            const active = <HTMLElement>document.activeElement;
 | 
					            const active = <HTMLElement>document.activeElement;
 | 
				
			||||||
            const elm = document.createElement('textarea');
 | 
					            const elm = document.createElement("textarea");
 | 
				
			||||||
            elm.value = `[session=${conv.channel.name}]${conv.channel.id}[/session]`;
 | 
					            elm.value = `[session=${conv.channel.name}]${conv.channel.id}[/session]`;
 | 
				
			||||||
            document.body.appendChild(elm);
 | 
					            document.body.appendChild(elm);
 | 
				
			||||||
            elm.select();
 | 
					            elm.select();
 | 
				
			||||||
            document.execCommand('copy');
 | 
					            document.execCommand("copy");
 | 
				
			||||||
            document.body.removeChild(elm);
 | 
					            document.body.removeChild(elm);
 | 
				
			||||||
            active.focus();
 | 
					            active.focus();
 | 
				
			||||||
            conv.infoText = l('commands.code.success');
 | 
					            conv.infoText = l("commands.code.success");
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    killchannel: {
 | 
					    killchannel: {
 | 
				
			||||||
        exec: (conv: ChannelConversation) => core.connection.send('KIC', {channel: conv.channel.id}),
 | 
					        exec: (conv: ChannelConversation) =>
 | 
				
			||||||
 | 
					            core.connection.send("KIC", { channel: conv.channel.id }),
 | 
				
			||||||
        permission: Permission.RoomOwner,
 | 
					        permission: Permission.RoomOwner,
 | 
				
			||||||
        context: CommandContext.Channel
 | 
					        context: CommandContext.Channel,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    createchannel: {
 | 
					    createchannel: {
 | 
				
			||||||
        exec: (_, channel: string) => core.connection.send('CRC', {channel}),
 | 
					        exec: (_, channel: string) => core.connection.send("CRC", { channel }),
 | 
				
			||||||
        permission: Permission.ChatOp,
 | 
					        permission: Permission.ChatOp,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    broadcast: {
 | 
					    broadcast: {
 | 
				
			||||||
        exec: (_, message: string) => core.connection.send('BRO', {message}),
 | 
					        exec: (_, message: string) => core.connection.send("BRO", { message }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.String}]
 | 
					        params: [{ type: ParamType.String }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    reloadconfig: {
 | 
					    reloadconfig: {
 | 
				
			||||||
        exec: (_, save?: 'save') => core.connection.send('RLD', save !== undefined ? {save} : undefined),
 | 
					        exec: (_, save?: "save") =>
 | 
				
			||||||
 | 
					            core.connection.send(
 | 
				
			||||||
 | 
					                "RLD",
 | 
				
			||||||
 | 
					                save !== undefined ? { save } : undefined
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.Enum, options: ['save'], optional: true}]
 | 
					        params: [{ type: ParamType.Enum, options: ["save"], optional: true }],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    xyzzy: {
 | 
					    xyzzy: {
 | 
				
			||||||
        exec: (_, command: string, arg: string) => core.connection.send('ZZZ', {command, arg}),
 | 
					        exec: (_, command: string, arg: string) =>
 | 
				
			||||||
 | 
					            core.connection.send("ZZZ", { command, arg }),
 | 
				
			||||||
        permission: Permission.Admin,
 | 
					        permission: Permission.Admin,
 | 
				
			||||||
        params: [{type: ParamType.String, delimiter: ' '}, {type: ParamType.String}]
 | 
					        params: [
 | 
				
			||||||
 | 
					            { type: ParamType.String, delimiter: " " },
 | 
				
			||||||
 | 
					            { type: ParamType.String },
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    elf: {
 | 
					    elf: {
 | 
				
			||||||
        exec: (conv: Conversation) => conv.infoText = elf[Math.floor(Math.random() * elf.length)],
 | 
					        exec: (conv: Conversation) =>
 | 
				
			||||||
        documented: false
 | 
					            (conv.infoText = elf[Math.floor(Math.random() * elf.length)]),
 | 
				
			||||||
    }
 | 
					        documented: false,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const elf = [ //Ceran is to be thanked for most of these.
 | 
					const elf = [ //Ceran is to be thanked for most of these.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user