Added .waifutransfer command

This commit is contained in:
Master Kwoth 2017-11-03 07:27:09 +01:00
parent 6aeec724c0
commit ed12722715
3 changed files with 9 additions and 2 deletions

View File

@ -22,13 +22,15 @@ namespace NadekoBot.Modules.Gambling.Services
public async Task<bool> WaifuTransfer(IUser owner, ulong waifuId, IUser newOwner)
{
if (owner.Id == newOwner.Id || waifuId == newOwner.Id)
return false;
using (var uow = _db.UnitOfWork)
{
var waifu = uow.Waifus.ByWaifuUserId(waifuId);
var ownerUser = uow.DiscordUsers.GetOrCreate(owner);
// owner has to be the owner of the waifu
if (waifu.ClaimerId != ownerUser.Id)
if (waifu == null || waifu.ClaimerId != ownerUser.Id)
return false;
if (!await _cs.RemoveAsync(owner.Id,

View File

@ -199,7 +199,10 @@ namespace NadekoBot.Modules.Gambling
return;
}
await ReplyConfirmLocalized("waifu_transfer_success").ConfigureAwait(false);
await ReplyConfirmLocalized("waifu_transfer_success",
Format.Bold(waifu.ToString()),
Format.Bold(Context.User.ToString()),
Format.Bold(newOwner.ToString())).ConfigureAwait(false);
}
public enum DivorceResult

View File

@ -311,6 +311,8 @@
"gambling_waifu_not_yours": "That waifu is not yours.",
"gambling_waifu_not_yourself": "You can't claim yourself.",
"gambling_waifu_recent_divorce": "You divorced recently. You must wait {0} hours and {1} minutes to divorce again.",
"gambling_waifu_transfer_fail": "You're either not the owner of that waifu, or you can't afford it. Alternatively your input is invalid.",
"gambling_waifu_transfer_success": "Claim on {0} has been transfered from {1} to {2}",
"gambling_nobody": "Nobody",
"gambling_waifu_divorced_notlike": "You have divorced a waifu who doesn't like you. You received {0} back.",
"games_8ball": "8ball",