Added .waifutransfer command
This commit is contained in:
parent
6aeec724c0
commit
ed12722715
@ -22,13 +22,15 @@ namespace NadekoBot.Modules.Gambling.Services
|
|||||||
|
|
||||||
public async Task<bool> WaifuTransfer(IUser owner, ulong waifuId, IUser newOwner)
|
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)
|
using (var uow = _db.UnitOfWork)
|
||||||
{
|
{
|
||||||
var waifu = uow.Waifus.ByWaifuUserId(waifuId);
|
var waifu = uow.Waifus.ByWaifuUserId(waifuId);
|
||||||
var ownerUser = uow.DiscordUsers.GetOrCreate(owner);
|
var ownerUser = uow.DiscordUsers.GetOrCreate(owner);
|
||||||
|
|
||||||
// owner has to be the owner of the waifu
|
// owner has to be the owner of the waifu
|
||||||
if (waifu.ClaimerId != ownerUser.Id)
|
if (waifu == null || waifu.ClaimerId != ownerUser.Id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!await _cs.RemoveAsync(owner.Id,
|
if (!await _cs.RemoveAsync(owner.Id,
|
||||||
|
@ -199,7 +199,10 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
return;
|
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
|
public enum DivorceResult
|
||||||
|
@ -311,6 +311,8 @@
|
|||||||
"gambling_waifu_not_yours": "That waifu is not yours.",
|
"gambling_waifu_not_yours": "That waifu is not yours.",
|
||||||
"gambling_waifu_not_yourself": "You can't claim yourself.",
|
"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_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_nobody": "Nobody",
|
||||||
"gambling_waifu_divorced_notlike": "You have divorced a waifu who doesn't like you. You received {0} back.",
|
"gambling_waifu_divorced_notlike": "You have divorced a waifu who doesn't like you. You received {0} back.",
|
||||||
"games_8ball": "8ball",
|
"games_8ball": "8ball",
|
||||||
|
Loading…
Reference in New Issue
Block a user