public async Task HandleJoin(SocketGuildUser user) { ulong ID = user.Guild.Id; IChannel chan = user.Guild.GetChannel(Constants.Channels.EARTH_GEN); if (ID == Constants.Guilds.DBZ_EARTH) { chan = user.Guild.GetChannel(Constants.Channels.EARTH_GEN); } else if (ID == Constants.Guilds.DBZ_NAMEK) { chan = user.Guild.GetChannel(Constants.Channels.NAMEK_GEN); } else if (ID == Constants.Guilds.DBZ_VEGETA) { chan = user.Guild.GetChannel(Constants.Channels.VEGETA_GEN); } var mChan = chan as IMessageChannel; string reg = ""; if (DBFuncs.PlayerRegistered(user)) { DBFuncs.LoadRoles(user); } else { reg = " Use `db!register [race]` to register as either a Human, Namekian, or Saiyan."; } await mChan.SendMessageAsync($"{user.Mention} has entered {user.Guild.Name.Replace("DBZ ", "")}.{reg}"); }
public async Task Register(string race) { race = race.ToLower(); if (DBFuncs.PlayerRegistered(Context.User)) { await Context.Channel.SendMessageAsync($"{Context.User.Mention} has already registered."); } else if (race == "human" || race == "saiyan" || race == "namekian") { Player.Race wRace = Player.Race.Human; string planet = ""; if (race == "human") { wRace = Player.Race.Human; planet = "Earth: https://discord.gg/UwDKgAF"; } else if (race == "saiyan") { wRace = Player.Race.Saiyan; planet = "Vegeta: https://discord.gg/vFaS8u2"; } else if (race == "namekian") { wRace = Player.Race.Namekian; planet = "Namek: https://discord.gg/tJVfgms"; } string[] toWrite = new string[9]; toWrite[0] = Context.User.Username; toWrite[1] = $"RACE: {wRace}"; toWrite[2] = "POWER_LVL: 10"; toWrite[3] = "MULTIPLIER: 1"; toWrite[4] = "ENERGY: 100"; toWrite[5] = "LEVEL: 1"; toWrite[6] = "EXP: 0"; toWrite[7] = "LOCATION: null"; toWrite[8] = "SKILLS:"; File.WriteAllLines($@"Players\{Context.User.Id}.txt", toWrite); DBFuncs.LoadRoles(Context.User); await Context.Channel.SendMessageAsync($"{Context.User.Mention} has successfully registered as a {wRace}. Go forth to Planet {planet}."); } else { await Context.Channel.SendMessageAsync("Please choose either Human, Saiyan, or Namekian as your race. `db!register [race]`"); } }