Commands for which it make sense to be able to be ran in DMs can now be ran in DMs
This commit is contained in:
parent
96e57d5dbf
commit
d9e3e2aefa
@ -469,128 +469,6 @@ namespace NadekoBot.Modules.Administration
|
|||||||
await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
|
await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task Die()
|
|
||||||
{
|
|
||||||
try { await Context.Channel.SendConfirmAsync("ℹ️ **Shutting down.**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
|
||||||
await Task.Delay(2000).ConfigureAwait(false);
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task SetName([Remainder] string newName)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(newName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
await NadekoBot.Client.CurrentUser().ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
|
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync($"ℹ️ Successfully changed name to **{newName}**").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task SetAvatar([Remainder] string img = null)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(img))
|
|
||||||
return;
|
|
||||||
|
|
||||||
using (var http = new HttpClient())
|
|
||||||
{
|
|
||||||
using (var sr = await http.GetStreamAsync(img))
|
|
||||||
{
|
|
||||||
var imgStream = new MemoryStream();
|
|
||||||
await sr.CopyToAsync(imgStream);
|
|
||||||
imgStream.Position = 0;
|
|
||||||
|
|
||||||
await NadekoBot.Client.CurrentUser().ModifyAsync(u => u.Avatar = new Image(imgStream)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync("🆒 **New avatar set.**").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task SetGame([Remainder] string game = null)
|
|
||||||
{
|
|
||||||
game = game ?? "";
|
|
||||||
|
|
||||||
await NadekoBot.Client.SetGame(game).ConfigureAwait(false);
|
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync("👾 **New game set.**").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task SetStream(string url, [Remainder] string name = null)
|
|
||||||
{
|
|
||||||
name = name ?? "";
|
|
||||||
|
|
||||||
await NadekoBot.Client.SetStream(name, url).ConfigureAwait(false);
|
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync("ℹ️ **New stream set.**").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task Send(string where, [Remainder] string msg = null)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(msg))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var ids = where.Split('|');
|
|
||||||
if (ids.Length != 2)
|
|
||||||
return;
|
|
||||||
var sid = ulong.Parse(ids[0]);
|
|
||||||
var server = NadekoBot.Client.GetGuilds().Where(s => s.Id == sid).FirstOrDefault();
|
|
||||||
|
|
||||||
if (server == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ids[1].ToUpperInvariant().StartsWith("C:"))
|
|
||||||
{
|
|
||||||
var cid = ulong.Parse(ids[1].Substring(2));
|
|
||||||
var ch = (await server.GetTextChannelsAsync()).Where(c => c.Id == cid).FirstOrDefault();
|
|
||||||
if (ch == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await ch.SendMessageAsync(msg).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else if (ids[1].ToUpperInvariant().StartsWith("U:"))
|
|
||||||
{
|
|
||||||
var uid = ulong.Parse(ids[1].Substring(2));
|
|
||||||
var user = server.Users.Where(u => u.Id == uid).FirstOrDefault();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await user.SendMessageAsync(msg).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await Context.Channel.SendErrorAsync("⚠️ Invalid format.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
|
||||||
[OwnerOnly]
|
|
||||||
public async Task Announce([Remainder] string message)
|
|
||||||
{
|
|
||||||
var channels = await Task.WhenAll(NadekoBot.Client.GetGuilds().Select(g =>
|
|
||||||
g.GetDefaultChannelAsync()
|
|
||||||
)).ConfigureAwait(false);
|
|
||||||
if (channels == null)
|
|
||||||
return;
|
|
||||||
await Task.WhenAll(channels.Where(c => c != null).Select(c => c.SendConfirmAsync($"🆕 Message from {Context.User} `[Bot Owner]`:", message)))
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync("🆗").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
using Discord.Commands;
|
using Discord;
|
||||||
|
using Discord.Commands;
|
||||||
using NadekoBot.Attributes;
|
using NadekoBot.Attributes;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Administration
|
namespace NadekoBot.Modules.Administration
|
||||||
@ -12,7 +16,6 @@ namespace NadekoBot.Modules.Administration
|
|||||||
class SelfCommands : ModuleBase
|
class SelfCommands : ModuleBase
|
||||||
{
|
{
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task Leave([Remainder] string guildStr)
|
public async Task Leave([Remainder] string guildStr)
|
||||||
{
|
{
|
||||||
@ -36,6 +39,129 @@ namespace NadekoBot.Modules.Administration
|
|||||||
await Context.Channel.SendConfirmAsync("Deleted server " + server.Name).ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync("Deleted server " + server.Name).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task Die()
|
||||||
|
{
|
||||||
|
try { await Context.Channel.SendConfirmAsync("ℹ️ **Shutting down.**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
||||||
|
await Task.Delay(2000).ConfigureAwait(false);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task SetName([Remainder] string newName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(newName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
await NadekoBot.Client.CurrentUser().ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await Context.Channel.SendConfirmAsync($"ℹ️ Successfully changed name to **{newName}**").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task SetAvatar([Remainder] string img = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(img))
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var http = new HttpClient())
|
||||||
|
{
|
||||||
|
using (var sr = await http.GetStreamAsync(img))
|
||||||
|
{
|
||||||
|
var imgStream = new MemoryStream();
|
||||||
|
await sr.CopyToAsync(imgStream);
|
||||||
|
imgStream.Position = 0;
|
||||||
|
|
||||||
|
await NadekoBot.Client.CurrentUser().ModifyAsync(u => u.Avatar = new Image(imgStream)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Context.Channel.SendConfirmAsync("🆒 **New avatar set.**").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task SetGame([Remainder] string game = null)
|
||||||
|
{
|
||||||
|
game = game ?? "";
|
||||||
|
|
||||||
|
await NadekoBot.Client.SetGame(game).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await Context.Channel.SendConfirmAsync("👾 **New game set.**").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task SetStream(string url, [Remainder] string name = null)
|
||||||
|
{
|
||||||
|
name = name ?? "";
|
||||||
|
|
||||||
|
await NadekoBot.Client.SetStream(name, url).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await Context.Channel.SendConfirmAsync("ℹ️ **New stream set.**").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task Send(string where, [Remainder] string msg = null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(msg))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ids = where.Split('|');
|
||||||
|
if (ids.Length != 2)
|
||||||
|
return;
|
||||||
|
var sid = ulong.Parse(ids[0]);
|
||||||
|
var server = NadekoBot.Client.GetGuilds().Where(s => s.Id == sid).FirstOrDefault();
|
||||||
|
|
||||||
|
if (server == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ids[1].ToUpperInvariant().StartsWith("C:"))
|
||||||
|
{
|
||||||
|
var cid = ulong.Parse(ids[1].Substring(2));
|
||||||
|
var ch = (await server.GetTextChannelsAsync()).Where(c => c.Id == cid).FirstOrDefault();
|
||||||
|
if (ch == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await ch.SendMessageAsync(msg).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else if (ids[1].ToUpperInvariant().StartsWith("U:"))
|
||||||
|
{
|
||||||
|
var uid = ulong.Parse(ids[1].Substring(2));
|
||||||
|
var user = server.Users.Where(u => u.Id == uid).FirstOrDefault();
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await user.SendMessageAsync(msg).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await Context.Channel.SendErrorAsync("⚠️ Invalid format.").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[OwnerOnly]
|
||||||
|
public async Task Announce([Remainder] string message)
|
||||||
|
{
|
||||||
|
var channels = await Task.WhenAll(NadekoBot.Client.GetGuilds().Select(g =>
|
||||||
|
g.GetDefaultChannelAsync()
|
||||||
|
)).ConfigureAwait(false);
|
||||||
|
if (channels == null)
|
||||||
|
return;
|
||||||
|
await Task.WhenAll(channels.Where(c => c != null).Select(c => c.SendConfirmAsync($"🆕 Message from {Context.User} `[Bot Owner]`:", message)))
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
await Context.Channel.SendConfirmAsync("🆗").ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,8 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
private readonly char[] fateRolls = new[] { '-', ' ', '+' };
|
private readonly char[] fateRolls = new[] { '-', ' ', '+' };
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Roll()
|
public async Task Roll()
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
if (channel == null)
|
|
||||||
return;
|
|
||||||
var rng = new NadekoRandom();
|
var rng = new NadekoRandom();
|
||||||
var gen = rng.Next(1, 101);
|
var gen = rng.Next(1, 101);
|
||||||
|
|
||||||
@ -48,7 +44,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
catch { return new MemoryStream(); }
|
catch { return new MemoryStream(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
await channel.SendFileAsync(imageStream, "dice.png", $"{Context.User.Mention} rolled " + Format.Code(gen.ToString())).ConfigureAwait(false);
|
await Context.Channel.SendFileAsync(imageStream, "dice.png", $"{Context.User.Mention} rolled " + Format.Code(gen.ToString())).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RollOrderType
|
public enum RollOrderType
|
||||||
@ -58,7 +54,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public async Task Roll(int num)
|
public async Task Roll(int num)
|
||||||
{
|
{
|
||||||
@ -67,7 +62,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public async Task Rolluo(int num)
|
public async Task Rolluo(int num)
|
||||||
{
|
{
|
||||||
@ -75,7 +69,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task Roll(string arg)
|
public async Task Roll(string arg)
|
||||||
{
|
{
|
||||||
@ -83,7 +76,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task Rolluo(string arg)
|
public async Task Rolluo(string arg)
|
||||||
{
|
{
|
||||||
@ -92,13 +84,9 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
private async Task InternalRoll( int num, bool ordered)
|
private async Task InternalRoll( int num, bool ordered)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
if (channel == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (num < 1 || num > 30)
|
if (num < 1 || num > 30)
|
||||||
{
|
{
|
||||||
await channel.SendErrorAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,15 +124,11 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
bitmap.SaveAsPng(ms);
|
bitmap.SaveAsPng(ms);
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
await channel.SendFileAsync(ms, "dice.png", $"{Context.User.Mention} rolled {values.Count} {(values.Count == 1 ? "die" : "dice")}. Total: **{values.Sum()}** Average: **{(values.Sum() / (1.0f * values.Count)).ToString("N2")}**").ConfigureAwait(false);
|
await Context.Channel.SendFileAsync(ms, "dice.png", $"{Context.User.Mention} rolled {values.Count} {(values.Count == 1 ? "die" : "dice")}. Total: **{values.Sum()}** Average: **{(values.Sum() / (1.0f * values.Count)).ToString("N2")}**").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task InternallDndRoll(string arg, bool ordered)
|
private async Task InternallDndRoll(string arg, bool ordered)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
if (channel == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Match match;
|
Match match;
|
||||||
int n1;
|
int n1;
|
||||||
int n2;
|
int n2;
|
||||||
@ -163,7 +147,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} fate {(n1 == 1 ? "die" : "dice")}.")
|
var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} fate {(n1 == 1 ? "die" : "dice")}.")
|
||||||
.AddField(efb => efb.WithName(Format.Bold("Result"))
|
.AddField(efb => efb.WithName(Format.Bold("Result"))
|
||||||
.WithValue(string.Join(" ", rolls.Select(c => Format.Code($"[{c}]")))));
|
.WithValue(string.Join(" ", rolls.Select(c => Format.Code($"[{c}]")))));
|
||||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else if ((match = dndRegex.Match(arg)).Length != 0)
|
else if ((match = dndRegex.Match(arg)).Length != 0)
|
||||||
{
|
{
|
||||||
@ -186,17 +170,14 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`")
|
var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`")
|
||||||
.AddField(efb => efb.WithName(Format.Bold("Result"))
|
.AddField(efb => efb.WithName(Format.Bold("Result"))
|
||||||
.WithValue(string.Join(" ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => Format.Code(x.ToString())))));
|
.WithValue(string.Join(" ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => Format.Code(x.ToString())))));
|
||||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task NRoll([Remainder] string range)
|
public async Task NRoll([Remainder] string range)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int rolled;
|
int rolled;
|
||||||
@ -215,11 +196,11 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
rolled = new NadekoRandom().Next(0, int.Parse(range) + 1);
|
rolled = new NadekoRandom().Next(0, int.Parse(range) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
await channel.SendConfirmAsync($"{Context.User.Mention} rolled **{rolled}**.").ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} rolled **{rolled}**.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await channel.SendErrorAsync($":anger: {ex.Message}").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync($":anger: {ex.Message}").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
private const string tailsPath = "data/images/coins/tails.png";
|
private const string tailsPath = "data/images/coins/tails.png";
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Flip(int count = 1)
|
public async Task Flip(int count = 1)
|
||||||
{
|
{
|
||||||
//var channel = (ITextChannel)Context.Channel;
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
if (rng.Next(0, 2) == 1)
|
if (rng.Next(0, 2) == 1)
|
||||||
@ -49,11 +47,8 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Betflip(int amount, string guess)
|
public async Task Betflip(int amount, string guess)
|
||||||
{
|
{
|
||||||
//var channel = (ITextChannel)Context.Channel;
|
|
||||||
var guildUser = (IGuildUser)Context.User;
|
|
||||||
var guessStr = guess.Trim().ToUpperInvariant();
|
var guessStr = guess.Trim().ToUpperInvariant();
|
||||||
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
||||||
return;
|
return;
|
||||||
@ -64,7 +59,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var removed = await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)Context.User, "Betflip Gamble", amount, false).ConfigureAwait(false);
|
var removed = await CurrencyHandler.RemoveCurrencyAsync(Context.User, "Betflip Gamble", amount, false).ConfigureAwait(false);
|
||||||
if (!removed)
|
if (!removed)
|
||||||
{
|
{
|
||||||
await Context.Channel.SendErrorAsync($"{Context.User.Mention} You don't have enough {Gambling.CurrencyPluralName}.").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync($"{Context.User.Mention} You don't have enough {Gambling.CurrencyPluralName}.").ConfigureAwait(false);
|
||||||
@ -91,7 +86,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
{
|
{
|
||||||
var toWin = (int)Math.Round(amount * 1.8);
|
var toWin = (int)Math.Round(amount * 1.8);
|
||||||
str = $"{Context.User.Mention}`You guessed it!` You won {toWin}{Gambling.CurrencySign}";
|
str = $"{Context.User.Mention}`You guessed it!` You won {toWin}{Gambling.CurrencySign}";
|
||||||
await CurrencyHandler.AddCurrencyAsync((IGuildUser)Context.User, "Betflip Gamble", toWin, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betflip Gamble", toWin, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
public static string CurrencyName { get; set; }
|
public static string CurrencyName { get; set; }
|
||||||
public static string CurrencyPluralName { get; set; }
|
public static string CurrencyPluralName { get; set; }
|
||||||
public static string CurrencySign { get; set; }
|
public static string CurrencySign { get; set; }
|
||||||
|
|
||||||
static Gambling()
|
static Gambling()
|
||||||
{
|
{
|
||||||
using (var uow = DbHandler.UnitOfWork())
|
using (var uow = DbHandler.UnitOfWork())
|
||||||
@ -90,7 +90,6 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
Award(amount, usr.Id);
|
Award(amount, usr.Id);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task Award(int amount, ulong usrId)
|
public async Task Award(int amount, ulong usrId)
|
||||||
@ -122,7 +121,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
@ -131,36 +130,32 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(await CurrencyHandler.RemoveCurrencyAsync(user, $"Taken by bot owner.({Context.User.Username}/{Context.User.Id})", amount, true).ConfigureAwait(false))
|
if (await CurrencyHandler.RemoveCurrencyAsync(user, $"Taken by bot owner.({Context.User.Username}/{Context.User.Id})", amount, true).ConfigureAwait(false))
|
||||||
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} successfully took {amount} {(amount == 1? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user}!").ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} successfully took {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user}!").ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await Context.Channel.SendErrorAsync($"{Context.User.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user} because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync($"{Context.User.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user} because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task Take(long amount, [Remainder] ulong usrId)
|
public async Task Take(long amount, [Remainder] ulong usrId)
|
||||||
{
|
{
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(await CurrencyHandler.RemoveCurrencyAsync(usrId, $"Taken by bot owner.({Context.User.Username}/{Context.User.Id})", amount).ConfigureAwait(false))
|
if (await CurrencyHandler.RemoveCurrencyAsync(usrId, $"Taken by bot owner.({Context.User.Username}/{Context.User.Id})", amount).ConfigureAwait(false))
|
||||||
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} successfully took {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from <@{usrId}>!").ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} successfully took {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from <@{usrId}>!").ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await Context.Channel.SendErrorAsync($"{Context.User.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from `{usrId}` because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync($"{Context.User.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from `{usrId}` because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task BetRoll(long amount)
|
public async Task BetRoll(long amount)
|
||||||
{
|
{
|
||||||
if (amount < 1)
|
if (amount < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var guildUser = (IGuildUser)Context.User;
|
|
||||||
|
|
||||||
long userFlowers;
|
long userFlowers;
|
||||||
using (var uow = DbHandler.UnitOfWork())
|
using (var uow = DbHandler.UnitOfWork())
|
||||||
{
|
{
|
||||||
@ -169,14 +164,14 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
if (userFlowers < amount)
|
if (userFlowers < amount)
|
||||||
{
|
{
|
||||||
await Context.Channel.SendErrorAsync($"{guildUser.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync($"{Context.User.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await CurrencyHandler.RemoveCurrencyAsync(guildUser, "Betroll Gamble", amount, false).ConfigureAwait(false);
|
await CurrencyHandler.RemoveCurrencyAsync(Context.User, "Betroll Gamble", amount, false).ConfigureAwait(false);
|
||||||
|
|
||||||
var rng = new NadekoRandom().Next(0, 101);
|
var rng = new NadekoRandom().Next(0, 101);
|
||||||
var str = $"{guildUser.Mention} `You rolled {rng}.` ";
|
var str = $"{Context.User.Mention} `You rolled {rng}.` ";
|
||||||
if (rng < 67)
|
if (rng < 67)
|
||||||
{
|
{
|
||||||
str += "Better luck next time.";
|
str += "Better luck next time.";
|
||||||
@ -184,24 +179,23 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
else if (rng < 91)
|
else if (rng < 91)
|
||||||
{
|
{
|
||||||
str += $"Congratulations! You won {amount * 2}{Gambling.CurrencySign} for rolling above 66";
|
str += $"Congratulations! You won {amount * 2}{Gambling.CurrencySign} for rolling above 66";
|
||||||
await CurrencyHandler.AddCurrencyAsync(guildUser, "Betroll Gamble", amount * 2, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 2, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else if (rng < 100)
|
else if (rng < 100)
|
||||||
{
|
{
|
||||||
str += $"Congratulations! You won {amount * 3}{Gambling.CurrencySign} for rolling above 90.";
|
str += $"Congratulations! You won {amount * 3}{Gambling.CurrencySign} for rolling above 90.";
|
||||||
await CurrencyHandler.AddCurrencyAsync(guildUser, "Betroll Gamble", amount * 3, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 3, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str += $"👑 Congratulations! You won {amount * 10}{Gambling.CurrencySign} for rolling **100**. 👑";
|
str += $"👑 Congratulations! You won {amount * 10}{Gambling.CurrencySign} for rolling **100**. 👑";
|
||||||
await CurrencyHandler.AddCurrencyAsync(guildUser, "Betroll Gamble", amount * 10, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 10, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Context.Channel.SendConfirmAsync(str).ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync(str).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Leaderboard()
|
public async Task Leaderboard()
|
||||||
{
|
{
|
||||||
IEnumerable<Currency> richest = new List<Currency>();
|
IEnumerable<Currency> richest = new List<Currency>();
|
||||||
|
@ -13,15 +13,12 @@ namespace NadekoBot.Modules.Games
|
|||||||
public partial class Games
|
public partial class Games
|
||||||
{
|
{
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Leet(int level, [Remainder] string text = null)
|
public async Task Leet(int level, [Remainder] string text = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
text = text.Trim();
|
text = text.Trim();
|
||||||
if (string.IsNullOrWhiteSpace(text))
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
return;
|
return;
|
||||||
await channel.SendConfirmAsync("L33t", ToLeet(text, level).SanitizeMentions()).ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync("L33t", ToLeet(text, level).SanitizeMentions()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ namespace NadekoBot.Modules.Games
|
|||||||
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Choose([Remainder] string list = null)
|
public async Task Choose([Remainder] string list = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(list))
|
if (string.IsNullOrWhiteSpace(list))
|
||||||
@ -37,7 +36,6 @@ namespace NadekoBot.Modules.Games
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task _8Ball([Remainder] string question = null)
|
public async Task _8Ball([Remainder] string question = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(question))
|
if (string.IsNullOrWhiteSpace(question))
|
||||||
@ -50,7 +48,6 @@ namespace NadekoBot.Modules.Games
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Rps(string input)
|
public async Task Rps(string input)
|
||||||
{
|
{
|
||||||
Func<int,string> GetRPSPick = (p) =>
|
Func<int,string> GetRPSPick = (p) =>
|
||||||
@ -98,7 +95,6 @@ namespace NadekoBot.Modules.Games
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Linux(string guhnoo, string loonix)
|
public async Task Linux(string guhnoo, string loonix)
|
||||||
{
|
{
|
||||||
await Context.Channel.SendConfirmAsync(
|
await Context.Channel.SendConfirmAsync(
|
||||||
|
@ -56,12 +56,10 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Hentai([Remainder] string tag = null) =>
|
public Task Hentai([Remainder] string tag = null) =>
|
||||||
InternalHentai(Context.Channel, tag, false);
|
InternalHentai(Context.Channel, tag, false);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task AutoHentai(int interval = 0, string tags = null)
|
public async Task AutoHentai(int interval = 0, string tags = null)
|
||||||
{
|
{
|
||||||
Timer t;
|
Timer t;
|
||||||
@ -104,7 +102,6 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task HentaiBomb([Remainder] string tag = null)
|
public async Task HentaiBomb([Remainder] string tag = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
var channel = (ITextChannel)Context.Channel;
|
||||||
@ -128,7 +125,6 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
|
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Danbooru([Remainder] string tag = null)
|
public async Task Danbooru([Remainder] string tag = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
var channel = (ITextChannel)Context.Channel;
|
||||||
@ -147,53 +143,44 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Yandere([Remainder] string tag = null)
|
public Task Yandere([Remainder] string tag = null)
|
||||||
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Yandere);
|
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Yandere);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Konachan([Remainder] string tag = null)
|
public Task Konachan([Remainder] string tag = null)
|
||||||
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Konachan);
|
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Konachan);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Gelbooru([Remainder] string tag = null)
|
public Task Gelbooru([Remainder] string tag = null)
|
||||||
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Gelbooru);
|
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Gelbooru);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Rule34([Remainder] string tag = null)
|
public Task Rule34([Remainder] string tag = null)
|
||||||
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Rule34);
|
=> Searches.Searches.InternalDapiCommand(Context.Message, tag, Searches.Searches.DapiSearchType.Rule34);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task E621([Remainder] string tag = null)
|
public async Task E621([Remainder] string tag = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
tag = tag?.Trim() ?? "";
|
tag = tag?.Trim() ?? "";
|
||||||
|
|
||||||
var url = await GetE621ImageLink(tag).ConfigureAwait(false);
|
var url = await GetE621ImageLink(tag).ConfigureAwait(false);
|
||||||
|
|
||||||
if (url == null)
|
if (url == null)
|
||||||
await channel.SendErrorAsync(Context.User.Mention + " No results.");
|
await Context.Channel.SendErrorAsync(Context.User.Mention + " No results.");
|
||||||
else
|
else
|
||||||
await channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||||
.WithDescription(Context.User.Mention + " " + tag)
|
.WithDescription(Context.User.Mention + " " + tag)
|
||||||
.WithImageUrl(url)
|
.WithImageUrl(url)
|
||||||
.WithFooter(efb => efb.WithText("e621"))).ConfigureAwait(false);
|
.WithFooter(efb => efb.WithText("e621"))).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Cp()
|
public async Task Cp()
|
||||||
{
|
{
|
||||||
await Context.Channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false);
|
await Context.Channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Boobs()
|
public async Task Boobs()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -212,7 +199,6 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Butts()
|
public async Task Butts()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -53,11 +53,8 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Anime([Remainder] string query)
|
public async Task Anime([Remainder] string query)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(query))
|
if (string.IsNullOrWhiteSpace(query))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -78,15 +75,13 @@ namespace NadekoBot.Modules.Searches
|
|||||||
.AddField(efb => efb.WithName("Status").WithValue(animeData.AiringStatus.ToString()).WithIsInline(true))
|
.AddField(efb => efb.WithName("Status").WithValue(animeData.AiringStatus.ToString()).WithIsInline(true))
|
||||||
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", animeData.Genres)).WithIsInline(true))
|
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", animeData.Genres)).WithIsInline(true))
|
||||||
.WithFooter(efb => efb.WithText("Score: " + animeData.average_score + " / 100"));
|
.WithFooter(efb => efb.WithText("Score: " + animeData.average_score + " / 100"));
|
||||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Manga([Remainder] string query)
|
public async Task Manga([Remainder] string query)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(query))
|
if (string.IsNullOrWhiteSpace(query))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -108,7 +103,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", mangaData.Genres)).WithIsInline(true))
|
.AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", mangaData.Genres)).WithIsInline(true))
|
||||||
.WithFooter(efb => efb.WithText("Score: " + mangaData.average_score + " / 100"));
|
.WithFooter(efb => efb.WithText("Score: " + mangaData.average_score + " / 100"));
|
||||||
|
|
||||||
await channel.EmbedAsync(embed).ConfigureAwait(false);
|
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<AnimeResult> GetAnimeData(string query)
|
private async Task<AnimeResult> GetAnimeData(string query)
|
||||||
|
@ -25,7 +25,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
_log = LogManager.GetCurrentClassLogger();
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
}
|
}
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Osu(string usr, [Remainder] string mode = null)
|
public async Task Osu(string usr, [Remainder] string mode = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(usr))
|
if (string.IsNullOrWhiteSpace(usr))
|
||||||
@ -57,7 +56,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Osub([Remainder] string map)
|
public async Task Osub([Remainder] string map)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey))
|
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.OsuApiKey))
|
||||||
|
@ -31,7 +31,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
public partial class Searches : DiscordModule
|
public partial class Searches : DiscordModule
|
||||||
{
|
{
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Weather([Remainder] string query)
|
public async Task Weather([Remainder] string query)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(query))
|
if (string.IsNullOrWhiteSpace(query))
|
||||||
@ -398,8 +397,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task UrbanDict([Remainder] string query = null)
|
public async Task UrbanDict([Remainder] string query = null)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.MashapeKey))
|
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.MashapeKey))
|
||||||
{
|
{
|
||||||
await Context.Channel.SendErrorAsync("Bot owner didn't specify MashapeApiKey. You can't use this functionality.").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync("Bot owner didn't specify MashapeApiKey. You can't use this functionality.").ConfigureAwait(false);
|
||||||
@ -439,10 +436,8 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Define([Remainder] string word)
|
public async Task Define([Remainder] string word)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(word))
|
if (string.IsNullOrWhiteSpace(word))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -474,7 +469,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Hashtag([Remainder] string query = null)
|
public async Task Hashtag([Remainder] string query = null)
|
||||||
{
|
{
|
||||||
var arg = query;
|
var arg = query;
|
||||||
@ -550,7 +544,6 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public Task Safebooru([Remainder] string tag = null)
|
public Task Safebooru([Remainder] string tag = null)
|
||||||
=> InternalDapiCommand(Context.Message, tag, DapiSearchType.Safebooru);
|
=> InternalDapiCommand(Context.Message, tag, DapiSearchType.Safebooru);
|
||||||
|
|
||||||
@ -732,7 +725,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
|
|
||||||
public static async Task InternalDapiCommand(IUserMessage umsg, string tag, DapiSearchType type)
|
public static async Task InternalDapiCommand(IUserMessage umsg, string tag, DapiSearchType type)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = umsg.Channel;
|
||||||
|
|
||||||
tag = tag?.Trim() ?? "";
|
tag = tag?.Trim() ?? "";
|
||||||
|
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
//using Discord.Modules;
|
|
||||||
//using Manatee.Trello;
|
|
||||||
//using Manatee.Trello.ManateeJson;
|
|
||||||
//using NadekoBot.Extensions;
|
|
||||||
//using NadekoBot.Modules.Permissions.Classes;
|
|
||||||
//using System;
|
|
||||||
//using System.Collections.Generic;
|
|
||||||
//using System.Linq;
|
|
||||||
//using System.Timers;
|
|
||||||
//using Action = Manatee.Trello.Action;
|
|
||||||
////todo rewrite
|
|
||||||
//namespace NadekoBot.Modules.Trello
|
|
||||||
//{
|
|
||||||
// public class Trello : DiscordModule
|
|
||||||
// {
|
|
||||||
// private readonly Timer t = new Timer { Interval = 2000 };
|
|
||||||
// public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Trello;
|
|
||||||
|
|
||||||
// public override void Install(ModuleManager manager)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// var client = manager.Client;
|
|
||||||
|
|
||||||
// var serializer = new ManateeSerializer();
|
|
||||||
// TrelloConfiguration.Serializer = serializer;
|
|
||||||
// TrelloConfiguration.Deserializer = serializer;
|
|
||||||
// TrelloConfiguration.JsonFactory = new ManateeFactory();
|
|
||||||
// TrelloConfiguration.RestClientProvider = new Manatee.Trello.WebApi.WebApiClientProvider();
|
|
||||||
// TrelloAuthorization.Default.AppKey = NadekoBot.Credentials.TrelloAppKey;
|
|
||||||
// //TrelloAuthorization.Default.UserToken = "[your user token]";
|
|
||||||
|
|
||||||
// Discord.Channel bound = null;
|
|
||||||
// Board board = null;
|
|
||||||
|
|
||||||
// List<string> last5ActionIDs = null;
|
|
||||||
// t.Elapsed += async (s, e) =>
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// if (board == null || bound == null)
|
|
||||||
// return; //do nothing if there is no bound board
|
|
||||||
|
|
||||||
// board.Refresh();
|
|
||||||
// var cur5Actions = board.Actions.Take(board.Actions.Count() < 5 ? board.Actions.Count() : 5);
|
|
||||||
// var cur5ActionsArray = cur5Actions as Action[] ?? cur5Actions.ToArray();
|
|
||||||
|
|
||||||
// if (last5ActionIDs == null)
|
|
||||||
// {
|
|
||||||
// last5ActionIDs = cur5ActionsArray.Select(a => a.Id).ToList();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var a in cur5ActionsArray.Where(ca => !last5ActionIDs.Contains(ca.Id)))
|
|
||||||
// {
|
|
||||||
// await bound.Send("**--TRELLO NOTIFICATION--**\n" + a.ToString()).ConfigureAwait(false);
|
|
||||||
// }
|
|
||||||
// last5ActionIDs.Clear();
|
|
||||||
// last5ActionIDs.AddRange(cur5ActionsArray.Select(a => a.Id));
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("Timer failed " + ex.ToString());
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// manager.CreateCommands("", cgb =>
|
|
||||||
// {
|
|
||||||
|
|
||||||
// cgb.AddCheck(PermissionChecker.Instance);
|
|
||||||
|
|
||||||
// cgb.CreateCommand(Prefix + "bind")
|
|
||||||
// .Description("Bind a trello bot to a single channel. " +
|
|
||||||
// "You will receive notifications from your board when something is added or edited." +
|
|
||||||
// $" **Bot Owner Only!**| `{Prefix}bind [board_id]`")
|
|
||||||
// .Parameter("board_id", Discord.Commands.ParameterType.Required)
|
|
||||||
// .Do(async e =>
|
|
||||||
// {
|
|
||||||
// if (!NadekoBot.IsOwner(Context.User.Id)) return;
|
|
||||||
// if (bound != null) return;
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// bound = e.Channel;
|
|
||||||
// board = new Board(board_id.Trim());
|
|
||||||
// board.Refresh();
|
|
||||||
// await channel.SendMessageAsync("Successfully bound to this channel and board " + board.Name);
|
|
||||||
// t.Start();
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("Failed to join the board. " + ex.ToString());
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// cgb.CreateCommand(Prefix + "unbind")
|
|
||||||
// .Description($"Unbinds a bot from the channel and board. **Bot Owner Only!**| `{Prefix}unbind`")
|
|
||||||
// .Do(async e =>
|
|
||||||
// {
|
|
||||||
// if (!NadekoBot.IsOwner(Context.User.Id)) return;
|
|
||||||
// if (bound == null || bound != e.Channel) return;
|
|
||||||
// t.Stop();
|
|
||||||
// bound = null;
|
|
||||||
// board = null;
|
|
||||||
// await channel.SendMessageAsync("Successfully unbound trello from this channel.").ConfigureAwait(false);
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// cgb.CreateCommand(Prefix + "lists")
|
|
||||||
// .Alias(Prefix + "list")
|
|
||||||
// .Description($"Lists all lists, yo ;) **Bot Owner Only!**| `{Prefix}list`")
|
|
||||||
// .Do(async e =>
|
|
||||||
// {
|
|
||||||
// if (!NadekoBot.IsOwner(Context.User.Id)) return;
|
|
||||||
// if (bound == null || board == null || bound != e.Channel) return;
|
|
||||||
// await channel.SendMessageAsync("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**")))
|
|
||||||
// .ConfigureAwait(false);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// cgb.CreateCommand(Prefix + "cards")
|
|
||||||
// .Description($"Lists all cards from the supplied list. You can supply either a name or an index. **Bot Owner Only!**| `{Prefix}cards index`")
|
|
||||||
// .Parameter("list_name", Discord.Commands.ParameterType.Unparsed)
|
|
||||||
// .Do(async e =>
|
|
||||||
// {
|
|
||||||
// if (!NadekoBot.IsOwner(Context.User.Id)) return;
|
|
||||||
// if (bound == null || board == null || bound != e.Channel || list_name == null) return;
|
|
||||||
|
|
||||||
// int num;
|
|
||||||
// var success = int.TryParse(list_name, out num);
|
|
||||||
// List list = null;
|
|
||||||
// if (success && num <= board.Lists.Count() && num > 0)
|
|
||||||
// list = board.Lists[num - 1];
|
|
||||||
// else
|
|
||||||
// list = board.Lists.FirstOrDefault(l => l.Name == list_name);
|
|
||||||
|
|
||||||
|
|
||||||
// if (list != null)
|
|
||||||
// await channel.SendMessageAsync("There are " + list.Cards.Count() + " cards in a **" + list.Name + "** list\n" + string.Join("\n", list.Cards.Select(c => "**• " + c.ToString() + "**")))
|
|
||||||
// .ConfigureAwait(false);
|
|
||||||
// else
|
|
||||||
// await channel.SendMessageAsync("No such list.")
|
|
||||||
// .ConfigureAwait(false);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -17,7 +17,6 @@ namespace NadekoBot.Modules.Utility
|
|||||||
public partial class Utility : DiscordModule
|
public partial class Utility : DiscordModule
|
||||||
{
|
{
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task TogetherTube()
|
public async Task TogetherTube()
|
||||||
{
|
{
|
||||||
Uri target;
|
Uri target;
|
||||||
@ -123,7 +122,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task ServerId()
|
public async Task ServerId()
|
||||||
{
|
{
|
||||||
await Context.Channel.SendConfirmAsync($"🆔 of this server is `{((ITextChannel)Context.Channel).Guild.Id}`").ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync($"🆔 of this server is `{Context.Guild.Id}`").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
@ -223,12 +222,9 @@ namespace NadekoBot.Modules.Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task ListServers(int page = 1)
|
public async Task ListServers(int page = 1)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
page -= 1;
|
page -= 1;
|
||||||
|
|
||||||
if (page < 0)
|
if (page < 0)
|
||||||
@ -238,11 +234,11 @@ namespace NadekoBot.Modules.Utility
|
|||||||
|
|
||||||
if (!guilds.Any())
|
if (!guilds.Any())
|
||||||
{
|
{
|
||||||
await channel.SendErrorAsync("No servers found on that page.").ConfigureAwait(false);
|
await Context.Channel.SendErrorAsync("No servers found on that page.").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(),
|
await Context.Channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(),
|
||||||
(embed, g) => embed.AddField(efb => efb.WithName(g.Name)
|
(embed, g) => embed.AddField(efb => efb.WithName(g.Name)
|
||||||
.WithValue($"```css\nID: {g.Id}\nMembers: {g.Users.Count}\nOwnerID: {g.OwnerId} ```")
|
.WithValue($"```css\nID: {g.Id}\nMembers: {g.Users.Count}\nOwnerID: {g.OwnerId} ```")
|
||||||
.WithIsInline(false))))
|
.WithIsInline(false))))
|
||||||
|
@ -42,7 +42,7 @@ namespace NadekoBot.Services
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task AddCurrencyAsync(IGuildUser author, string reason, long amount, bool sendMessage)
|
public static async Task AddCurrencyAsync(IUser author, string reason, long amount, bool sendMessage)
|
||||||
{
|
{
|
||||||
await AddCurrencyAsync(author.Id, reason, amount);
|
await AddCurrencyAsync(author.Id, reason, amount);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user