mirror of
https://github.com/sciwhiz12/Janitor.git
synced 2024-09-20 01:44:02 +00:00
Add snowflake ids to user argument
This commit is contained in:
parent
7f91f78a90
commit
fb10a70891
|
@ -38,6 +38,17 @@ public class UserArgument implements ArgumentType<UserArgument.IUserProvider> {
|
||||||
return new NumericalProvider(Long.parseLong(matcher.group(1)));
|
return new NumericalProvider(Long.parseLong(matcher.group(1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reader.setCursor(startCursor);
|
||||||
|
CommandSyntaxException idReadException = null;
|
||||||
|
if (StringReader.isAllowedNumber(reader.peek())) {
|
||||||
|
try {
|
||||||
|
long value = reader.readLong();
|
||||||
|
return new NumericalProvider(value);
|
||||||
|
} catch (CommandSyntaxException e) {
|
||||||
|
idReadException = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idReadException != null) throw idReadException;
|
||||||
throw UNKNOWN_USER_IDENTIFIER.create();
|
throw UNKNOWN_USER_IDENTIFIER.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +57,10 @@ public class UserArgument implements ArgumentType<UserArgument.IUserProvider> {
|
||||||
return ImmutableList.of("<@!607058472709652501>", "<@750291676764962816>");
|
return ImmutableList.of("<@!607058472709652501>", "<@750291676764962816>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNumericalCharacter(char c) {
|
||||||
|
return c >= '0' && c <= '9';
|
||||||
|
}
|
||||||
|
|
||||||
public interface IUserProvider {
|
public interface IUserProvider {
|
||||||
CompletableFuture<User> getUsers(DiscordApi api);
|
CompletableFuture<User> getUsers(DiscordApi api);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user