<commit_before>module Commands
  # Command Module
  module Guild
    extend Discordrb::Commands::CommandContainer
    command(
      :guild,
      description: 'Adds guild for user to the database.',
      usage: 'userguild <set/remove/list> <guildname>',
      max_args: 2,
      min_args: 1
    ) do |event, *guild_name|
      guild_name = guild_name.join(' ').titleize
      found = ''
      added = false
      joinable = true
      if $guilds.key?(event.server.id.to_s)
        i = 0
        until i == $guilds[event.server.id.to_s].length || found == guild_name
          found = $guilds[event.server.id.to_s][i]['name'].titleize
          i += 1
        end
      else
        joinable = false
      end
      if found == guild_name
        $guilds[event.server.id.to_s].each do |_index, value|
          server_role = event.user.roles.find do |role|
            puts value['name']
          end
          event.user.remove_role(server_role) unless server_role.nil?
        end
        $guilds[event.server.id.to_s].each do |_index, value|
          next unless guild_name == value['name']
          server_role = event.server.roles.find do |role|
            role.name == value['name']
          end
          event.user.add_role(server_role)
        end
        added = true
      end
      if joinable
        if added<commit_msg>do that instead<commit_after>module Commands
  # Command Module
  module Guild
    extend Discordrb::Commands::CommandContainer
    command(
      :guild,
      description: 'Adds guild for user to the database.',
      usage: 'userguild <set/remove/list> <guildname>',
      max_args: 2,
      min_args: 1
    ) do |event, *guild_name|
      guild_name = guild_name.join(' ').titleize
      found = ''
      added = false
      joinable = true
      if $guilds.key?(event.server.id.to_s)
        i = 0
        until i == $guilds[event.server.id.to_s].length || found == guild_name
          found = $guilds[event.server.id.to_s][i]['name'].titleize
          i += 1
        end
      else
        joinable = false
      end
      if found == guild_name
        $guilds[event.server.id.to_s].each do |x|
          server_role = event.user.roles.find do |role|
            role.name == $guilds[event.server.id.to_s][x]['name']
          end
          event.user.remove_role(server_role) unless server_role.nil?
        end
        $guilds[event.server.id.to_s].each do |x|
          next unless guild_name == value['name']
          server_role = event.server.roles.find do |role|
            role.name == $guilds[event.server.id.to_s][x]['name']
          end
          event.user.add_role(server_role)
        end
        added = true
      end
      if joinable
        if added
{'fraction_non_alphanumeric': 0.11433823529411764, 'fraction_numerical': 0.0029411764705882353, 'mean_word_length': 1.9737704918032788, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287799', 'n_tokens_mistral': 890, 'n_tokens_neox': 876, 'n_words': 193}