use of com.gamebuster19901.excite.bot.user.Wii in project ExciteBot by TheGameCommunity.
the class DiscordUser method getRegisteredWiis.
@Nullable
public Wii[] getRegisteredWiis() {
try {
HashSet<Wii> wiis = new HashSet<Wii>();
Result result = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, WII_ID, WIIS, new Comparison(DISCORD_ID, EQUALS, getID()));
while (result.next()) {
wiis.add(Wii.getWii(result.getString(WII_ID)));
}
return (Wii[]) wiis.toArray(new Wii[] {});
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.user.Wii in project ExciteBot by TheGameCommunity.
the class RegisterCommand method registerWii.
@SuppressWarnings("rawtypes")
private static void registerWii(MessageContext context, String securityCode) {
if (context.isGuildMessage()) {
context.deletePromptingMessage(ConsoleContext.INSTANCE, context.getMention() + " - Woah! Send your code to me via direct message! Nobody else should be seeing your registration code!");
return;
}
if (context.isConsoleMessage()) {
context.sendMessage("This command can only be executed in discord");
return;
}
try {
Result result = Table.selectColumnsFromWhere(context, Column.WII_ID, Table.WIIS, new Comparison(Column.REGISTRATION_CODE, Comparator.EQUALS, securityCode));
if (result.hasNext()) {
result.next();
Wii wii = Wii.getWii(result.getString(Column.WII_ID));
wii.register(context);
} else {
context.sendMessage("Unknown registration code.");
}
} catch (SQLException | MessagingException e) {
context.sendMessage(StacktraceUtil.getStackTrace(e));
}
}
Aggregations