public async Task SetOwner(string genusName, string speciesName, IUser user) { Species species = await BotUtils.ReplyFindSpeciesAsync(Context, genusName, speciesName); if (species != null) { await SpeciesUtils.SetOwnerAsync(species, user.Username, user.Id); // Add the new owner to the trophy scanner queue in case their species earned them any new trophies. if (OurFoodChainBot.Instance.Config.TrophiesEnabled) { await Global.TrophyScanner.AddToQueueAsync(Context, user.Id); } await BotUtils.ReplyAsync_Success(Context, string.Format("**{0}** is now owned by **{1}**.", species.ShortName, user.Username)); } }
public async Task SetOwner(string genusName, string speciesName, string ownerName) { Species species = await BotUtils.ReplyFindSpeciesAsync(Context, genusName, speciesName); if (species != null) { // If we've seen this user before, get their user ID from the database. UserInfo userInfo = await UserUtils.GetUserInfoAsync(ownerName); if (userInfo != null) { ownerName = userInfo.Username; await SpeciesUtils.SetOwnerAsync(species, userInfo.Username, userInfo.Id); } else { await SpeciesUtils.SetOwnerAsync(species, ownerName); } await BotUtils.ReplyAsync_Success(Context, string.Format("**{0}** is now owned by **{1}**.", species.ShortName, ownerName)); } }