mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 02:38:27 -04:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
71f1e43272 | ||
|
8499e1da70 | ||
|
a2ea806bed | ||
|
732b5dfeed | ||
|
d4dcdc761a | ||
|
57996ba290 | ||
|
4b29b3a239 | ||
|
54ac955395 | ||
|
f4fa298866 | ||
|
b2fafc964f | ||
|
22b452e449 | ||
|
fda385a5e4 | ||
|
c28f7cfa07 | ||
|
0a029a7847 | ||
|
717543f6c2 |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -2,10 +2,23 @@
|
|||||||
|
|
||||||
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||||
|
|
||||||
## Unreleased
|
## [3.0.10] - 01.12.2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- `.warn` now supports weighted warnings
|
||||||
|
- `.warnlog` will now show current amount and total amount of warnings
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- `.xprewsreset` now has correct permissions
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Removed slot.numbers from `images.yml` as they're no longer used
|
||||||
|
|
||||||
## [3.0.9] - 21.11.2021
|
## [3.0.9] - 21.11.2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- `.ea` will now use an image attachments if you omit imageUrl
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added `.emojiadd` with 3 overloads
|
- Added `.emojiadd` with 3 overloads
|
||||||
- `.ea :customEmoji:` which copies another server's emoji
|
- `.ea :customEmoji:` which copies another server's emoji
|
||||||
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Common
|
|||||||
public class ImageUrls
|
public class ImageUrls
|
||||||
{
|
{
|
||||||
[Comment("DO NOT CHANGE")]
|
[Comment("DO NOT CHANGE")]
|
||||||
public int Version { get; set; } = 2;
|
public int Version { get; set; } = 3;
|
||||||
|
|
||||||
public CoinData Coins { get; set; }
|
public CoinData Coins { get; set; }
|
||||||
public Uri[] Currency { get; set; }
|
public Uri[] Currency { get; set; }
|
||||||
@@ -27,7 +27,6 @@ namespace NadekoBot.Common
|
|||||||
public class SlotData
|
public class SlotData
|
||||||
{
|
{
|
||||||
public Uri[] Emojis { get; set; }
|
public Uri[] Emojis { get; set; }
|
||||||
public Uri[] Numbers { get; set; }
|
|
||||||
public Uri Bg { get; set; }
|
public Uri Bg { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using NadekoBot.Db.Models;
|
using System;
|
||||||
|
using NadekoBot.Db.Models;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Discord;
|
using Discord;
|
||||||
@@ -168,7 +169,7 @@ VALUES ({userId}, {name}, {discrim}, {avatarId}, {amount}, 0);
|
|||||||
public static decimal GetTotalCurrency(this DbSet<DiscordUser> users)
|
public static decimal GetTotalCurrency(this DbSet<DiscordUser> users)
|
||||||
{
|
{
|
||||||
return users
|
return users
|
||||||
.Sum(x => x.CurrencyAmount);
|
.Sum((Func<DiscordUser, decimal>)(x => x.CurrencyAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static decimal GetTopOnePercentCurrency(this DbSet<DiscordUser> users, ulong botId)
|
public static decimal GetTopOnePercentCurrency(this DbSet<DiscordUser> users, ulong botId)
|
||||||
|
@@ -8,5 +8,6 @@
|
|||||||
public bool Forgiven { get; set; }
|
public bool Forgiven { get; set; }
|
||||||
public string ForgivenBy { get; set; }
|
public string ForgivenBy { get; set; }
|
||||||
public string Moderator { get; set; }
|
public string Moderator { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -196,10 +196,16 @@ namespace NadekoBot.Services.Database
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Warnings
|
#region Warnings
|
||||||
var warn = modelBuilder.Entity<Warning>();
|
|
||||||
|
modelBuilder.Entity<Warning>(warn =>
|
||||||
|
{
|
||||||
warn.HasIndex(x => x.GuildId);
|
warn.HasIndex(x => x.GuildId);
|
||||||
warn.HasIndex(x => x.UserId);
|
warn.HasIndex(x => x.UserId);
|
||||||
warn.HasIndex(x => x.DateAdded);
|
warn.HasIndex(x => x.DateAdded);
|
||||||
|
warn.Property(x => x.Weight)
|
||||||
|
.HasDefaultValue(1);
|
||||||
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PatreonRewards
|
#region PatreonRewards
|
||||||
|
2653
src/NadekoBot/Migrations/20211121002508_weighted-warnings.Designer.cs
generated
Normal file
2653
src/NadekoBot/Migrations/20211121002508_weighted-warnings.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
src/NadekoBot/Migrations/20211121002508_weighted-warnings.cs
Normal file
24
src/NadekoBot/Migrations/20211121002508_weighted-warnings.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace NadekoBot.Migrations
|
||||||
|
{
|
||||||
|
public partial class weightedwarnings : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Weight",
|
||||||
|
table: "Warnings",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Weight",
|
||||||
|
table: "Warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1967,6 +1967,11 @@ namespace NadekoBot.Migrations
|
|||||||
b.Property<ulong>("UserId")
|
b.Property<ulong>("UserId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Weight")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasDefaultValue(1);
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("DateAdded");
|
b.HasIndex("DateAdded");
|
||||||
|
@@ -41,8 +41,11 @@ namespace NadekoBot.Modules.Administration.Services
|
|||||||
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromHours(12));
|
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromHours(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<WarningPunishment> Warn(IGuild guild, ulong userId, IUser mod, string reason)
|
public async Task<WarningPunishment> Warn(IGuild guild, ulong userId, IUser mod, int weight, string reason)
|
||||||
{
|
{
|
||||||
|
if (weight <= 0)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(weight));
|
||||||
|
|
||||||
var modName = mod.ToString();
|
var modName = mod.ToString();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(reason))
|
if (string.IsNullOrWhiteSpace(reason))
|
||||||
@@ -57,6 +60,7 @@ namespace NadekoBot.Modules.Administration.Services
|
|||||||
Forgiven = false,
|
Forgiven = false,
|
||||||
Reason = reason,
|
Reason = reason,
|
||||||
Moderator = modName,
|
Moderator = modName,
|
||||||
|
Weight = weight,
|
||||||
};
|
};
|
||||||
|
|
||||||
int warnings = 1;
|
int warnings = 1;
|
||||||
@@ -70,7 +74,7 @@ namespace NadekoBot.Modules.Administration.Services
|
|||||||
.Warnings
|
.Warnings
|
||||||
.ForId(guildId, userId)
|
.ForId(guildId, userId)
|
||||||
.Where(w => !w.Forgiven && w.UserId == userId)
|
.Where(w => !w.Forgiven && w.UserId == userId)
|
||||||
.Count();
|
.Sum(x => x.Weight);
|
||||||
|
|
||||||
uow.Warnings.Add(warn);
|
uow.Warnings.Add(warn);
|
||||||
|
|
||||||
|
@@ -54,8 +54,17 @@ namespace NadekoBot.Modules.Administration
|
|||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[UserPerm(GuildPerm.BanMembers)]
|
[UserPerm(GuildPerm.BanMembers)]
|
||||||
public async Task Warn(IGuildUser user, [Leftover] string reason = null)
|
public Task Warn(IGuildUser user, [Leftover] string reason = null)
|
||||||
|
=> Warn(1, user, reason);
|
||||||
|
|
||||||
|
[NadekoCommand, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[UserPerm(GuildPerm.BanMembers)]
|
||||||
|
public async Task Warn(int weight, IGuildUser user, [Leftover] string reason = null)
|
||||||
{
|
{
|
||||||
|
if (weight <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!await CheckRoleHierarchy(user))
|
if (!await CheckRoleHierarchy(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -76,7 +85,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
WarningPunishment punishment;
|
WarningPunishment punishment;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
punishment = await _service.Warn(ctx.Guild, user.Id, ctx.User, reason).ConfigureAwait(false);
|
punishment = await _service.Warn(ctx.Guild, user.Id, ctx.User, weight, reason).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -230,19 +239,29 @@ namespace NadekoBot.Modules.Administration
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var descText = GetText(strs.warn_count(
|
||||||
|
Format.Bold(warnings.Where(x => !x.Forgiven).Sum(x => x.Weight).ToString()),
|
||||||
|
Format.Bold(warnings.Sum(x => x.Weight).ToString())));
|
||||||
|
|
||||||
|
embed.WithDescription(descText);
|
||||||
|
|
||||||
var i = page * 9;
|
var i = page * 9;
|
||||||
foreach (var w in warnings)
|
foreach (var w in warnings)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
var name = GetText(strs.warned_on_by(
|
var name = GetText(strs.warned_on_by(
|
||||||
w.DateAdded.Value.ToString("dd.MM.yyy"),
|
w.DateAdded?.ToString("dd.MM.yyy"),
|
||||||
w.DateAdded.Value.ToString("HH:mm"),
|
w.DateAdded?.ToString("HH:mm"),
|
||||||
w.Moderator));
|
w.Moderator));
|
||||||
|
|
||||||
if (w.Forgiven)
|
if (w.Forgiven)
|
||||||
name = $"{Format.Strikethrough(name)} {GetText(strs.warn_cleared_by(w.ForgivenBy))}";
|
name = $"{Format.Strikethrough(name)} {GetText(strs.warn_cleared_by(w.ForgivenBy))}";
|
||||||
|
|
||||||
embed.AddField($"#`{i}` " + name, w.Reason.TrimTo(1020));
|
|
||||||
|
embed.AddField($"#`{i}` " + name,
|
||||||
|
Format.Code(GetText(strs.warn_weight(w.Weight))) +
|
||||||
|
'\n' +
|
||||||
|
w.Reason.TrimTo(1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,11 +66,11 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
var embed = _eb.Create()
|
var embed = _eb.Create()
|
||||||
.WithTitle(GetText(strs.economy_state))
|
.WithTitle(GetText(strs.economy_state))
|
||||||
.AddField(GetText(strs.currency_owned), ((BigInteger)(ec.Cash - ec.Bot)) + CurrencySign)
|
.AddField(GetText(strs.currency_owned), ((BigInteger)(ec.Cash - ec.Bot)).ToString("N", _enUsCulture) + CurrencySign)
|
||||||
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
|
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
|
||||||
.AddField(GetText(strs.currency_planted), ((BigInteger)ec.Planted) + CurrencySign)
|
.AddField(GetText(strs.currency_planted), ((BigInteger)ec.Planted) + CurrencySign)
|
||||||
.AddField(GetText(strs.owned_waifus_total), ((BigInteger)ec.Waifus) + CurrencySign)
|
.AddField(GetText(strs.owned_waifus_total), ((BigInteger)ec.Waifus) + CurrencySign)
|
||||||
.AddField(GetText(strs.bot_currency), ec.Bot + CurrencySign)
|
.AddField(GetText(strs.bot_currency), ec.Bot.ToString("N", _enUsCulture) + CurrencySign)
|
||||||
.AddField(GetText(strs.total), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
|
.AddField(GetText(strs.total), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
|
||||||
.WithOkColor();
|
.WithOkColor();
|
||||||
// ec.Cash already contains ec.Bot as it's the total of all values in the CurrencyAmount column of the DiscordUser table
|
// ec.Cash already contains ec.Bot as it's the total of all values in the CurrencyAmount column of the DiscordUser table
|
||||||
@@ -247,20 +247,20 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public Task Award(ShmartNumber amount, IGuildUser usr, [Leftover] string msg) =>
|
public Task Award(long amount, IGuildUser usr, [Leftover] string msg) =>
|
||||||
Award(amount, usr.Id, msg);
|
Award(amount, usr.Id, msg);
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public Task Award(ShmartNumber amount, [Leftover] IGuildUser usr) =>
|
public Task Award(long amount, [Leftover] IGuildUser usr) =>
|
||||||
Award(amount, usr.Id);
|
Award(amount, usr.Id);
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(2)]
|
[Priority(2)]
|
||||||
public async Task Award(ShmartNumber amount, ulong usrId, [Leftover] string msg = null)
|
public async Task Award(long amount, ulong usrId, [Leftover] string msg = null)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -276,7 +276,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(2)]
|
[Priority(2)]
|
||||||
public async Task Award(ShmartNumber amount, [Leftover] IRole role)
|
public async Task Award(long amount, [Leftover] IRole role)
|
||||||
{
|
{
|
||||||
var users = (await ctx.Guild.GetUsersAsync().ConfigureAwait(false))
|
var users = (await ctx.Guild.GetUsersAsync().ConfigureAwait(false))
|
||||||
.Where(u => u.GetRoles().Contains(role))
|
.Where(u => u.GetRoles().Contains(role))
|
||||||
@@ -284,7 +284,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
await _cs.AddBulkAsync(users.Select(x => x.Id),
|
await _cs.AddBulkAsync(users.Select(x => x.Id),
|
||||||
users.Select(x => $"Awarded by bot owner to **{role.Name}** role. ({ctx.User.Username}/{ctx.User.Id})"),
|
users.Select(x => $"Awarded by bot owner to **{role.Name}** role. ({ctx.User.Username}/{ctx.User.Id})"),
|
||||||
users.Select(x => amount.Value),
|
users.Select(x => amount),
|
||||||
gamble: true)
|
gamble: true)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
@@ -298,13 +298,13 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public async Task Take(ShmartNumber amount, [Leftover] IRole role)
|
public async Task Take(long amount, [Leftover] IRole role)
|
||||||
{
|
{
|
||||||
var users = (await role.GetMembersAsync()).ToList();
|
var users = (await role.GetMembersAsync()).ToList();
|
||||||
|
|
||||||
await _cs.RemoveBulkAsync(users.Select(x => x.Id),
|
await _cs.RemoveBulkAsync(users.Select(x => x.Id),
|
||||||
users.Select(x => $"Taken by bot owner from **{role.Name}** role. ({ctx.User.Username}/{ctx.User.Id})"),
|
users.Select(x => $"Taken by bot owner from **{role.Name}** role. ({ctx.User.Username}/{ctx.User.Id})"),
|
||||||
users.Select(x => amount.Value),
|
users.Select(x => amount),
|
||||||
gamble: true)
|
gamble: true)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task Take(ShmartNumber amount, [Leftover] IGuildUser user)
|
public async Task Take(long amount, [Leftover] IGuildUser user)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -333,7 +333,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task Take(ShmartNumber amount, [Leftover] ulong usrId)
|
public async Task Take(long amount, [Leftover] ulong usrId)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
@@ -8,10 +8,11 @@ using NadekoBot.Modules.Gambling.Services;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NadekoBot.Modules.Gambling.Common;
|
using NadekoBot.Modules.Gambling.Common;
|
||||||
|
using NadekoBot.Common;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Games
|
namespace NadekoBot.Modules.Gambling
|
||||||
{
|
{
|
||||||
public partial class Games
|
public partial class Gambling
|
||||||
{
|
{
|
||||||
[Group]
|
[Group]
|
||||||
public class PlantPickCommands : GamblingSubmodule<PlantPickService>
|
public class PlantPickCommands : GamblingSubmodule<PlantPickService>
|
||||||
@@ -53,7 +54,7 @@ namespace NadekoBot.Modules.Games
|
|||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Plant(int amount = 1, string pass = null)
|
public async Task Plant(ShmartNumber amount, string pass = null)
|
||||||
{
|
{
|
||||||
if (amount < 1)
|
if (amount < 1)
|
||||||
return;
|
return;
|
||||||
@@ -63,18 +64,17 @@ namespace NadekoBot.Modules.Games
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _service.PlantAsync(ctx.Guild.Id, ctx.Channel, ctx.User.Id, ctx.User.ToString(), amount, pass);
|
|
||||||
if (!success)
|
|
||||||
{
|
|
||||||
await ReplyErrorLocalizedAsync(strs.not_enough( CurrencySign));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((SocketGuild)ctx.Guild).CurrentUser.GuildPermissions.ManageMessages)
|
if (((SocketGuild)ctx.Guild).CurrentUser.GuildPermissions.ManageMessages)
|
||||||
{
|
{
|
||||||
logService.AddDeleteIgnore(ctx.Message.Id);
|
logService.AddDeleteIgnore(ctx.Message.Id);
|
||||||
await ctx.Message.DeleteAsync().ConfigureAwait(false);
|
await ctx.Message.DeleteAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var success = await _service.PlantAsync(ctx.Guild.Id, ctx.Channel, ctx.User.Id, ctx.User.ToString(), amount, pass);
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
await ReplyErrorLocalizedAsync(strs.not_enough( CurrencySign));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
@@ -286,7 +286,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
[Priority(0)]
|
[Priority(2)]
|
||||||
public Task EmojiAdd(string name, Emote emote)
|
public Task EmojiAdd(string name, Emote emote)
|
||||||
=> EmojiAdd(name, emote.Url);
|
=> EmojiAdd(name, emote.Url);
|
||||||
|
|
||||||
@@ -294,6 +294,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
|
[Priority(1)]
|
||||||
public Task EmojiAdd(Emote emote)
|
public Task EmojiAdd(Emote emote)
|
||||||
=> EmojiAdd(emote.Name, emote.Url);
|
=> EmojiAdd(emote.Name, emote.Url);
|
||||||
|
|
||||||
@@ -301,9 +302,16 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
public async Task EmojiAdd(string name, string url)
|
[Priority(0)]
|
||||||
|
public async Task EmojiAdd(string name, string url = null)
|
||||||
{
|
{
|
||||||
name = name.Trim(':');
|
name = name.Trim(':');
|
||||||
|
|
||||||
|
url ??= ctx.Message.Attachments.FirstOrDefault()?.Url;
|
||||||
|
|
||||||
|
if (url is null)
|
||||||
|
return;
|
||||||
|
|
||||||
using var http = _httpFactory.CreateClient();
|
using var http = _httpFactory.CreateClient();
|
||||||
var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
||||||
if (!res.IsImage() || res.GetImageSize() is null or > 262_144)
|
if (!res.IsImage() || res.GetImageSize() is null or > 262_144)
|
||||||
|
@@ -746,27 +746,6 @@ namespace NadekoBot.Modules.Xp.Services
|
|||||||
guildRank);
|
guildRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static (int Level, int LevelXp, int LevelRequiredXp) GetLevelData(UserXpStats stats)
|
|
||||||
{
|
|
||||||
var baseXp = XpService.XP_REQUIRED_LVL_1;
|
|
||||||
|
|
||||||
var required = baseXp;
|
|
||||||
var totalXp = 0;
|
|
||||||
var lvl = 1;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
required = (int) (baseXp + baseXp / 4.0 * (lvl - 1));
|
|
||||||
|
|
||||||
if (required + totalXp > stats.Xp)
|
|
||||||
break;
|
|
||||||
|
|
||||||
totalXp += required;
|
|
||||||
lvl++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (lvl - 1, stats.Xp - totalXp, required);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ToggleExcludeServer(ulong id)
|
public bool ToggleExcludeServer(ulong id)
|
||||||
{
|
{
|
||||||
using (var uow = _db.GetDbContext())
|
using (var uow = _db.GetDbContext())
|
||||||
|
@@ -39,6 +39,8 @@ namespace NadekoBot.Modules.Xp
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[RequireUserPermission(GuildPermission.Administrator)]
|
||||||
public async Task XpRewsReset()
|
public async Task XpRewsReset()
|
||||||
{
|
{
|
||||||
var reply = await PromptUserConfirmAsync(_eb.Create()
|
var reply = await PromptUserConfirmAsync(_eb.Create()
|
||||||
|
@@ -14,7 +14,6 @@ namespace NadekoBot.Services
|
|||||||
IReadOnlyList<byte[]> Dice { get; }
|
IReadOnlyList<byte[]> Dice { get; }
|
||||||
|
|
||||||
IReadOnlyList<byte[]> SlotEmojis { get; }
|
IReadOnlyList<byte[]> SlotEmojis { get; }
|
||||||
IReadOnlyList<byte[]> SlotNumbers { get; }
|
|
||||||
IReadOnlyList<byte[]> Currency { get; }
|
IReadOnlyList<byte[]> Currency { get; }
|
||||||
|
|
||||||
byte[] SlotBackground { get; }
|
byte[] SlotBackground { get; }
|
||||||
|
@@ -36,7 +36,6 @@ namespace NadekoBot.Services
|
|||||||
Dice,
|
Dice,
|
||||||
SlotBg,
|
SlotBg,
|
||||||
SlotEmojis,
|
SlotEmojis,
|
||||||
SlotNumbers,
|
|
||||||
Currency,
|
Currency,
|
||||||
RategirlMatrix,
|
RategirlMatrix,
|
||||||
RategirlDot,
|
RategirlDot,
|
||||||
@@ -57,9 +56,6 @@ namespace NadekoBot.Services
|
|||||||
public IReadOnlyList<byte[]> SlotEmojis
|
public IReadOnlyList<byte[]> SlotEmojis
|
||||||
=> GetByteArrayData(ImageKeys.SlotEmojis);
|
=> GetByteArrayData(ImageKeys.SlotEmojis);
|
||||||
|
|
||||||
public IReadOnlyList<byte[]> SlotNumbers
|
|
||||||
=> GetByteArrayData(ImageKeys.SlotNumbers);
|
|
||||||
|
|
||||||
public IReadOnlyList<byte[]> Currency
|
public IReadOnlyList<byte[]> Currency
|
||||||
=> GetByteArrayData(ImageKeys.Currency);
|
=> GetByteArrayData(ImageKeys.Currency);
|
||||||
|
|
||||||
@@ -157,20 +153,7 @@ namespace NadekoBot.Services
|
|||||||
"https://cdn.nadeko.bot/slots/3.png",
|
"https://cdn.nadeko.bot/slots/3.png",
|
||||||
"https://cdn.nadeko.bot/slots/4.png",
|
"https://cdn.nadeko.bot/slots/4.png",
|
||||||
"https://cdn.nadeko.bot/slots/5.png"
|
"https://cdn.nadeko.bot/slots/5.png"
|
||||||
}.Map(x => new Uri(x)),
|
}.Map(x => new Uri(x))
|
||||||
Numbers = new[]
|
|
||||||
{
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/0.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/1.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/2.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/3.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/4.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/5.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/6.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/7.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/8.png",
|
|
||||||
"https://cdn.nadeko.bot/other/slots/numbers/9.png"
|
|
||||||
}.Map(x => new Uri(x)),
|
|
||||||
},
|
},
|
||||||
Xp = new ImageUrls.XpData()
|
Xp = new ImageUrls.XpData()
|
||||||
{
|
{
|
||||||
@@ -183,6 +166,14 @@ namespace NadekoBot.Services
|
|||||||
File.WriteAllText(_imagesPath, Yaml.Serializer.Serialize(newData));
|
File.WriteAllText(_imagesPath, Yaml.Serializer.Serialize(newData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removed numbers from slots
|
||||||
|
var localImageUrls = Yaml.Deserializer.Deserialize<ImageUrls>(File.ReadAllText(_imagesPath));
|
||||||
|
if (localImageUrls.Version == 2)
|
||||||
|
{
|
||||||
|
localImageUrls.Version = 3;
|
||||||
|
File.WriteAllText(_imagesPath, Yaml.Serializer.Serialize(localImageUrls));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Reload()
|
public async Task Reload()
|
||||||
@@ -207,9 +198,6 @@ namespace NadekoBot.Services
|
|||||||
case ImageKeys.SlotEmojis:
|
case ImageKeys.SlotEmojis:
|
||||||
await Load(key, ImageUrls.Slots.Emojis);
|
await Load(key, ImageUrls.Slots.Emojis);
|
||||||
break;
|
break;
|
||||||
case ImageKeys.SlotNumbers:
|
|
||||||
await Load(key, ImageUrls.Slots.Numbers);
|
|
||||||
break;
|
|
||||||
case ImageKeys.Currency:
|
case ImageKeys.Currency:
|
||||||
await Load(key, ImageUrls.Currency);
|
await Load(key, ImageUrls.Currency);
|
||||||
break;
|
break;
|
||||||
|
@@ -20,7 +20,7 @@ namespace NadekoBot.Services
|
|||||||
private readonly IBotCredentials _creds;
|
private readonly IBotCredentials _creds;
|
||||||
private readonly DateTime _started;
|
private readonly DateTime _started;
|
||||||
|
|
||||||
public const string BotVersion = "3.0.8";
|
public const string BotVersion = "3.0.9";
|
||||||
public string Author => "Kwoth#2452";
|
public string Author => "Kwoth#2452";
|
||||||
public string Library => "Discord.Net";
|
public string Library => "Discord.Net";
|
||||||
public double MessagesPerSecond => MessageCounter / GetUptime().TotalSeconds;
|
public double MessagesPerSecond => MessageCounter / GetUptime().TotalSeconds;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# DO NOT CHANGE
|
# DO NOT CHANGE
|
||||||
version: 2
|
version: 3
|
||||||
coins:
|
coins:
|
||||||
heads:
|
heads:
|
||||||
- https://cdn.nadeko.bot/coins/heads3.png
|
- https://cdn.nadeko.bot/coins/heads3.png
|
||||||
@@ -36,15 +36,4 @@ slots:
|
|||||||
- https://cdn.nadeko.bot/slots/3.png
|
- https://cdn.nadeko.bot/slots/3.png
|
||||||
- https://cdn.nadeko.bot/slots/4.png
|
- https://cdn.nadeko.bot/slots/4.png
|
||||||
- https://cdn.nadeko.bot/slots/5.png
|
- https://cdn.nadeko.bot/slots/5.png
|
||||||
numbers:
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/0.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/1.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/2.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/3.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/4.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/5.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/6.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/7.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/8.png
|
|
||||||
- https://cdn.nadeko.bot/other/slots/numbers/9.png
|
|
||||||
bg: https://cdn.nadeko.bot/slots/slots_bg.png
|
bg: https://cdn.nadeko.bot/slots/slots_bg.png
|
||||||
|
@@ -1200,6 +1200,7 @@ emojiadd:
|
|||||||
Adds the specified emoji to this server.
|
Adds the specified emoji to this server.
|
||||||
You can specify a name before the emoji to add it under a different name.
|
You can specify a name before the emoji to add it under a different name.
|
||||||
You can specify a name followed by an image link to add a new emoji from an image.
|
You can specify a name followed by an image link to add a new emoji from an image.
|
||||||
|
You can omit imageUrl and instead upload the image as an attachment.
|
||||||
Image size has to be below 256KB.
|
Image size has to be below 256KB.
|
||||||
args:
|
args:
|
||||||
- ":someonesCustomEmoji:"
|
- ":someonesCustomEmoji:"
|
||||||
@@ -1595,9 +1596,12 @@ warnlogall:
|
|||||||
- ""
|
- ""
|
||||||
- "2"
|
- "2"
|
||||||
warn:
|
warn:
|
||||||
desc: "Warns a user."
|
desc: |-
|
||||||
|
Warns a user with an optional reason.
|
||||||
|
You can specify a warning weight integer before the user. For example, 3 would mean that this warning counts as 3 warnings.
|
||||||
args:
|
args:
|
||||||
- "@Someone Very rude person"
|
- "@Someone Very rude person"
|
||||||
|
- "3 @Someone Very rude person"
|
||||||
scadd:
|
scadd:
|
||||||
desc: "Adds a command to the list of commands which will be executed automatically in the current channel, in the order they were added in, by the bot when it startups up."
|
desc: "Adds a command to the list of commands which will be executed automatically in the current channel, in the order they were added in, by the bot when it startups up."
|
||||||
args:
|
args:
|
||||||
|
@@ -665,6 +665,8 @@
|
|||||||
"warning_clear_fail": "Warning not cleared. Either the warning at that index doesn't exist, or it has already been cleared.",
|
"warning_clear_fail": "Warning not cleared. Either the warning at that index doesn't exist, or it has already been cleared.",
|
||||||
"warning_cleared": "Warning {0} has been cleared for {1}.",
|
"warning_cleared": "Warning {0} has been cleared for {1}.",
|
||||||
"warnings_none": "No warning on this page.",
|
"warnings_none": "No warning on this page.",
|
||||||
|
"warn_weight": "Weight: {0}",
|
||||||
|
"warn_count": "{0} current, {1} total",
|
||||||
"warnlog_for": "Warnlog for {0}",
|
"warnlog_for": "Warnlog for {0}",
|
||||||
"warnpl_none": "No punishments set.",
|
"warnpl_none": "No punishments set.",
|
||||||
"warn_expire_set_delete": "Warnings will be deleted after {0} days.",
|
"warn_expire_set_delete": "Warnings will be deleted after {0} days.",
|
||||||
|
Reference in New Issue
Block a user