Пример #1
0
 private void setWelcome(MessageContext context, String args) {
   if (context.getServer() == null || context.getServer() == NO_SERVER) {
     return;
   }
   String serverId = context.getServer().getId();
   TempServerConfig config = serverStorage.get(serverId);
   if (config == null) {
     config = new TempServerConfig(serverId);
     serverStorage.put(serverId, config);
   }
   Channel channel = context.getChannel();
   if (args.isEmpty() || args.equalsIgnoreCase("none")) {
     config.setCustomWelcomeMessage("");
     apiClient.sendMessage(loc.localize("commands.mod.welcome.response.none"), channel);
   } else if (args.equalsIgnoreCase("default")) {
     config.setCustomWelcomeMessage(null);
     apiClient.sendMessage(loc.localize("commands.mod.welcome.response.default"), channel);
   } else {
     config.setCustomWelcomeMessage(args);
     apiClient.sendMessage(
         loc.localize(
             "commands.mod.welcome.response.set",
             EventListener.createJoinLeaveMessage(context.getAuthor(), context.getServer(), args)),
         channel);
   }
   saveServerConfig(config);
 }