<commit_before>module FelyneBot
	module Commands
		module UserGuild
			extend Discordrb::Commands::CommandContainer
			command(
					:userguild,
					description: "Adds guild for user to the database.",
					usage: "userguild <set/remove/list> <guildname>",
					max_args: 2,
					min_args: 1
			) do |event, set, search|
				#Database function
				temp = $users.find_index {|s| s.id == event.user.id}
				#Roles function
				guilds = []
				(1..$guilds.length).each { |i|
					name_server = "#{$guilds[i-1].guild_name}        (#{$guilds[i-1].guild_server})"
					guilds.push(name_server)
				}
				member = event.user.on(event.server)
				guild = 0
				if set == 'remove'
					guilds.each { |x| 
						role = member.roles.find { |role| role.name == x }
						if role!=nil
							member.remove_role(role)
						end
					}
					$users[temp].addGuild(" ")
					saveObj($users,"userbase/users")
					event << "Removed from all guild server roles, and cleared guild from Database"
				end
				if set == 'list'
					event << "``Guild roles currently set up:``"
					guilds.each { |x| event << x }
				end
				if set == 'set'
					guilds.each { |x| 
						role = member.roles.find { |role| role.name == x }
						if role!=nil
							member.remove_role(role)
						end
					}
					guilds.each { |x|
						if search == x
							role = event.bot.server(122526505606709257).roles.find { |role| role.name == search }
							member.add_role(role)
							guild = 1
						end
					}
				if guild == 1
					if  temp!=nil then $users[temp].addGuild(search) end
					event << "Changed guild to: #{guild}"
					saveObj($users,"userbase/users")
					event << "Added to the #{search} guild server role"
				else
					event << "The requested guild server role does not exist.  If you would like to add your guild to the servers roles, please PM Reaver01"
				end
				end
				puts "#{event.timestamp}: #{event.user.name}: CMD: userguild <#{set}> <#{search}>"
				nil
			end
		end
	end
end<commit_msg>add server when adding guild<commit_after>module FelyneBot
	module Commands
		module UserGuild
			extend Discordrb::Commands::CommandContainer
			command(
					:userguild,
					description: "Adds guild for user to the database.",
					usage: "userguild <set/remove/list> <guildname>",
					max_args: 2,
					min_args: 1
			) do |event, set, search|
				#Database function
				temp = $users.find_index {|s| s.id == event.user.id}
				#Roles function
				guilds = []
				servers = []
				guilds2 = []
				(1..$guilds.length).each { |i|
					name_server = "#{$guilds[i-1].guild_name}        (#{$guilds[i-1].guild_server})"
					guilds.push($guilds[i-1].guild_name)
					guilds2.push(name_server)
					servers.push({"name"=>"#{$guilds[i-1].guild_name}","server"=>"#{$guilds[i-1].guild_server}"})
				}
				member = event.user.on(event.server)
				guild = 0
				if set == 'remove'
					guilds.each { |x| 
						role = member.roles.find { |role| role.name == x }
						if role!=nil
							member.remove_role(role)
						end
					}
					$users[temp].addGuild(" ")
					saveObj($users,"userbase/users")
					event << "Removed from all guild server roles, and cleared guild from Database"
				end
				if set == 'list'
					event << "``Guild roles currently set up:``"
					guilds2.each { |x| event << x }
				end
				if set == 'set'
					guilds.each { |x| 
						role = member.roles.find { |role| role.name == x }
						if role!=nil
							member.remove_role(role)
						end
					}
					guilds.each { |x|
						if search == x
							role = event.bot.server(122526505606709257).roles.find { |role| role.name == search }
							member.add_role(role)
							guild = 1
						end
					}
				if guild == 1
					if  temp!=nil 
						$users[temp].addGuild(search)
						servers.each { |x| 
							if servers[x]['name'] == search
								$users[temp].addServer(servers[x]['server'])
							end
						}
					end
					event << "Changed guild to: #{guild}"
					saveObj($users,"userbase/users")
					event << "Added to the #{search} guild server role"
				else
					event << "The requested guild server role does not exist.  If you would like to add your guild to the servers roles, please PM Reaver01"
				end
				end
				puts "#{event.timestamp}: #{event.user.name}: CMD: userguild <#{set}> <#{search}>"
				nil
			end
		end
	end
end
{'fraction_non_alphanumeric': 0.14142590866728796, 'fraction_numerical': 0.014445479962721343, 'mean_word_length': 2.459307010475423, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 13, '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': '2130316', 'n_tokens_mistral': 2048, 'n_tokens_neox': 1490, 'n_words': 377}