You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	iterate PR based on feedback. Remove newballsplease cmd alias
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
		@@ -71,6 +71,16 @@ export const CommandCategories = {
 | 
			
		||||
 | 
			
		||||
type RunFn = ((roomId: string, args: string, cmd: string) => {error: any} | {promise: Promise<any>});
 | 
			
		||||
 | 
			
		||||
interface ICommandOpts {
 | 
			
		||||
    command: string;
 | 
			
		||||
    aliases?: string[];
 | 
			
		||||
    args?: string;
 | 
			
		||||
    description: string;
 | 
			
		||||
    runFn?: RunFn;
 | 
			
		||||
    category: string;
 | 
			
		||||
    hideCompletionAfterSpace?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Command {
 | 
			
		||||
    command: string;
 | 
			
		||||
    aliases: string[];
 | 
			
		||||
@@ -80,30 +90,14 @@ class Command {
 | 
			
		||||
    category: string;
 | 
			
		||||
    hideCompletionAfterSpace: boolean;
 | 
			
		||||
 | 
			
		||||
    constructor({
 | 
			
		||||
        command,
 | 
			
		||||
        aliases = [],
 | 
			
		||||
        args = '',
 | 
			
		||||
        description,
 | 
			
		||||
        runFn = undefined,
 | 
			
		||||
        category = CommandCategories.other,
 | 
			
		||||
        hideCompletionAfterSpace = false,
 | 
			
		||||
    }: {
 | 
			
		||||
        command: string;
 | 
			
		||||
        aliases?: string[];
 | 
			
		||||
        args?: string;
 | 
			
		||||
        description: string;
 | 
			
		||||
        runFn?: RunFn;
 | 
			
		||||
        category: string;
 | 
			
		||||
        hideCompletionAfterSpace?: boolean;
 | 
			
		||||
    }) {
 | 
			
		||||
        this.command = command;
 | 
			
		||||
        this.aliases = aliases;
 | 
			
		||||
        this.args = args;
 | 
			
		||||
        this.description = description;
 | 
			
		||||
        this.runFn = runFn;
 | 
			
		||||
        this.category = category;
 | 
			
		||||
        this.hideCompletionAfterSpace = hideCompletionAfterSpace;
 | 
			
		||||
    constructor(opts: ICommandOpts) {
 | 
			
		||||
        this.command = opts.command;
 | 
			
		||||
        this.aliases = opts.aliases || [];
 | 
			
		||||
        this.args = opts.args || "";
 | 
			
		||||
        this.description = opts.description;
 | 
			
		||||
        this.runFn = opts.runFn;
 | 
			
		||||
        this.category = opts.category || CommandCategories.other;
 | 
			
		||||
        this.hideCompletionAfterSpace = opts.hideCompletionAfterSpace || false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getCommand() {
 | 
			
		||||
@@ -853,7 +847,6 @@ export const Commands = [
 | 
			
		||||
    }),
 | 
			
		||||
    new Command({
 | 
			
		||||
        command: 'discardsession',
 | 
			
		||||
        aliases: ['newballsplease'],
 | 
			
		||||
        description: _td('Forces the current outbound group session in an encrypted room to be discarded'),
 | 
			
		||||
        runFn: function(roomId) {
 | 
			
		||||
            try {
 | 
			
		||||
@@ -900,7 +893,7 @@ export const Commands = [
 | 
			
		||||
        command: "whois",
 | 
			
		||||
        description: _td("Displays information about a user"),
 | 
			
		||||
        args: "<user-id>",
 | 
			
		||||
        runFn: function (roomId, userId) {
 | 
			
		||||
        runFn: function(roomId, userId) {
 | 
			
		||||
            if (!userId || !userId.startsWith("@") || !userId.includes(":")) {
 | 
			
		||||
                return reject(this.getUsage());
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user