Merge branch 'dev' into 1.4

This commit is contained in:
Master Kwoth
2017-05-02 11:02:09 +02:00
12 changed files with 1647 additions and 206 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace NadekoBot.Migrations
{
public partial class patreonid : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PatreonUserId",
table: "RewardedUsers",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PatreonUserId",
table: "RewardedUsers");
}
}
}

View File

@ -966,6 +966,8 @@ namespace NadekoBot.Migrations
b.Property<DateTime>("LastReward");
b.Property<string>("PatreonUserId");
b.Property<ulong>("UserId");
b.HasKey("Id");

View File

@ -212,12 +212,6 @@ namespace NadekoBot.Modules.NSFW
public Task Gelbooru([Remainder] string tag = null)
=> InternalDapiCommand(tag, Searches.Searches.DapiSearchType.Gelbooru);
[NadekoCommand, Usage, Description, Aliases]
public async Task Cp()
{
await Context.Channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
public async Task Boobs()
{

View File

@ -173,13 +173,14 @@ namespace NadekoBot.Modules.Utility
using (var uow = DbHandler.UnitOfWork())
{
var users = uow._context.Set<RewardedUser>();
var usr = users.FirstOrDefault(x => x.UserId == userId);
var usr = users.FirstOrDefault(x => x.PatreonUserId == data.User.id);
if (usr == null)
{
users.Add(new RewardedUser()
{
UserId = userId,
PatreonUserId = data.User.id,
LastReward = now,
AmountRewardedThisMonth = amount,
});
@ -194,6 +195,7 @@ namespace NadekoBot.Modules.Utility
{
usr.LastReward = now;
usr.AmountRewardedThisMonth = amount;
usr.PatreonUserId = data.User.id;
await CurrencyHandler.AddCurrencyAsync(userId, "Patreon reward - recurring", amount, uow).ConfigureAwait(false);
@ -207,6 +209,7 @@ namespace NadekoBot.Modules.Utility
usr.LastReward = now;
usr.AmountRewardedThisMonth = amount;
usr.PatreonUserId = data.User.id;
await CurrencyHandler.AddCurrencyAsync(usr.UserId, "Patreon reward - update", toAward, uow).ConfigureAwait(false);

View File

@ -5,6 +5,7 @@ namespace NadekoBot.Services.Database.Models
public class RewardedUser : DbEntity
{
public ulong UserId { get; set; }
public string PatreonUserId { get; set; }
public int AmountRewardedThisMonth { get; set; }
public DateTime LastReward { get; set; }
}