Merge pull request #352 from Kwoth/dev

0.99.5
This commit is contained in:
Master Kwoth 2016-06-19 01:04:51 +02:00 committed by GitHub
commit fb3b311e43
34 changed files with 538 additions and 710 deletions

View File

@ -6,9 +6,7 @@ using NadekoBot.DataModels;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using NadekoBot.Modules.Administration.Commands; using NadekoBot.Modules.Administration.Commands;
using NadekoBot.Modules.Permissions.Classes; using NadekoBot.Modules.Permissions.Classes;
using Newtonsoft.Json.Linq;
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -58,7 +56,7 @@ namespace NadekoBot.Modules.Administration
Environment.Exit(0); Environment.Exit(0);
}); });
cgb.CreateCommand(Prefix + "sr").Alias(Prefix + "setrole") cgb.CreateCommand(Prefix + "setrole").Alias(Prefix + "sr")
.Description("Sets a role for a given user.\n**Usage**: .sr @User Guest") .Description("Sets a role for a given user.\n**Usage**: .sr @User Guest")
.Parameter("user_name", ParameterType.Required) .Parameter("user_name", ParameterType.Required)
.Parameter("role_name", ParameterType.Unparsed) .Parameter("role_name", ParameterType.Unparsed)
@ -101,7 +99,7 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "rr").Alias(Prefix + "removerole") cgb.CreateCommand(Prefix + "removerole").Alias(Prefix + "rr")
.Description("Removes a role from a given user.\n**Usage**: .rr @User Admin") .Description("Removes a role from a given user.\n**Usage**: .rr @User Admin")
.Parameter("user_name", ParameterType.Required) .Parameter("user_name", ParameterType.Required)
.Parameter("role_name", ParameterType.Unparsed) .Parameter("role_name", ParameterType.Unparsed)
@ -138,8 +136,8 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "renr") cgb.CreateCommand(Prefix + "renamerole")
.Alias(Prefix + "renamerole") .Alias(Prefix + "renr")
.Description($"Renames a role. Role you are renaming must be lower than bot's highest role.\n**Usage**: `{Prefix}renr \"First role\" SecondRole`") .Description($"Renames a role. Role you are renaming must be lower than bot's highest role.\n**Usage**: `{Prefix}renr \"First role\" SecondRole`")
.Parameter("r1", ParameterType.Required) .Parameter("r1", ParameterType.Required)
.Parameter("r2", ParameterType.Required) .Parameter("r2", ParameterType.Required)
@ -152,7 +150,7 @@ namespace NadekoBot.Modules.Administration
var roleToEdit = e.Server.FindRoles(r1).FirstOrDefault(); var roleToEdit = e.Server.FindRoles(r1).FirstOrDefault();
if (roleToEdit == null) if (roleToEdit == null)
{ {
await e.Channel.SendMessage("Can't find that role."); await e.Channel.SendMessage("Can't find that role.").ConfigureAwait(false);
return; return;
} }
@ -160,19 +158,19 @@ namespace NadekoBot.Modules.Administration
{ {
if (roleToEdit.Position > e.Server.CurrentUser.Roles.Max(r => r.Position)) if (roleToEdit.Position > e.Server.CurrentUser.Roles.Max(r => r.Position))
{ {
await e.Channel.SendMessage("I can't edit roles higher than my highest role."); await e.Channel.SendMessage("I can't edit roles higher than my highest role.").ConfigureAwait(false);
return; return;
} }
await roleToEdit.Edit(r2); await roleToEdit.Edit(r2);
await e.Channel.SendMessage("Role renamed."); await e.Channel.SendMessage("Role renamed.").ConfigureAwait(false);
} }
catch (Exception) catch (Exception)
{ {
await e.Channel.SendMessage("Failed to rename role. Probably insufficient permissions."); await e.Channel.SendMessage("Failed to rename role. Probably insufficient permissions.").ConfigureAwait(false);
} }
}); });
cgb.CreateCommand(Prefix + "rar").Alias(Prefix + "removeallroles") cgb.CreateCommand(Prefix + "removeallroles").Alias(Prefix + "rar")
.Description("Removes all roles from a mentioned user.\n**Usage**: .rar @User") .Description("Removes all roles from a mentioned user.\n**Usage**: .rar @User")
.Parameter("user_name", ParameterType.Unparsed) .Parameter("user_name", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.CanManageRoles) .AddCheck(SimpleCheckers.CanManageRoles)
@ -198,7 +196,7 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "r").Alias(Prefix + "role").Alias(Prefix + "cr") cgb.CreateCommand(Prefix + "createrole").Alias(Prefix + "cr")
.Description("Creates a role with a given name.**Usage**: `.r Awesome Role`") .Description("Creates a role with a given name.**Usage**: `.r Awesome Role`")
.Parameter("role_name", ParameterType.Unparsed) .Parameter("role_name", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.CanManageRoles) .AddCheck(SimpleCheckers.CanManageRoles)
@ -280,7 +278,7 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles)).ConfigureAwait(false); await e.Channel.SendMessage("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles)).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "b").Alias(Prefix + "ban") cgb.CreateCommand(Prefix + "ban").Alias(Prefix + "b")
.Parameter("user", ParameterType.Required) .Parameter("user", ParameterType.Required)
.Parameter("msg", ParameterType.Optional) .Parameter("msg", ParameterType.Optional)
.Description("Bans a user by id or name with an optional message.\n**Usage**: .b \"@some Guy\" Your behaviour is toxic.") .Description("Bans a user by id or name with an optional message.\n**Usage**: .b \"@some Guy\" Your behaviour is toxic.")
@ -315,7 +313,43 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "k").Alias(Prefix + "kick") cgb.CreateCommand(Prefix + "softban").Alias(Prefix + "sb")
.Parameter("user", ParameterType.Required)
.Parameter("msg", ParameterType.Optional)
.Description("Bans and then unbans a user by id or name with an optional message.\n**Usage**: .sb \"@some Guy\" Your behaviour is toxic.")
.Do(async e =>
{
var msg = e.GetArg("msg");
var user = e.GetArg("user");
if (e.User.ServerPermissions.BanMembers)
{
var usr = e.Server.FindUsers(user).FirstOrDefault();
if (usr == null)
{
await e.Channel.SendMessage("User not found.").ConfigureAwait(false);
return;
}
if (!string.IsNullOrWhiteSpace(msg))
{
await usr.SendMessage($"**You have been SOFT-BANNED from `{e.Server.Name}` server.**\n" +
$"Reason: {msg}").ConfigureAwait(false);
await Task.Delay(2000).ConfigureAwait(false); // temp solution; give time for a message to be send, fu volt
}
try
{
await e.Server.Ban(usr, 7).ConfigureAwait(false);
await e.Server.Unban(usr).ConfigureAwait(false);
await e.Channel.SendMessage("Soft-Banned user " + usr.Name + " Id: " + usr.Id).ConfigureAwait(false);
}
catch
{
await e.Channel.SendMessage("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false);
}
}
});
cgb.CreateCommand(Prefix + "kick").Alias(Prefix + "k")
.Parameter("user") .Parameter("user")
.Parameter("msg", ParameterType.Unparsed) .Parameter("msg", ParameterType.Unparsed)
.Description("Kicks a mentioned user.") .Description("Kicks a mentioned user.")
@ -428,7 +462,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "undeafen") cgb.CreateCommand(Prefix + "undeafen")
.Alias(Prefix + "undeaf") .Alias(Prefix + "undef")
.Description("Undeafens mentioned user or users") .Description("Undeafens mentioned user or users")
.Parameter("throwaway", ParameterType.Unparsed) .Parameter("throwaway", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -454,8 +488,9 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "rvch") cgb.CreateCommand(Prefix + "delvoichanl")
.Description("Removes a voice channel with a given name.") .Alias(Prefix + "dvch")
.Description("Deletes a voice channel with a given name.")
.Parameter("channel_name", ParameterType.Required) .Parameter("channel_name", ParameterType.Required)
.Do(async e => .Do(async e =>
{ {
@ -476,7 +511,8 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "vch").Alias(Prefix + "cvch") cgb.CreateCommand(Prefix + "creatvoichanl")
.Alias(Prefix + "cvch")
.Description("Creates a new voice channel with a given name.") .Description("Creates a new voice channel with a given name.")
.Parameter("channel_name", ParameterType.Required) .Parameter("channel_name", ParameterType.Required)
.Do(async e => .Do(async e =>
@ -495,8 +531,9 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "rch").Alias(Prefix + "rtch") cgb.CreateCommand(Prefix + "deltxtchanl")
.Description("Removes a text channel with a given name.") .Alias(Prefix + "dtch")
.Description("Deletes a text channel with a given name.")
.Parameter("channel_name", ParameterType.Required) .Parameter("channel_name", ParameterType.Required)
.Do(async e => .Do(async e =>
{ {
@ -516,7 +553,8 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "ch").Alias(Prefix + "tch") cgb.CreateCommand(Prefix + "creatxtchanl")
.Alias(Prefix + "ctch")
.Description("Creates a new text channel with a given name.") .Description("Creates a new text channel with a given name.")
.Parameter("channel_name", ParameterType.Required) .Parameter("channel_name", ParameterType.Required)
.Do(async e => .Do(async e =>
@ -535,8 +573,8 @@ namespace NadekoBot.Modules.Administration
} }
}); });
cgb.CreateCommand(Prefix + "st").Alias(Prefix + "settopic") cgb.CreateCommand(Prefix + "settopic")
.Alias(Prefix + "topic") .Alias(Prefix + "st")
.Description($"Sets a topic on the current channel.\n**Usage**: `{Prefix}st My new topic`") .Description($"Sets a topic on the current channel.\n**Usage**: `{Prefix}st My new topic`")
.AddCheck(SimpleCheckers.ManageChannels()) .AddCheck(SimpleCheckers.ManageChannels())
.Parameter("topic", ParameterType.Unparsed) .Parameter("topic", ParameterType.Unparsed)
@ -547,8 +585,8 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage(":ok: **New channel topic set.**").ConfigureAwait(false); await e.Channel.SendMessage(":ok: **New channel topic set.**").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "schn").Alias(Prefix + "setchannelname") cgb.CreateCommand(Prefix + "setchanlname")
.Alias(Prefix + "topic") .Alias(Prefix + "schn")
.Description("Changed the name of the current channel.") .Description("Changed the name of the current channel.")
.AddCheck(SimpleCheckers.ManageChannels()) .AddCheck(SimpleCheckers.ManageChannels())
.Parameter("name", ParameterType.Unparsed) .Parameter("name", ParameterType.Unparsed)
@ -561,7 +599,7 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage(":ok: **New channel name set.**").ConfigureAwait(false); await e.Channel.SendMessage(":ok: **New channel name set.**").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "uid").Alias(Prefix + "userid") cgb.CreateCommand(Prefix + "userid").Alias(Prefix + "uid")
.Description("Shows user ID.") .Description("Shows user ID.")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -573,11 +611,11 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage($"Id of the user { usr.Name } is { usr.Id }").ConfigureAwait(false); await e.Channel.SendMessage($"Id of the user { usr.Name } is { usr.Id }").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "cid").Alias(Prefix + "channelid") cgb.CreateCommand(Prefix + "channelid").Alias(Prefix + "cid")
.Description("Shows current channel ID.") .Description("Shows current channel ID.")
.Do(async e => await e.Channel.SendMessage("This channel's ID is " + e.Channel.Id).ConfigureAwait(false)); .Do(async e => await e.Channel.SendMessage("This channel's ID is " + e.Channel.Id).ConfigureAwait(false));
cgb.CreateCommand(Prefix + "sid").Alias(Prefix + "serverid") cgb.CreateCommand(Prefix + "serverid").Alias(Prefix + "sid")
.Description("Shows current server ID.") .Description("Shows current server ID.")
.Do(async e => await e.Channel.SendMessage("This server's ID is " + e.Server.Id).ConfigureAwait(false)); .Do(async e => await e.Channel.SendMessage("This server's ID is " + e.Server.Id).ConfigureAwait(false));
@ -596,7 +634,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "heap") cgb.CreateCommand(Prefix + "heap")
.Description("Shows allocated memory - **Owner Only!**") .Description("Shows allocated memory - **Bot Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
{ {
@ -605,7 +643,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "prune") cgb.CreateCommand(Prefix + "prune")
.Alias(".clr") .Alias(Prefix + "clr")
.Description( .Description(
"`.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel.\n**Usage**: `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X`") "`.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel.\n**Usage**: `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X`")
.Parameter("user_or_num", ParameterType.Optional) .Parameter("user_or_num", ParameterType.Optional)
@ -675,8 +713,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "die") cgb.CreateCommand(Prefix + "die")
.Alias(Prefix + "graceful") .Description("Shuts the bot down and notifies users about the restart. **Bot Owner Only!**")
.Description("Shuts the bot down and notifies users about the restart. **Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
{ {
@ -685,33 +722,21 @@ namespace NadekoBot.Modules.Administration
Environment.Exit(0); Environment.Exit(0);
}); });
//cgb.CreateCommand(Prefix + "newnick") cgb.CreateCommand(Prefix + "setname")
// .Alias(Prefix + "setnick") .Alias(Prefix + "newnm")
// .Description("Give the bot a new nickname. You need manage server permissions.") .Description("Give the bot a new name. **Bot Owner Only!**")
// .Parameter("new_nick", ParameterType.Unparsed)
// .AddCheck(SimpleCheckers.ManageServer())
// .Do(async e =>
// {
// if (e.GetArg("new_nick") == null) return;
// await client.CurrentUser.Edit(NadekoBot.Creds.Password, e.GetArg("new_nick")).ConfigureAwait(false);
// });
cgb.CreateCommand(Prefix + "newname")
.Alias(Prefix + "setname")
.Description("Give the bot a new name. **Owner Only!**")
.Parameter("new_name", ParameterType.Unparsed) .Parameter("new_name", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
{ {
if (e.GetArg("new_name") == null) return; if (e.GetArg("new_name") == null) return;
await client.CurrentUser.Edit(NadekoBot.Creds.Password, e.GetArg("new_name")).ConfigureAwait(false); await client.CurrentUser.Edit("", e.GetArg("new_name")).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "newavatar") cgb.CreateCommand(Prefix + "newavatar")
.Alias(Prefix + "setavatar") .Alias(Prefix + "setavatar")
.Description("Sets a new avatar image for the NadekoBot. **Owner Only!**") .Description("Sets a new avatar image for the NadekoBot. **Bot Owner Only!**")
.Parameter("img", ParameterType.Unparsed) .Parameter("img", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -722,7 +747,7 @@ namespace NadekoBot.Modules.Administration
var avatarAddress = e.GetArg("img"); var avatarAddress = e.GetArg("img");
var imageStream = await SearchHelper.GetResponseStreamAsync(avatarAddress).ConfigureAwait(false); var imageStream = await SearchHelper.GetResponseStreamAsync(avatarAddress).ConfigureAwait(false);
var image = System.Drawing.Image.FromStream(imageStream); var image = System.Drawing.Image.FromStream(imageStream);
await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: image.ToStream()).ConfigureAwait(false); await client.CurrentUser.Edit("", avatar: image.ToStream()).ConfigureAwait(false);
// Send confirm. // Send confirm.
await e.Channel.SendMessage("New avatar set.").ConfigureAwait(false); await e.Channel.SendMessage("New avatar set.").ConfigureAwait(false);
@ -732,7 +757,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "setgame") cgb.CreateCommand(Prefix + "setgame")
.Description("Sets the bots game. **Owner Only!**") .Description("Sets the bots game. **Bot Owner Only!**")
.Parameter("set_game", ParameterType.Unparsed) .Parameter("set_game", ParameterType.Unparsed)
.Do(e => .Do(e =>
{ {
@ -759,7 +784,7 @@ namespace NadekoBot.Modules.Administration
Channel commsChannel = null; Channel commsChannel = null;
cgb.CreateCommand(Prefix + "commsuser") cgb.CreateCommand(Prefix + "commsuser")
.Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel. **Owner Only!**") .Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel. **Bot Owner Only!**")
.Parameter("name", ParameterType.Unparsed) .Parameter("name", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -775,7 +800,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "commsserver") cgb.CreateCommand(Prefix + "commsserver")
.Description("Sets a server for through-bot communication. **Owner Only!**") .Description("Sets a server for through-bot communication. **Bot Owner Only!**")
.Parameter("server", ParameterType.Unparsed) .Parameter("server", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -788,7 +813,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "commschannel") cgb.CreateCommand(Prefix + "commschannel")
.Description("Sets a channel for through-bot communication. Only works if server is set. Resets commsuser. **Owner Only!**") .Description("Sets a channel for through-bot communication. Only works if server is set. Resets commsuser. **Bot Owner Only!**")
.Parameter("ch", ParameterType.Unparsed) .Parameter("ch", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -804,7 +829,7 @@ namespace NadekoBot.Modules.Administration
}); });
cgb.CreateCommand(Prefix + "send") cgb.CreateCommand(Prefix + "send")
.Description("Send a message to someone on a different server through the bot. **Owner Only!**\n**Usage**: .send Message text multi word!") .Description("Send a message to someone on a different server through the bot. **Bot Owner Only!**\n**Usage**: .send Message text multi word!")
.Parameter("msg", ParameterType.Unparsed) .Parameter("msg", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -817,8 +842,8 @@ namespace NadekoBot.Modules.Administration
await e.Channel.SendMessage("Failed. Make sure you've specified server and [channel or user]").ConfigureAwait(false); await e.Channel.SendMessage("Failed. Make sure you've specified server and [channel or user]").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "menrole") cgb.CreateCommand(Prefix + "mentionrole")
.Alias(Prefix + "mentionrole") .Alias(Prefix + "menro")
.Description("Mentions every person from the provided role or roles (separated by a ',') on this server. Requires you to have mention everyone permission.") .Description("Mentions every person from the provided role or roles (separated by a ',') on this server. Requires you to have mention everyone permission.")
.Parameter("roles", ParameterType.Unparsed) .Parameter("roles", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -880,23 +905,8 @@ namespace NadekoBot.Modules.Administration
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "parsetosql")
.Description("Loads exported parsedata from /data/parsedata/ into sqlite database.")
.AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
await Task.Run(() =>
{
SaveParseToDb<Announcement>("data/parsedata/Announcements.json");
SaveParseToDb<DataModels.Command>("data/parsedata/CommandsRan.json");
SaveParseToDb<Request>("data/parsedata/Requests.json");
SaveParseToDb<Stats>("data/parsedata/Stats.json");
SaveParseToDb<TypingArticle>("data/parsedata/TypingArticles.json");
}).ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "unstuck") cgb.CreateCommand(Prefix + "unstuck")
.Description("Clears the message queue. **Owner Only!**") .Description("Clears the message queue. **Bot Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(e => .Do(e =>
{ {
@ -917,9 +927,7 @@ namespace NadekoBot.Modules.Administration
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER cgb.CreateCommand(Prefix + "donadd")
cgb.CreateCommand(Prefix + "adddon")
.Alias(Prefix + "donadd")
.Description("Add a donator to the database.") .Description("Add a donator to the database.")
.Parameter("donator") .Parameter("donator")
.Parameter("amount") .Parameter("amount")
@ -939,46 +947,24 @@ namespace NadekoBot.Modules.Administration
UserName = donator.Name, UserName = donator.Name,
UserId = (long)donator.Id UserId = (long)donator.Id
}); });
e.Channel.SendMessage("Successfuly added a new donator. 👑"); e.Channel.SendMessage("Successfuly added a new donator. 👑").ConfigureAwait(false);
} }
catch { } catch { }
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "videocall")
.Description("Creates a private <http://www.appear.in> video call link for you and other mentioned people. The link is sent to mentioned people via a private message.")
.Parameter("arg", ParameterType.Unparsed)
.Do(async e =>
{
try
{
var allUsrs = e.Message.MentionedUsers.Union(new User[] { e.User });
var allUsrsArray = allUsrs as User[] ?? allUsrs.ToArray();
var str = allUsrsArray.Aggregate("http://appear.in/", (current, usr) => current + Uri.EscapeUriString(usr.Name[0].ToString()));
str += new Random().Next();
foreach (var usr in allUsrsArray)
{
await usr.SendMessage(str).ConfigureAwait(false);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
cgb.CreateCommand(Prefix + "announce") cgb.CreateCommand(Prefix + "announce")
.Description($"Sends a message to all servers' general channel bot is connected to.**Owner Only!**\n**Usage**: {Prefix}announce Useless spam") .Description($"Sends a message to all servers' general channel bot is connected to.**Bot Owner Only!**\n**Usage**: {Prefix}announce Useless spam")
.Parameter("msg", ParameterType.Unparsed) .Parameter("msg", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
{ {
foreach (var ch in NadekoBot.Client.Servers.Select(s => s.DefaultChannel)) foreach (var ch in NadekoBot.Client.Servers.Select(s => s.DefaultChannel))
{ {
await ch.SendMessage(e.GetArg("msg")); await ch.SendMessage(e.GetArg("msg")).ConfigureAwait(false);
} }
await e.Channel.SendMessage(":ok:"); await e.Channel.SendMessage(":ok:").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "whoplays") cgb.CreateCommand(Prefix + "whoplays")
@ -997,9 +983,9 @@ namespace NadekoBot.Modules.Administration
int i = 0; int i = 0;
if (arr.Length == 0) if (arr.Length == 0)
await e.Channel.SendMessage("Nobody. (not 100% sure)"); await e.Channel.SendMessage("Nobody. (not 100% sure)").ConfigureAwait(false);
else else
await e.Channel.SendMessage("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Join("", ig.Select(el => $"• {el,-35}")))) + "\n```"); await e.Channel.SendMessage("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Join("", ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "leave") cgb.CreateCommand(Prefix + "leave")
@ -1013,25 +999,11 @@ namespace NadekoBot.Modules.Administration
{ {
return; return;
} }
await srvr.Leave(); await srvr.Leave().ConfigureAwait(false);
await e.Channel.SendMessage("`Done.`"); await e.Channel.SendMessage("`Done.`").ConfigureAwait(false);
}); });
}); });
} }
public void SaveParseToDb<T>(string where) where T : IDataModel
{
try
{
var data = File.ReadAllText(where);
var arr = JObject.Parse(data)["results"] as JArray;
if (arr == null)
return;
var objects = arr.Select(x => x.ToObject<T>());
DbHandler.Instance.InsertMany(objects);
}
catch { }
}
} }
} }

View File

@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
if (!e.Server.CurrentUser.ServerPermissions.ManageRoles) if (!e.Server.CurrentUser.ServerPermissions.ManageRoles)
{ {
await e.Channel.SendMessage("I do not have the permission to manage roles."); await e.Channel.SendMessage("I do not have the permission to manage roles.").ConfigureAwait(false);
return; return;
} }
var r = e.GetArg("role")?.Trim(); var r = e.GetArg("role")?.Trim();
@ -52,19 +52,19 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
config.AutoAssignedRole = 0; config.AutoAssignedRole = 0;
await e.Channel.SendMessage("`Auto assign role on user join is now disabled.`"); await e.Channel.SendMessage("`Auto assign role on user join is now disabled.`").ConfigureAwait(false);
return; return;
} }
var role = e.Server.FindRoles(r).FirstOrDefault(); var role = e.Server.FindRoles(r).FirstOrDefault();
if (role == null) if (role == null)
{ {
await e.Channel.SendMessage("💢 `Role not found.`"); await e.Channel.SendMessage("💢 `Role not found.`").ConfigureAwait(false);
return; return;
} }
config.AutoAssignedRole = role.Id; config.AutoAssignedRole = role.Id;
await e.Channel.SendMessage("`Auto assigned role is set.`"); await e.Channel.SendMessage("`Auto assigned role is set.`").ConfigureAwait(false);
}); });
} }

View File

@ -19,9 +19,9 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
var Prefix = Module.Prefix; var Prefix = Module.Prefix;
cgb.CreateCommand(Prefix + "addcustomreaction") cgb.CreateCommand(Prefix + "addcustreact")
.Alias(Prefix + "acr") .Alias(Prefix + "acr")
.Description($"Add a custom reaction. Guide here: <https://github.com/Kwoth/NadekoBot/wiki/Custom-Reactions> **Owner Only!** \n**Usage**: {Prefix}acr \"hello\" I love saying hello to %user%") .Description($"Add a custom reaction. Guide here: <https://github.com/Kwoth/NadekoBot/wiki/Custom-Reactions> **Bot Owner Only!** \n**Usage**: {Prefix}acr \"hello\" I love saying hello to %user%")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("name", ParameterType.Required) .Parameter("name", ParameterType.Required)
.Parameter("message", ParameterType.Unparsed) .Parameter("message", ParameterType.Unparsed)
@ -38,12 +38,12 @@ namespace NadekoBot.Modules.Administration.Commands
NadekoBot.Config.CustomReactions[name].Add(message); NadekoBot.Config.CustomReactions[name].Add(message);
else else
NadekoBot.Config.CustomReactions.Add(name, new System.Collections.Generic.List<string>() { message }); NadekoBot.Config.CustomReactions.Add(name, new System.Collections.Generic.List<string>() { message });
await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig()); await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig()).ConfigureAwait(false);
await e.Channel.SendMessage($"Added {name} : {message}").ConfigureAwait(false); await e.Channel.SendMessage($"Added {name} : {message}").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "listcustomreactions") cgb.CreateCommand(Prefix + "listcustreact")
.Alias(Prefix + "lcr") .Alias(Prefix + "lcr")
.Description($"Lists all current custom reactions (paginated with 5 commands per page).\n**Usage**:{Prefix}lcr 1") .Description($"Lists all current custom reactions (paginated with 5 commands per page).\n**Usage**:{Prefix}lcr 1")
.Parameter("num", ParameterType.Required) .Parameter("num", ParameterType.Required)
@ -52,10 +52,10 @@ namespace NadekoBot.Modules.Administration.Commands
int num; int num;
if (!int.TryParse(e.GetArg("num"), out num) || num <= 0) return; if (!int.TryParse(e.GetArg("num"), out num) || num <= 0) return;
string result = GetCustomsOnPage(num - 1); //People prefer starting with 1 string result = GetCustomsOnPage(num - 1); //People prefer starting with 1
await e.Channel.SendMessage(result); await e.Channel.SendMessage(result).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "deletecustomreaction") cgb.CreateCommand(Prefix + "delcustreact")
.Alias(Prefix + "dcr") .Alias(Prefix + "dcr")
.Description("Deletes a custom reaction with given name (and index)") .Description("Deletes a custom reaction with given name (and index)")
.Parameter("name", ParameterType.Required) .Parameter("name", ParameterType.Required)
@ -68,7 +68,7 @@ namespace NadekoBot.Modules.Administration.Commands
return; return;
if (!NadekoBot.Config.CustomReactions.ContainsKey(name)) if (!NadekoBot.Config.CustomReactions.ContainsKey(name))
{ {
await e.Channel.SendMessage("Could not find given commandname"); await e.Channel.SendMessage("Could not find given commandname").ConfigureAwait(false);
return; return;
} }
string message = ""; string message = "";
@ -94,8 +94,8 @@ namespace NadekoBot.Modules.Administration.Commands
NadekoBot.Config.CustomReactions.Remove(name); NadekoBot.Config.CustomReactions.Remove(name);
message = $"Deleted custom reaction: `{name}`"; message = $"Deleted custom reaction: `{name}`";
} }
await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig()); await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig()).ConfigureAwait(false);
await e.Channel.SendMessage(message); await e.Channel.SendMessage(message).ConfigureAwait(false);
}); });
} }

View File

@ -16,8 +16,8 @@ namespace NadekoBot.Modules.Administration.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "sinfo") cgb.CreateCommand(Module.Prefix + "serverinfo")
.Alias(Module.Prefix + "serverinfo") .Alias(Module.Prefix + "sinfo")
.Description($"Shows info about the server the bot is on. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}sinfo Some Server") .Description($"Shows info about the server the bot is on. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}sinfo Some Server")
.Parameter("server", ParameterType.Optional) .Parameter("server", ParameterType.Optional)
.Do(async e => .Do(async e =>
@ -47,8 +47,8 @@ namespace NadekoBot.Modules.Administration.Commands
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Module.Prefix + "cinfo") cgb.CreateCommand(Module.Prefix + "channelinfo")
.Alias(Module.Prefix + "channelinfo") .Alias(Module.Prefix + "cinfo")
.Description($"Shows info about the channel. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}cinfo #some-channel") .Description($"Shows info about the channel. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}cinfo #some-channel")
.Parameter("channel", ParameterType.Optional) .Parameter("channel", ParameterType.Optional)
.Do(async e => .Do(async e =>
@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Administration.Commands
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Module.Prefix + "uinfo") cgb.CreateCommand(Module.Prefix + "userinfo")
.Alias(Module.Prefix + "userinfo") .Alias(Module.Prefix + "uinfo")
.Description($"Shows info about the user. If no user is supplied, it defaults a user running the command.\n**Usage**:{Module.Prefix}uinfo @SomeUser") .Description($"Shows info about the user. If no user is supplied, it defaults a user running the command.\n**Usage**:{Module.Prefix}uinfo @SomeUser")
.Parameter("user", ParameterType.Optional) .Parameter("user", ParameterType.Optional)
.Do(async e => .Do(async e =>

View File

@ -328,14 +328,13 @@ $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
}); });
cgb.CreateCommand(Module.Prefix + "logserver") cgb.CreateCommand(Module.Prefix + "logserver")
.Description("Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Owner Only!**") .Description("Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Bot Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.AddCheck(SimpleCheckers.ManageServer()) .AddCheck(SimpleCheckers.ManageServer())
.Do(DoFunc()); .Do(DoFunc());
cgb.CreateCommand(Module.Prefix + "userpresence") cgb.CreateCommand(Module.Prefix + "userpresence")
.Description("Starts logging to this channel when someone from the server goes online/offline/idle. **Owner Only!**") .Description("Starts logging to this channel when someone from the server goes online/offline/idle.")
.AddCheck(SimpleCheckers.OwnerOnly())
.AddCheck(SimpleCheckers.ManageServer()) .AddCheck(SimpleCheckers.ManageServer())
.Do(async e => .Do(async e =>
{ {
@ -351,9 +350,8 @@ $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
}); });
cgb.CreateCommand(Module.Prefix + "voicepresence") cgb.CreateCommand(Module.Prefix + "voicepresence")
.Description("Toggles logging to this channel whenever someone joins or leaves a voice channel you are in right now. **Owner Only!**") .Description("Toggles logging to this channel whenever someone joins or leaves a voice channel you are in right now.")
.Parameter("all", ParameterType.Optional) .Parameter("all", ParameterType.Optional)
.AddCheck(SimpleCheckers.OwnerOnly())
.AddCheck(SimpleCheckers.ManageServer()) .AddCheck(SimpleCheckers.ManageServer())
.Do(async e => .Do(async e =>
{ {

View File

@ -85,10 +85,12 @@ namespace NadekoBot.Modules.Administration.Commands
// if both null, disable // if both null, disable
if (string.IsNullOrWhiteSpace(msg) && string.IsNullOrWhiteSpace(minutesStr)) if (string.IsNullOrWhiteSpace(msg) && string.IsNullOrWhiteSpace(minutesStr))
{ {
await e.Channel.SendMessage("Repeating disabled").ConfigureAwait(false);
Repeater rep; Repeater rep;
if (repeaters.TryRemove(e.Server, out rep)) if (!repeaters.TryRemove(e.Server, out rep))
return;
rep.MessageTimer.Stop(); rep.MessageTimer.Stop();
await e.Channel.SendMessage("Repeating disabled").ConfigureAwait(false);
return; return;
} }
int minutes; int minutes;

View File

@ -42,15 +42,9 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
cgb.CreateCommand(Module.Prefix + "slowmode") cgb.CreateCommand(Module.Prefix + "slowmode")
.Description("Toggles slow mode. When ON, users will be able to send only 1 message every 5 seconds.") .Description("Toggles slow mode. When ON, users will be able to send only 1 message every 5 seconds.")
.Parameter("minutes", ParameterType.Optional)
.AddCheck(SimpleCheckers.ManageMessages()) .AddCheck(SimpleCheckers.ManageMessages())
.Do(async e => .Do(async e =>
{ {
//var minutesStr = e.GetArg("minutes");
//if (string.IsNullOrWhiteSpace(minutesStr)) {
// RatelimitingChannels.Remove(e.Channel.Id);
// return;
//}
ConcurrentDictionary<ulong, DateTime> throwaway; ConcurrentDictionary<ulong, DateTime> throwaway;
if (RatelimitingChannels.TryRemove(e.Channel.Id, out throwaway)) if (RatelimitingChannels.TryRemove(e.Channel.Id, out throwaway))
{ {

View File

@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Administration.Commands
cgb.CreateCommand(Module.Prefix + "remindmsg") cgb.CreateCommand(Module.Prefix + "remindmsg")
.Description("Sets message for when the remind is triggered. " + .Description("Sets message for when the remind is triggered. " +
" Available placeholders are %user% - user who ran the command, %message% -" + " Available placeholders are %user% - user who ran the command, %message% -" +
" Message specified in the remind, %target% - target channel of the remind. **Owner only!**") " Message specified in the remind, %target% - target channel of the remind. **Bot Owner Only!**")
.Parameter("msg", ParameterType.Unparsed) .Parameter("msg", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>

View File

@ -121,19 +121,26 @@ namespace NadekoBot.Modules.Administration.Commands
await e.Channel.SendMessage($":anger:You already have {role.Name} role.").ConfigureAwait(false); await e.Channel.SendMessage($":anger:You already have {role.Name} role.").ConfigureAwait(false);
return; return;
} }
try
{
await e.User.AddRoles(role).ConfigureAwait(false); await e.User.AddRoles(role).ConfigureAwait(false);
}
catch
{
await e.Channel.SendMessage($":anger:`I am unable to add that role to you. I can't add roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false);
}
var msg = await e.Channel.SendMessage($":ok:You now have {role.Name} role.").ConfigureAwait(false); var msg = await e.Channel.SendMessage($":ok:You now have {role.Name} role.").ConfigureAwait(false);
await Task.Delay(3000); await Task.Delay(3000);
await msg.Delete(); await msg.Delete();
try try
{ {
await e.Message.Delete(); await e.Message.Delete().ConfigureAwait(false);
} }
catch { } catch { }
}); });
cgb.CreateCommand(Module.Prefix + "iamn") cgb.CreateCommand(Module.Prefix + "iamnot")
.Alias(Module.Prefix + "iamnot") .Alias(Module.Prefix + "iamn")
.Description("Removes a role to you that you choose. " + .Description("Removes a role to you that you choose. " +
"Role must be on a list of self-assignable roles." + "Role must be on a list of self-assignable roles." +
"\n**Usage**: .iamn Gamer") "\n**Usage**: .iamn Gamer")

View File

@ -1,11 +1,7 @@
using NadekoBot.Classes; using Discord.Commands;
using System; using NadekoBot.Classes;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;
using NadekoBot.Modules.Permissions.Classes; using NadekoBot.Modules.Permissions.Classes;
using System.Linq;
namespace NadekoBot.Modules.Administration.Commands namespace NadekoBot.Modules.Administration.Commands
{ {
@ -18,14 +14,14 @@ namespace NadekoBot.Modules.Administration.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "leave") cgb.CreateCommand(Module.Prefix + "leave")
.Description("Makes Nadeko leave the server. Either name or id required.\n**Usage**:.leave NSFW") .Description("Makes Nadeko leave the server. Either name or id required.\n**Usage**: `.leave 123123123331`")
.Parameter("arg", ParameterType.Required) .Parameter("arg", ParameterType.Required)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
{ {
var arg = e.GetArg("arg")?.Trim(); var arg = e.GetArg("arg").Trim();
var server = NadekoBot.Client.Servers.FirstOrDefault(s => s.Id.ToString() == arg) ?? var server = NadekoBot.Client.Servers.FirstOrDefault(s => s.Id.ToString() == arg) ??
NadekoBot.Client.FindServers(arg.Trim()).FirstOrDefault(); NadekoBot.Client.FindServers(arg).FirstOrDefault();
if (server == null) if (server == null)
{ {
await e.Channel.SendMessage("Cannot find that server").ConfigureAwait(false); await e.Channel.SendMessage("Cannot find that server").ConfigureAwait(false);
@ -33,13 +29,13 @@ namespace NadekoBot.Modules.Administration.Commands
} }
if (!server.IsOwner) if (!server.IsOwner)
{ {
await server.Leave(); await server.Leave().ConfigureAwait(false);
} }
else else
{ {
await server.Delete(); await server.Delete().ConfigureAwait(false);
} }
await NadekoBot.SendMessageToOwner("Left server " + server.Name); await NadekoBot.SendMessageToOwner("Left server " + server.Name).ConfigureAwait(false);
}); });
} }
} }

View File

@ -87,6 +87,7 @@ namespace NadekoBot.Modules.Administration.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cleanv+t") cgb.CreateCommand(Module.Prefix + "cleanv+t")
.Alias(Module.Prefix + "cv+t")
.Description("Deletes all text channels ending in `-voice` for which voicechannels are not found. **Use at your own risk.**") .Description("Deletes all text channels ending in `-voice` for which voicechannels are not found. **Use at your own risk.**")
.AddCheck(SimpleCheckers.CanManageRoles) .AddCheck(SimpleCheckers.CanManageRoles)
.AddCheck(SimpleCheckers.ManageChannels()) .AddCheck(SimpleCheckers.ManageChannels())
@ -116,8 +117,8 @@ namespace NadekoBot.Modules.Administration.Commands
await e.Channel.SendMessage("`Done.`"); await e.Channel.SendMessage("`Done.`");
}); });
cgb.CreateCommand(Module.Prefix + "v+t") cgb.CreateCommand(Module.Prefix + "voice+text")
.Alias(Module.Prefix + "voice+text") .Alias(Module.Prefix + "v+t")
.Description("Creates a text channel for each voice channel only users in that voice channel can see." + .Description("Creates a text channel for each voice channel only users in that voice channel can see." +
"If you are server owner, keep in mind you will see them all the time regardless.") "If you are server owner, keep in mind you will see them all the time regardless.")
.AddCheck(SimpleCheckers.ManageChannels()) .AddCheck(SimpleCheckers.ManageChannels())

View File

@ -75,8 +75,8 @@ namespace NadekoBot.Modules.ClashOfClans
//war with the index X started. //war with the index X started.
}); });
cgb.CreateCommand(Prefix + "sw") cgb.CreateCommand(Prefix + "startwar")
.Alias(Prefix + "startwar") .Alias(Prefix + "sw")
.Description("Starts a war with a given number.") .Description("Starts a war with a given number.")
.Parameter("number", ParameterType.Required) .Parameter("number", ParameterType.Required)
.Do(async e => .Do(async e =>
@ -177,8 +177,8 @@ namespace NadekoBot.Modules.ClashOfClans
} }
}); });
cgb.CreateCommand(Prefix + "cf") cgb.CreateCommand(Prefix + "claimfinish")
.Alias(Prefix + "claimfinish") .Alias(Prefix + "cf")
.Description($"Finish your claim if you destroyed a base. Optional second argument finishes for someone else.\n**Usage**: {Prefix}cf [war_number] [optional_other_name]") .Description($"Finish your claim if you destroyed a base. Optional second argument finishes for someone else.\n**Usage**: {Prefix}cf [war_number] [optional_other_name]")
.Parameter("number", ParameterType.Required) .Parameter("number", ParameterType.Required)
.Parameter("other_name", ParameterType.Unparsed) .Parameter("other_name", ParameterType.Unparsed)

View File

@ -1,133 +0,0 @@
using Discord.Commands;
using NadekoBot.Extensions;
using NadekoBot.Modules;
using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Threading.Tasks;
namespace NadekoBot.Classes.Conversations.Commands
{
internal class RequestsCommand : DiscordCommand
{
public void SaveRequest(CommandEventArgs e, string text)
{
DbHandler.Instance.InsertData(new DataModels.Request
{
RequestText = text,
UserName = e.User.Name,
UserId = (long)e.User.Id,
ServerId = (long)e.Server.Id,
ServerName = e.Server.Name,
DateAdded = DateTime.Now
});
}
// todo what if it's too long?
public string GetRequests()
{
var task = DbHandler.Instance.GetAllRows<DataModels.Request>();
var str = "Here are all current requests for NadekoBot:\n\n";
foreach (var reqObj in task)
{
str += $"{reqObj.Id}. by **{reqObj.UserName}** from **{reqObj.ServerName}** at {reqObj.DateAdded.ToLocalTime()}\n" +
$"**{reqObj.RequestText}**\n----------\n";
}
return str + "\n__Type [@NadekoBot clr] to clear all of my messages.__";
}
public bool DeleteRequest(int requestNumber) =>
DbHandler.Instance.Delete<DataModels.Request>(requestNumber) != null;
/// <summary>
/// Delete a request with a number and returns that request object.
/// </summary>
/// <returns>RequestObject of the request. Null if none</returns>
public DataModels.Request ResolveRequest(int requestNumber) =>
DbHandler.Instance.Delete<DataModels.Request>(requestNumber);
internal override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand("req")
.Alias("request")
.Description("Requests a feature for nadeko.\n**Usage**: @NadekoBot req new_feature")
.Parameter("all", ParameterType.Unparsed)
.Do(async e =>
{
var str = e.Args[0];
try
{
SaveRequest(e, str);
}
catch
{
await e.Channel.SendMessage("Something went wrong.").ConfigureAwait(false);
return;
}
await e.Channel.SendMessage("Thank you for your request.").ConfigureAwait(false);
});
cgb.CreateCommand("lr")
.Description("PMs the user all current nadeko requests.")
.Do(async e =>
{
var str = await Task.Run(() => GetRequests()).ConfigureAwait(false);
if (str.Trim().Length > 110)
await e.User.Send(str).ConfigureAwait(false);
else
await e.User.Send("No requests atm.").ConfigureAwait(false);
});
cgb.CreateCommand("dr")
.Description("Deletes a request. **Owner Only!**")
.Parameter("reqNumber", ParameterType.Required)
.AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
try
{
if (DeleteRequest(int.Parse(e.Args[0])))
{
await e.Channel.SendMessage(e.User.Mention + " Request deleted.").ConfigureAwait(false);
}
else
{
await e.Channel.SendMessage("No request on that number.").ConfigureAwait(false);
}
}
catch
{
await e.Channel.SendMessage("Error deleting request, probably NaN error.").ConfigureAwait(false);
}
});
cgb.CreateCommand("rr")
.Description("Resolves a request. **Owner Only!**")
.Parameter("reqNumber", ParameterType.Required)
.AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
try
{
var sc = ResolveRequest(int.Parse(e.Args[0]));
if (sc != null)
{
await e.Channel.SendMessage(e.User.Mention + " Request resolved, notice sent.").ConfigureAwait(false);
await NadekoBot.Client.GetServer((ulong)sc.ServerId).GetUser((ulong)sc.UserId).Send("**This request of yours has been resolved:**\n" + sc.RequestText).ConfigureAwait(false);
}
else
{
await e.Channel.SendMessage("No request on that number.").ConfigureAwait(false);
}
}
catch
{
await e.Channel.SendMessage("Error resolving request, probably NaN error.").ConfigureAwait(false);
}
});
}
public RequestsCommand(DiscordModule module) : base(module) { }
}
}

View File

@ -39,7 +39,8 @@ namespace NadekoBot.Modules.Conversations.Commands
file = RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year")) file = RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year"))
? null ? null
: e.GetArg("year")); : e.GetArg("year"));
} else }
else
{ {
var avatar = await GetAvatar(usr.AvatarUrl); var avatar = await GetAvatar(usr.AvatarUrl);
text = usr.Name; text = usr.Name;
@ -63,16 +64,13 @@ namespace NadekoBot.Modules.Conversations.Commands
public Stream RipUser(string name, Image avatar, string year = null) public Stream RipUser(string name, Image avatar, string year = null)
{ {
var bm = Resources.rip; var bm = Resources.rip;
var offset = name.Length * 2; int width = 300;
var fontSize = 20; var fontSize = width / name.Length -2;
if (name.Length > 10) if (fontSize > 20) fontSize = 20;
{
fontSize -= (name.Length - 10) / 2;
}
//TODO use measure string
var g = Graphics.FromImage(bm); var g = Graphics.FromImage(bm);
g.DrawString(name, new Font("Comic Sans MS", fontSize, FontStyle.Bold), Brushes.Black, 100 - offset, 220); Font nameFont = new Font("Comic Sans MS", fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
SizeF nameSize = g.MeasureString(name, nameFont);
g.DrawString(name, new Font("Comic Sans MS", fontSize, FontStyle.Bold), Brushes.Black, (bm.Width /2 - 8) - (nameSize.Width /2), 243 - nameSize.Height);
g.DrawString((year ?? "?") + " - " + DateTime.Now.Year, new Font("Consolas", 12, FontStyle.Bold), Brushes.Black, 80, 240); g.DrawString((year ?? "?") + " - " + DateTime.Now.Year, new Font("Consolas", 12, FontStyle.Bold), Brushes.Black, 80, 240);
g.DrawImage(avatar, 80, 135); g.DrawImage(avatar, 80, 135);
@ -86,19 +84,14 @@ namespace NadekoBot.Modules.Conversations.Commands
public Stream RipName(string name, string year = null) public Stream RipName(string name, string year = null)
{ {
var bm = Resources.rip; var bm = Resources.rip;
int width = 190;
var offset = name.Length * 5; var offset = name.Length * 5;
var fontSize = width / name.Length;
var fontSize = 20; if (fontSize > 20) fontSize = 20;
if (name.Length > 10)
{
fontSize -= (name.Length - 10) / 2;
}
//TODO use measure string
var g = Graphics.FromImage(bm); var g = Graphics.FromImage(bm);
g.DrawString(name, new Font("Comic Sans MS", fontSize, FontStyle.Bold), Brushes.Black, 100 - offset, 200); Font nameFont = new Font("Comic Sans MS", fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
SizeF nameSize = g.MeasureString(name, nameFont);
g.DrawString(name, nameFont, Brushes.Black, (bm.Width / 2) - (nameSize.Width / 2), 200);
g.DrawString((year ?? "?") + " - " + DateTime.Now.Year, new Font("Consolas", 12, FontStyle.Bold), Brushes.Black, 80, 235); g.DrawString((year ?? "?") + " - " + DateTime.Now.Year, new Font("Consolas", 12, FontStyle.Bold), Brushes.Black, 80, 235);
g.Flush(); g.Flush();
g.Dispose(); g.Dispose();

View File

@ -4,18 +4,13 @@ using Discord.Modules;
using NadekoBot.Classes.Conversations.Commands; using NadekoBot.Classes.Conversations.Commands;
using NadekoBot.DataModels; using NadekoBot.DataModels;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using NadekoBot.Classes; using NadekoBot.Modules.Conversations.Commands;
using System.Drawing.Drawing2D;
using NadekoBot.Modules.Permissions.Classes; using NadekoBot.Modules.Permissions.Classes;
using NadekoBot.Properties;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using NadekoBot.Modules.Conversations.Commands;
namespace NadekoBot.Modules.Conversations namespace NadekoBot.Modules.Conversations
{ {
@ -25,7 +20,6 @@ namespace NadekoBot.Modules.Conversations
public Conversations() public Conversations()
{ {
commands.Add(new CopyCommand(this)); commands.Add(new CopyCommand(this));
commands.Add(new RequestsCommand(this));
commands.Add(new RipCommand(this)); commands.Add(new RipCommand(this));
} }
@ -188,32 +182,6 @@ namespace NadekoBot.Modules.Conversations
await e.Channel.SendMessage(str).ConfigureAwait(false); await e.Channel.SendMessage(str).ConfigureAwait(false);
}); });
if (!NadekoBot.Config.DontJoinServers)
{
cgb.CreateCommand("j")
.Description("Joins a server using a code.")
.Parameter("id", ParameterType.Required)
.Do(async e =>
{
var invite = await client.GetInvite(e.Args[0]).ConfigureAwait(false);
if (invite != null)
{
try
{
await invite.Accept().ConfigureAwait(false);
}
catch
{
await e.Channel.SendMessage("Failed to accept invite.").ConfigureAwait(false);
}
await e.Channel.SendMessage("I got in!").ConfigureAwait(false);
return;
}
await e.Channel.SendMessage("Invalid code.").ConfigureAwait(false);
});
}
cgb.CreateCommand("slm") cgb.CreateCommand("slm")
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)") .Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
.Do(async e => .Do(async e =>

View File

@ -5,34 +5,42 @@ using NadekoBot.Modules.Permissions.Classes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
namespace NadekoBot.Modules.CustomReactions namespace NadekoBot.Modules.CustomReactions
{ {
class CustomReactionsModule : DiscordModule internal class CustomReactionsModule : DiscordModule
{ {
public override string Prefix { get; } = ""; public override string Prefix { get; } = "";
Random rng = new Random(); private Random rng = new Random();
private Dictionary<string, Func<CommandEventArgs, string>> commandFuncs; private Dictionary<Regex, Func<CommandEventArgs, Match, string>> commandFuncs;
public CustomReactionsModule() public CustomReactionsModule()
{ {
commandFuncs = new Dictionary<string, Func<CommandEventArgs, string>> commandFuncs = new Dictionary<Regex, Func<CommandEventArgs, Match, string>>
{ {
{"%rng%", (e) => rng.Next().ToString()}, {new Regex(@"(?:%rng%|%rng:(\d{1,9})-(\d{1,9})%)"), (e,m) => {
{"%mention%", (e) => NadekoBot.BotMention }, int start, end;
{"%user%", e => e.User.Mention }, if (m.Groups[1].Success)
{"%target%", e => e.GetArg("args")?.Trim() ?? "" }, {
start = int.Parse(m.Groups[1].Value);
end = int.Parse(m.Groups[2].Value);
return rng.Next(start, end).ToString();
}else return rng.Next().ToString();
} },
{new Regex("%mention%"), (e,m) => NadekoBot.BotMention },
{new Regex("%user%"), (e,m) => e.User.Mention },
{new Regex("%target%"), (e,m) => e.GetArg("args")?.Trim() ?? "" },
}; };
} }
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
manager.CreateCommands("", cgb => manager.CreateCommands("", cgb =>
{ {
cgb.AddCheck(PermissionChecker.Instance); cgb.AddCheck(PermissionChecker.Instance);
foreach (var command in NadekoBot.Config.CustomReactions) foreach (var command in NadekoBot.Config.CustomReactions)
@ -47,11 +55,12 @@ namespace NadekoBot.Modules.CustomReactions
.Do(async e => .Do(async e =>
{ {
string str = command.Value[rng.Next(0, command.Value.Count())]; string str = command.Value[rng.Next(0, command.Value.Count())];
commandFuncs.Keys.ForEach(k => str = str.Replace(k, commandFuncs[k](e))); commandFuncs.Keys.ForEach(key => str = key.Replace(str, m => commandFuncs[key](e, m)));
await e.Channel.SendMessage(str).ConfigureAwait(false); await e.Channel.SendMessage(str).ConfigureAwait(false);
}); });
} }
}); });
} }
} }

View File

@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Gambling
}); });
cgb.CreateCommand(Prefix + "award") cgb.CreateCommand(Prefix + "award")
.Description("Gives someone a certain amount of flowers. **Owner only!**\n**Usage**: `$award 100 @person`") .Description("Gives someone a certain amount of flowers. **Bot Owner Only!**\n**Usage**: `$award 100 @person`")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required) .Parameter("amount", ParameterType.Required)
.Parameter("receiver", ParameterType.Unparsed) .Parameter("receiver", ParameterType.Unparsed)
@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Gambling
}); });
cgb.CreateCommand(Prefix + "take") cgb.CreateCommand(Prefix + "take")
.Description("Takes a certain amount of flowers from someone. **Owner only!**") .Description("Takes a certain amount of flowers from someone. **Bot Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required) .Parameter("amount", ParameterType.Required)
.Parameter("rektperson", ParameterType.Unparsed) .Parameter("rektperson", ParameterType.Unparsed)

View File

@ -28,15 +28,14 @@ namespace NadekoBot.Classes.Help.Commands
await e.Channel.SendMessage($"`Help for '{com.Text}':` {com.Description}").ConfigureAwait(false); await e.Channel.SendMessage($"`Help for '{com.Text}':` {com.Description}").ConfigureAwait(false);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}; };
public static string HelpString => (NadekoBot.IsBot public static string HelpString {
? $"To add me to your server, use this link -> <https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303>\n" get {
: $"To invite me to your server, just send me an invite link here.") + var str = string.IsNullOrWhiteSpace(NadekoBot.Creds.ClientId) && !NadekoBot.Config.DontJoinServers
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}modules` command to see a list of all modules.\n" + ? String.Format("To add me to your server, use this link -> <https://discordapp.com/oauth2/authorize?client_id={0}&scope=bot&permissions=66186303>\n", NadekoBot.Creds.ClientId)
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}commands ModuleName`" + : "";
$" (for example `{NadekoBot.Config.CommandPrefixes.Help}commands Administration`) to see a list of all of the commands in that module.\n" + return str + String.Format(NadekoBot.Config.HelpString, NadekoBot.Config.CommandPrefixes.Help);
$"For a specific command help, use `{NadekoBot.Config.CommandPrefixes.Help}h \"Command name\"` (for example `-h \"!m q\"`)\n\n" + }
"**LIST OF COMMANDS CAN BE FOUND ON THIS LINK**\n\n <https://github.com/Kwoth/NadekoBot/blob/master/commandlist.md>\n\n" + }
"Nadeko Support Server: <https://discord.gg/0ehQwTK2RBjAxzEY>";
public static string DMHelpString => NadekoBot.Config.DMHelpString; public static string DMHelpString => NadekoBot.Config.DMHelpString;
@ -79,7 +78,7 @@ Version: `{NadekoStats.Instance.BotVersion}`";
.Parameter("command", ParameterType.Unparsed) .Parameter("command", ParameterType.Unparsed)
.Do(HelpFunc()); .Do(HelpFunc());
cgb.CreateCommand(Module.Prefix + "hgit") cgb.CreateCommand(Module.Prefix + "hgit")
.Description("Generates the commandlist.md file. **Owner Only!**") .Description("Generates the commandlist.md file. **Bot Owner Only!**")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(DoGitFunc()); .Do(DoGitFunc());
cgb.CreateCommand(Module.Prefix + "readme") cgb.CreateCommand(Module.Prefix + "readme")

View File

@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Help
.Description("List all bot modules.") .Description("List all bot modules.")
.Do(async e => .Do(async e =>
{ {
await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.Client.GetService<ModuleService>().Modules.Select(m => m.Name))) await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.Client.GetService<ModuleService>().Modules.Select(m => m.Name)) + $"\n`Type \"{Prefix}commands module_name\" to get a list of commands in that module.`")
.ConfigureAwait(false); .ConfigureAwait(false);
}); });
@ -41,16 +41,27 @@ namespace NadekoBot.Modules.Help
.Parameter("module", ParameterType.Unparsed) .Parameter("module", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {
var module = e.GetArg("module")?.Trim().ToLower();
if (string.IsNullOrWhiteSpace(module))
return;
var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower()); .Where(c => c.Category.ToLower() == module);
var cmdsArray = cmds as Command[] ?? cmds.ToArray(); var cmdsArray = cmds as Command[] ?? cmds.ToArray();
if (!cmdsArray.Any()) if (!cmdsArray.Any())
{ {
await e.Channel.SendMessage("That module does not exist.").ConfigureAwait(false); await e.Channel.SendMessage("That module does not exist.").ConfigureAwait(false);
return; return;
} }
await e.Channel.SendMessage("`List of commands:` \n• " + string.Join("\n• ", cmdsArray.Select(c => c.Text))) var i = 0;
if (module != "customreactions" && module != "conversations")
await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" +
string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3)
.Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))))
+ $"\n```")
.ConfigureAwait(false); .ConfigureAwait(false);
else
await e.Channel.SendMessage("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}")));
await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false);
}); });
}); });
} }

View File

@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Music.Classes
$"**【 {SongInfo.Title.TrimTo(55)} 】**`{(SongInfo.Provider ?? "-")}`"; $"**【 {SongInfo.Title.TrimTo(55)} 】**`{(SongInfo.Provider ?? "-")}`";
public SongInfo SongInfo { get; } public SongInfo SongInfo { get; }
private PoopyBuffer songBuffer { get; } = new PoopyBuffer(4.MiB()); private PoopyBuffer songBuffer { get; } = new PoopyBuffer(NadekoBot.Config.BufferSize);
private bool prebufferingComplete { get; set; } = false; private bool prebufferingComplete { get; set; } = false;
public MusicPlayer MusicPlayer { get; set; } public MusicPlayer MusicPlayer { get; set; }

View File

@ -23,22 +23,6 @@ namespace NadekoBot.Modules.Music
public MusicModule() public MusicModule()
{ {
// ready for 1.0
//NadekoBot.Client.UserUpdated += (s, e) =>
//{
// try
// {
// if (e.Before.VoiceChannel != e.After.VoiceChannel &&
// e.Before.VoiceChannel.Members.Count() == 0)
// {
// MusicPlayer musicPlayer;
// if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return;
// musicPlayer.Destroy();
// }
// }
// catch { }
//};
} }
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Music; public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Music;
@ -54,8 +38,8 @@ namespace NadekoBot.Modules.Music
commands.ForEach(cmd => cmd.Init(cgb)); commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand("n") cgb.CreateCommand("next")
.Alias("next") .Alias("n")
.Alias("skip") .Alias("skip")
.Description("Goes to the next song in the queue. You have to be in the same voice channel as the bot.\n**Usage**: `!m n`") .Description("Goes to the next song in the queue. You have to be in the same voice channel as the bot.\n**Usage**: `!m n`")
.Do(e => .Do(e =>
@ -66,8 +50,8 @@ namespace NadekoBot.Modules.Music
musicPlayer.Next(); musicPlayer.Next();
}); });
cgb.CreateCommand("s") cgb.CreateCommand("stop")
.Alias("stop") .Alias("s")
.Description("Stops the music and clears the playlist. Stays in the channel.\n**Usage**: `!m s`") .Description("Stops the music and clears the playlist. Stays in the channel.\n**Usage**: `!m s`")
.Do(async e => .Do(async e =>
{ {
@ -80,8 +64,8 @@ namespace NadekoBot.Modules.Music
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
cgb.CreateCommand("d") cgb.CreateCommand("destroy")
.Alias("destroy") .Alias("d")
.Description("Completely stops the music and unbinds the bot from the channel. " + .Description("Completely stops the music and unbinds the bot from the channel. " +
"(may cause weird behaviour)\n**Usage**: `!m d`") "(may cause weird behaviour)\n**Usage**: `!m d`")
.Do(async e => .Do(async e =>
@ -95,8 +79,8 @@ namespace NadekoBot.Modules.Music
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
cgb.CreateCommand("p") cgb.CreateCommand("pause")
.Alias("pause") .Alias("p")
.Description("Pauses or Unpauses the song.\n**Usage**: `!m p`") .Description("Pauses or Unpauses the song.\n**Usage**: `!m p`")
.Do(async e => .Do(async e =>
{ {
@ -111,7 +95,8 @@ namespace NadekoBot.Modules.Music
await e.Channel.SendMessage("🎵`Music Player unpaused.`").ConfigureAwait(false); await e.Channel.SendMessage("🎵`Music Player unpaused.`").ConfigureAwait(false);
}); });
cgb.CreateCommand("q") cgb.CreateCommand("queue")
.Alias("q")
.Alias("yq") .Alias("yq")
.Description("Queue a song using keywords or a link. Bot will join your voice channel." + .Description("Queue a song using keywords or a link. Bot will join your voice channel." +
"**You must be in a voice channel**.\n**Usage**: `!m q Dream Of Venice`") "**You must be in a voice channel**.\n**Usage**: `!m q Dream Of Venice`")
@ -126,9 +111,10 @@ namespace NadekoBot.Modules.Music
} }
}); });
cgb.CreateCommand("lq") cgb.CreateCommand("listqueue")
.Alias("ls").Alias("lp") .Alias("lq")
.Description("Lists up to 15 currently queued songs.\n**Usage**: `!m lq`") .Description("Lists up to 15 currently queued songs.\n**Usage**: `!m lq`")
.Parameter("page", ParameterType.Optional)
.Do(async e => .Do(async e =>
{ {
MusicPlayer musicPlayer; MusicPlayer musicPlayer;
@ -137,6 +123,13 @@ namespace NadekoBot.Modules.Music
await e.Channel.SendMessage("🎵 No active music player.").ConfigureAwait(false); await e.Channel.SendMessage("🎵 No active music player.").ConfigureAwait(false);
return; return;
} }
int page;
if (!int.TryParse(e.GetArg("page"), out page) || page <= 0)
{
page = 1;
}
var currentSong = musicPlayer.CurrentSong; var currentSong = musicPlayer.CurrentSong;
if (currentSong == null) if (currentSong == null)
return; return;
@ -145,17 +138,19 @@ namespace NadekoBot.Modules.Music
toSend += "🔂"; toSend += "🔂";
else if (musicPlayer.RepeatPlaylist) else if (musicPlayer.RepeatPlaylist)
toSend += "🔁"; toSend += "🔁";
toSend += $" **{musicPlayer.Playlist.Count}** `tracks currently queued.` "; toSend += $" **{musicPlayer.Playlist.Count}** `tracks currently queued. Showing page {page}` ";
if (musicPlayer.Playlist.Count >= MusicPlayer.MaximumPlaylistSize) if (musicPlayer.Playlist.Count >= MusicPlayer.MaximumPlaylistSize)
toSend += "**Song queue is full!**\n"; toSend += "**Song queue is full!**\n";
else else
toSend += "\n"; toSend += "\n";
var number = 1; const int itemsPerPage = 15;
await e.Channel.SendMessage(toSend + string.Join("\n", musicPlayer.Playlist.Take(15).Select(v => $"`{number++}.` {v.PrettyName}"))).ConfigureAwait(false); int startAt = itemsPerPage * (page - 1);
var number = 1 + startAt;
await e.Channel.SendMessage(toSend + string.Join("\n", musicPlayer.Playlist.Skip(startAt).Take(15).Select(v => $"`{number++}.` {v.PrettyName}"))).ConfigureAwait(false);
}); });
cgb.CreateCommand("np") cgb.CreateCommand("nowplaying")
.Alias("playing") .Alias("np")
.Description("Shows the song currently playing.\n**Usage**: `!m np`") .Description("Shows the song currently playing.\n**Usage**: `!m np`")
.Do(async e => .Do(async e =>
{ {
@ -169,7 +164,8 @@ namespace NadekoBot.Modules.Music
$"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false); $"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false);
}); });
cgb.CreateCommand("vol") cgb.CreateCommand("volume")
.Alias("vol")
.Description("Sets the music volume 0-100%\n**Usage**: `!m vol 50`") .Description("Sets the music volume 0-100%\n**Usage**: `!m vol 50`")
.Parameter("val", ParameterType.Required) .Parameter("val", ParameterType.Required)
.Do(async e => .Do(async e =>
@ -190,8 +186,8 @@ namespace NadekoBot.Modules.Music
await e.Channel.SendMessage($"🎵 `Volume set to {volume}%`").ConfigureAwait(false); await e.Channel.SendMessage($"🎵 `Volume set to {volume}%`").ConfigureAwait(false);
}); });
cgb.CreateCommand("dv") cgb.CreateCommand("defvol")
.Alias("defvol") .Alias("dv")
.Description("Sets the default music volume when music playback is started (0-100)." + .Description("Sets the default music volume when music playback is started (0-100)." +
" Does not persist through restarts.\n**Usage**: `!m dv 80`") " Does not persist through restarts.\n**Usage**: `!m dv 80`")
.Parameter("val", ParameterType.Required) .Parameter("val", ParameterType.Required)
@ -208,7 +204,7 @@ namespace NadekoBot.Modules.Music
await e.Channel.SendMessage($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false); await e.Channel.SendMessage($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false);
}); });
cgb.CreateCommand("min").Alias("mute") cgb.CreateCommand("mute").Alias("min")
.Description("Sets the music volume to 0%\n**Usage**: `!m min`") .Description("Sets the music volume to 0%\n**Usage**: `!m min`")
.Do(e => .Do(e =>
{ {
@ -244,7 +240,8 @@ namespace NadekoBot.Modules.Music
musicPlayer.SetVolume(50); musicPlayer.SetVolume(50);
}); });
cgb.CreateCommand("sh") cgb.CreateCommand("shuffle")
.Alias("sh")
.Description("Shuffles the current playlist.\n**Usage**: `!m sh`") .Description("Shuffles the current playlist.\n**Usage**: `!m sh`")
.Do(async e => .Do(async e =>
{ {
@ -263,7 +260,8 @@ namespace NadekoBot.Modules.Music
await e.Channel.SendMessage("🎵 `Songs shuffled.`").ConfigureAwait(false); await e.Channel.SendMessage("🎵 `Songs shuffled.`").ConfigureAwait(false);
}); });
cgb.CreateCommand("pl") cgb.CreateCommand("playlist")
.Alias("pl")
.Description("Queues up to 50 songs from a youtube playlist specified by a link, or keywords.\n**Usage**: `!m pl playlist link or name`") .Description("Queues up to 50 songs from a youtube playlist specified by a link, or keywords.\n**Usage**: `!m pl playlist link or name`")
.Parameter("playlist", ParameterType.Unparsed) .Parameter("playlist", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -304,8 +302,9 @@ namespace NadekoBot.Modules.Music
await msg.Edit("🎵 `Playlist queue complete.`").ConfigureAwait(false); await msg.Edit("🎵 `Playlist queue complete.`").ConfigureAwait(false);
}); });
cgb.CreateCommand("lopl") cgb.CreateCommand("localplaylst")
.Description("Queues all songs from a directory. **Owner Only!**\n**Usage**: `!m lopl C:/music/classical`") .Alias("lopl")
.Description("Queues all songs from a directory. **Bot Owner Only!**\n**Usage**: `!m lopl C:/music/classical`")
.Parameter("directory", ParameterType.Unparsed) .Parameter("directory", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -344,8 +343,9 @@ namespace NadekoBot.Modules.Music
} }
}); });
cgb.CreateCommand("lo") cgb.CreateCommand("local")
.Description("Queues a local file by specifying a full path. **Owner Only!**\n**Usage**: `!m lo C:/music/mysong.mp3`") .Alias("lo")
.Description("Queues a local file by specifying a full path. **Bot Owner Only!**\n**Usage**: `!m lo C:/music/mysong.mp3`")
.Parameter("path", ParameterType.Unparsed) .Parameter("path", ParameterType.Unparsed)
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e => .Do(async e =>
@ -356,7 +356,8 @@ namespace NadekoBot.Modules.Music
await QueueSong(e.Channel, e.User.VoiceChannel, e.GetArg("path"), musicType: MusicType.Local).ConfigureAwait(false); await QueueSong(e.Channel, e.User.VoiceChannel, e.GetArg("path"), musicType: MusicType.Local).ConfigureAwait(false);
}); });
cgb.CreateCommand("mv") cgb.CreateCommand("move")
.Alias("mv")
.Description("Moves the bot to your voice channel. (works only if music is already playing)\n**Usage**: `!m mv`") .Description("Moves the bot to your voice channel. (works only if music is already playing)\n**Usage**: `!m mv`")
.Do(e => .Do(e =>
{ {
@ -399,7 +400,7 @@ namespace NadekoBot.Modules.Music
}); });
cgb.CreateCommand("cleanup") cgb.CreateCommand("cleanup")
.Description("Cleans up hanging voice connections. **Owner Only!**\n**Usage**: `!m cleanup`") .Description("Cleans up hanging voice connections. **Bot Owner Only!**\n**Usage**: `!m cleanup`")
.AddCheck(SimpleCheckers.OwnerOnly()) .AddCheck(SimpleCheckers.OwnerOnly())
.Do(e => .Do(e =>
{ {
@ -416,8 +417,8 @@ namespace NadekoBot.Modules.Music
} }
}); });
cgb.CreateCommand("rcs") cgb.CreateCommand("reptcursong")
.Alias("repeatcurrentsong") .Alias("rcs")
.Description("Toggles repeat of current song.\n**Usage**: `!m rcs`") .Description("Toggles repeat of current song.\n**Usage**: `!m rcs`")
.Do(async e => .Do(async e =>
{ {
@ -434,8 +435,8 @@ namespace NadekoBot.Modules.Music
.ConfigureAwait(false); .ConfigureAwait(false);
}); });
cgb.CreateCommand("rpl") cgb.CreateCommand("rpeatplaylst")
.Alias("repeatplaylist") .Alias("rpl")
.Description("Toggles repeat of all songs in the queue (every song that finishes is added to the end of the queue).\n**Usage**: `!m rpl`") .Description("Toggles repeat of all songs in the queue (every song that finishes is added to the end of the queue).\n**Usage**: `!m rpl`")
.Do(async e => .Do(async e =>
{ {

View File

@ -51,8 +51,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cfi") cgb.CreateCommand(Module.Prefix + "chnlfilterinv")
.Alias(Module.Prefix + "channelfilterinvites") .Alias(Module.Prefix + "cfi")
.Description("Enables or disables automatic deleting of invites on the channel." + .Description("Enables or disables automatic deleting of invites on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." + "If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfi enable #general-chat") "\n**Usage**: ;cfi enable #general-chat")
@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "sfi") cgb.CreateCommand(Module.Prefix + "srvrfilterinv")
.Alias(Module.Prefix + "serverfilterinvites") .Alias(Module.Prefix + "sfi")
.Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable") .Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable")
.Parameter("bool") .Parameter("bool")
.Do(async e => .Do(async e =>

View File

@ -49,8 +49,8 @@ namespace NadekoBot.Modules.Permissions.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "cfw") cgb.CreateCommand(Module.Prefix + "chnlfilterwords")
.Alias(Module.Prefix + "channelfilterwords") .Alias(Module.Prefix + "cfw")
.Description("Enables or disables automatic deleting of messages containing banned words on the channel." + .Description("Enables or disables automatic deleting of messages containing banned words on the channel." +
"If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." + "If no channel supplied, it will default to current one. Use ALL to apply to all existing channels at once." +
"\n**Usage**: ;cfw enable #general-chat") "\n**Usage**: ;cfw enable #general-chat")
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "afw") cgb.CreateCommand(Module.Prefix + "addfilterword")
.Alias(Module.Prefix + "addfilteredword") .Alias(Module.Prefix + "afw")
.Description("Adds a new word to the list of filtered words" + .Description("Adds a new word to the list of filtered words" +
"\n**Usage**: ;afw poop") "\n**Usage**: ;afw poop")
.Parameter("word", ParameterType.Unparsed) .Parameter("word", ParameterType.Unparsed)
@ -108,8 +108,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "rfw") cgb.CreateCommand(Module.Prefix + "rmvfilterword")
.Alias(Module.Prefix + "removefilteredword") .Alias(Module.Prefix + "rfw")
.Description("Removes the word from the list of filtered words" + .Description("Removes the word from the list of filtered words" +
"\n**Usage**: ;rw poop") "\n**Usage**: ;rw poop")
.Parameter("word", ParameterType.Unparsed) .Parameter("word", ParameterType.Unparsed)
@ -130,8 +130,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "lfw") cgb.CreateCommand(Module.Prefix + "lstfilterwords")
.Alias(Module.Prefix + "listfilteredwords") .Alias(Module.Prefix + "lfw")
.Description("Shows a list of filtered words" + .Description("Shows a list of filtered words" +
"\n**Usage**: ;lfw") "\n**Usage**: ;lfw")
.Do(async e => .Do(async e =>
@ -150,8 +150,8 @@ namespace NadekoBot.Modules.Permissions.Commands
} }
}); });
cgb.CreateCommand(Module.Prefix + "sfw") cgb.CreateCommand(Module.Prefix + "srvrfilterwords")
.Alias(Module.Prefix + "serverfilterwords") .Alias(Module.Prefix + "sfw")
.Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable") .Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable")
.Parameter("bool") .Parameter("bool")
.Do(async e => .Do(async e =>

View File

@ -58,8 +58,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false); await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "rpc") cgb.CreateCommand(Prefix + "rolepermscopy")
.Alias(Prefix + "rolepermissionscopy") .Alias(Prefix + "rpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}rpc Some Role ~ Some other role`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}rpc Some Role ~ Some other role`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}"); await e.Channel.SendMessage($"💢{ex.Message}");
} }
}); });
cgb.CreateCommand(Prefix + "cpc") cgb.CreateCommand(Prefix + "chnlpermscopy")
.Alias(Prefix + "channelpermissionscopy") .Alias(Prefix + "cpc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one channel to another.\n**Usage**:`{Prefix}cpc Some Channel ~ Some other channel`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one channel to another.\n**Usage**:`{Prefix}cpc Some Channel ~ Some other channel`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -114,8 +114,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"💢{ex.Message}"); await e.Channel.SendMessage($"💢{ex.Message}");
} }
}); });
cgb.CreateCommand(Prefix + "upc") cgb.CreateCommand(Prefix + "usrpermscopy")
.Alias(Prefix + "userpermissionscopy") .Alias(Prefix + "upc")
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`") .Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`")
.Parameter("from_to", ParameterType.Unparsed) .Parameter("from_to", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
@ -155,7 +155,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false); await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "serverperms") cgb.CreateCommand(Prefix + "srvrperms")
.Alias(Prefix + "sp") .Alias(Prefix + "sp")
.Description("Shows banned permissions for this server.") .Description("Shows banned permissions for this server.")
.Do(async e => .Do(async e =>
@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "channelperms") cgb.CreateCommand(Prefix + "chnlperms")
.Alias(Prefix + "cp") .Alias(Prefix + "cp")
.Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev") .Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev")
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -241,7 +241,8 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false); await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "sm").Alias(Prefix + "servermodule") cgb.CreateCommand(Prefix + "srvrmdl")
.Alias(Prefix + "sm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable") .Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable")
@ -265,7 +266,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "sc").Alias(Prefix + "servercommand") cgb.CreateCommand(Prefix + "srvrcmd").Alias(Prefix + "sc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable") .Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable")
@ -289,7 +290,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "rm").Alias(Prefix + "rolemodule") cgb.CreateCommand(Prefix + "rolemdl").Alias(Prefix + "rm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -327,7 +328,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "rc").Alias(Prefix + "rolecommand") cgb.CreateCommand(Prefix + "rolecmd").Alias(Prefix + "rc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -365,7 +366,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "cm").Alias(Prefix + "channelmodule") cgb.CreateCommand(Prefix + "chnlmdl").Alias(Prefix + "cm")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -408,7 +409,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "cc").Alias(Prefix + "channelcommand") cgb.CreateCommand(Prefix + "chnlcmd").Alias(Prefix + "cc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -446,7 +447,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "um").Alias(Prefix + "usermodule") cgb.CreateCommand(Prefix + "usrmdl").Alias(Prefix + "um")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -472,7 +473,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "uc").Alias(Prefix + "usercommand") cgb.CreateCommand(Prefix + "usrcmd").Alias(Prefix + "uc")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -498,7 +499,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "asm").Alias(Prefix + "allservermodules") cgb.CreateCommand(Prefix + "allsrvrmdls").Alias(Prefix + "asm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]") .Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]")
.Do(async e => .Do(async e =>
@ -523,7 +524,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "asc").Alias(Prefix + "allservercommands") cgb.CreateCommand(Prefix + "allsrvrcmds").Alias(Prefix + "asc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]") .Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]")
@ -550,7 +551,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "acm").Alias(Prefix + "allchannelmodules") cgb.CreateCommand(Prefix + "allchnlmdls").Alias(Prefix + "acm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]") .Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]")
@ -578,7 +579,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "acc").Alias(Prefix + "allchannelcommands") cgb.CreateCommand(Prefix + "allchnlcmds").Alias(Prefix + "acc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -606,7 +607,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "arm").Alias(Prefix + "allrolemodules") cgb.CreateCommand(Prefix + "allrolemdls").Alias(Prefix + "arm")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]") .Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]")
@ -633,7 +634,7 @@ namespace NadekoBot.Modules.Permissions
} }
}); });
cgb.CreateCommand(Prefix + "arc").Alias(Prefix + "allrolecommands") cgb.CreateCommand(Prefix + "allrolecmds").Alias(Prefix + "arc")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)

View File

@ -194,8 +194,8 @@ namespace NadekoBot.Modules.Pokemon
await e.Channel.SendMessage(response).ConfigureAwait(false); await e.Channel.SendMessage(response).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "ml") cgb.CreateCommand(Prefix + "movelist")
.Alias("movelist") .Alias(Prefix + "ml")
.Description("Lists the moves you are able to use") .Description("Lists the moves you are able to use")
.Do(async e => .Do(async e =>
{ {

View File

@ -1,4 +1,5 @@
using Discord.Commands; using Discord;
using Discord.Commands;
using Discord.Modules; using Discord.Modules;
using NadekoBot.Classes; using NadekoBot.Classes;
using NadekoBot.Classes.JSONModels; using NadekoBot.Classes.JSONModels;
@ -392,8 +393,8 @@ $@"🌍 **Weather for** 【{obj["target"]}】
await e.Channel.SendMessage("`" + JObject.Parse(response)["value"]["joke"].ToString() + "` 😆").ConfigureAwait(false); await e.Channel.SendMessage("`" + JObject.Parse(response)["value"]["joke"].ToString() + "` 😆").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "mi") cgb.CreateCommand(Prefix + "magicitem")
.Alias(Prefix + "magicitem") .Alias(Prefix + "mi")
.Description("Shows a random magicitem from <https://1d4chan.org/wiki/List_of_/tg/%27s_magic_items>") .Description("Shows a random magicitem from <https://1d4chan.org/wiki/List_of_/tg/%27s_magic_items>")
.Do(async e => .Do(async e =>
{ {
@ -472,7 +473,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var red = Convert.ToInt32(arg1.Substring(0, 2), 16); var red = Convert.ToInt32(arg1.Substring(0, 2), 16);
var green = Convert.ToInt32(arg1.Substring(2, 2), 16); var green = Convert.ToInt32(arg1.Substring(2, 2), 16);
var blue = Convert.ToInt32(arg1.Substring(4, 2), 16); var blue = Convert.ToInt32(arg1.Substring(4, 2), 16);
var brush = new SolidBrush(Color.FromArgb(red, green, blue)); var brush = new SolidBrush(System.Drawing.Color.FromArgb(red, green, blue));
using (Graphics g = Graphics.FromImage(img)) using (Graphics g = Graphics.FromImage(img))
{ {
@ -482,6 +483,29 @@ $@"🌍 **Weather for** 【{obj["target"]}】
await e.Channel.SendFile("arg1.png", img.ToStream()); await e.Channel.SendFile("arg1.png", img.ToStream());
}); });
cgb.CreateCommand(Prefix + "videocall")
.Description("Creates a private <http://www.appear.in> video call link for you and other mentioned people. The link is sent to mentioned people via a private message.")
.Parameter("arg", ParameterType.Unparsed)
.Do(async e =>
{
try
{
var allUsrs = e.Message.MentionedUsers.Union(new User[] { e.User });
var allUsrsArray = allUsrs as User[] ?? allUsrs.ToArray();
var str = allUsrsArray.Aggregate("http://appear.in/", (current, usr) => current + Uri.EscapeUriString(usr.Name[0].ToString()));
str += new Random().Next();
foreach (var usr in allUsrsArray)
{
await usr.SendMessage(str).ConfigureAwait(false);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
}); });
} }
} }

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Web; using System.Web;
@ -106,8 +105,8 @@ namespace NadekoBot.Modules.Translator.Helpers
translation = text.Substring(startQuote + 1, endQuote - startQuote - 1); translation = text.Substring(startQuote + 1, endQuote - startQuote - 1);
} }
} }
} else
else { {
// Translation of phrase // Translation of phrase
text = text.Substring(0, index); text = text.Substring(0, index);
text = text.Replace("],[", ","); text = text.Replace("],[", ",");
@ -141,6 +140,7 @@ namespace NadekoBot.Modules.Translator.Helpers
this.TranslationSpeechUrl = string.Format("https://translate.googleapis.com/translate_tts?ie=UTF-8&q={0}&tl={1}&total=1&idx=0&textlen={2}&client=gtx", this.TranslationSpeechUrl = string.Format("https://translate.googleapis.com/translate_tts?ie=UTF-8&q={0}&tl={1}&total=1&idx=0&textlen={2}&client=gtx",
HttpUtility.UrlEncode(translation), GoogleTranslator.LanguageEnumToIdentifier(targetLanguage), translation.Length); HttpUtility.UrlEncode(translation), GoogleTranslator.LanguageEnumToIdentifier(targetLanguage), translation.Length);
} }
}
catch (Exception ex) catch (Exception ex)
{ {
this.Error = ex; this.Error = ex;
@ -176,134 +176,135 @@ namespace NadekoBot.Modules.Translator.Helpers
{ {
if (GoogleTranslator._languageModeMap == null) if (GoogleTranslator._languageModeMap == null)
{ {
GoogleTranslator._languageModeMap = new Dictionary<string, string>(); GoogleTranslator._languageModeMap = new Dictionary<string, string>() {
GoogleTranslator._languageModeMap.Add("afrikaans", "af"); { "afrikaans", "af"},
GoogleTranslator._languageModeMap.Add("albanian", "sq"); { "albanian", "sq"},
GoogleTranslator._languageModeMap.Add("arabic", "ar"); { "arabic", "ar"},
GoogleTranslator._languageModeMap.Add("armenian", "hy"); { "armenian", "hy"},
GoogleTranslator._languageModeMap.Add("azerbaijani", "az"); { "azerbaijani", "az"},
GoogleTranslator._languageModeMap.Add("basque", "eu"); { "basque", "eu"},
GoogleTranslator._languageModeMap.Add("belarusian", "be"); { "belarusian", "be"},
GoogleTranslator._languageModeMap.Add("bengali", "bn"); { "bengali", "bn"},
GoogleTranslator._languageModeMap.Add("bulgarian", "bg"); { "bulgarian", "bg"},
GoogleTranslator._languageModeMap.Add("catalan", "ca"); { "catalan", "ca"},
GoogleTranslator._languageModeMap.Add("chinese", "zh-CN"); { "chinese", "zh-CN"},
GoogleTranslator._languageModeMap.Add("croatian", "hr"); { "croatian", "hr"},
GoogleTranslator._languageModeMap.Add("czech", "cs"); { "czech", "cs"},
GoogleTranslator._languageModeMap.Add("danish", "da"); { "danish", "da"},
GoogleTranslator._languageModeMap.Add("dutch", "nl"); { "dutch", "nl"},
GoogleTranslator._languageModeMap.Add("english", "en"); { "english", "en"},
GoogleTranslator._languageModeMap.Add("esperanto", "eo"); { "esperanto", "eo"},
GoogleTranslator._languageModeMap.Add("estonian", "et"); { "estonian", "et"},
GoogleTranslator._languageModeMap.Add("filipino", "tl"); { "filipino", "tl"},
GoogleTranslator._languageModeMap.Add("finnish", "fi"); { "finnish", "fi"},
GoogleTranslator._languageModeMap.Add("french", "fr"); { "french", "fr"},
GoogleTranslator._languageModeMap.Add("galician", "gl"); { "galician", "gl"},
GoogleTranslator._languageModeMap.Add("german", "de"); { "german", "de"},
GoogleTranslator._languageModeMap.Add("georgian", "ka"); { "georgian", "ka"},
GoogleTranslator._languageModeMap.Add("greek", "el"); { "greek", "el"},
GoogleTranslator._languageModeMap.Add("haitian Creole", "ht"); { "haitian Creole", "ht"},
GoogleTranslator._languageModeMap.Add("hebrew", "iw"); { "hebrew", "iw"},
GoogleTranslator._languageModeMap.Add("hindi", "hi"); { "hindi", "hi"},
GoogleTranslator._languageModeMap.Add("hungarian", "hu"); { "hungarian", "hu"},
GoogleTranslator._languageModeMap.Add("icelandic", "is"); { "icelandic", "is"},
GoogleTranslator._languageModeMap.Add("indonesian", "id"); { "indonesian", "id"},
GoogleTranslator._languageModeMap.Add("irish", "ga"); { "irish", "ga"},
GoogleTranslator._languageModeMap.Add("italian", "it"); { "italian", "it"},
GoogleTranslator._languageModeMap.Add("japanese", "ja"); { "japanese", "ja"},
GoogleTranslator._languageModeMap.Add("korean", "ko"); { "korean", "ko"},
GoogleTranslator._languageModeMap.Add("lao", "lo"); { "lao", "lo"},
GoogleTranslator._languageModeMap.Add("latin", "la"); { "latin", "la"},
GoogleTranslator._languageModeMap.Add("latvian", "lv"); { "latvian", "lv"},
GoogleTranslator._languageModeMap.Add("lithuanian", "lt"); { "lithuanian", "lt"},
GoogleTranslator._languageModeMap.Add("macedonian", "mk"); { "macedonian", "mk"},
GoogleTranslator._languageModeMap.Add("malay", "ms"); { "malay", "ms"},
GoogleTranslator._languageModeMap.Add("maltese", "mt"); { "maltese", "mt"},
GoogleTranslator._languageModeMap.Add("norwegian", "no"); { "norwegian", "no"},
GoogleTranslator._languageModeMap.Add("persian", "fa"); { "persian", "fa"},
GoogleTranslator._languageModeMap.Add("polish", "pl"); { "polish", "pl"},
GoogleTranslator._languageModeMap.Add("portuguese", "pt"); { "portuguese", "pt"},
GoogleTranslator._languageModeMap.Add("romanian", "ro"); { "romanian", "ro"},
GoogleTranslator._languageModeMap.Add("russian", "ru"); { "russian", "ru"},
GoogleTranslator._languageModeMap.Add("serbian", "sr"); { "serbian", "sr"},
GoogleTranslator._languageModeMap.Add("slovak", "sk"); { "slovak", "sk"},
GoogleTranslator._languageModeMap.Add("slovenian", "sl"); { "slovenian", "sl"},
GoogleTranslator._languageModeMap.Add("spanish", "es"); { "spanish", "es"},
GoogleTranslator._languageModeMap.Add("swahili", "sw"); { "swahili", "sw"},
GoogleTranslator._languageModeMap.Add("swedish", "sv"); { "swedish", "sv"},
GoogleTranslator._languageModeMap.Add("tamil", "ta"); { "tamil", "ta"},
GoogleTranslator._languageModeMap.Add("telugu", "te"); { "telugu", "te"},
GoogleTranslator._languageModeMap.Add("thai", "th"); { "thai", "th"},
GoogleTranslator._languageModeMap.Add("turkish", "tr"); { "turkish", "tr"},
GoogleTranslator._languageModeMap.Add("ukrainian", "uk"); { "ukrainian", "uk"},
GoogleTranslator._languageModeMap.Add("urdu", "ur"); { "urdu", "ur"},
GoogleTranslator._languageModeMap.Add("vietnamese", "vi"); { "vietnamese", "vi"},
GoogleTranslator._languageModeMap.Add("welsh", "cy"); { "welsh", "cy"},
GoogleTranslator._languageModeMap.Add("yiddish", "yi"); { "yiddish", "yi"},
GoogleTranslator._languageModeMap.Add("af", "af"); { "af", "af"},
GoogleTranslator._languageModeMap.Add("sq", "sq"); { "sq", "sq"},
GoogleTranslator._languageModeMap.Add("ar", "ar"); { "ar", "ar"},
GoogleTranslator._languageModeMap.Add("hy", "hy"); { "hy", "hy"},
GoogleTranslator._languageModeMap.Add("az", "az"); { "az", "az"},
GoogleTranslator._languageModeMap.Add("eu", "eu"); { "eu", "eu"},
GoogleTranslator._languageModeMap.Add("be", "be"); { "be", "be"},
GoogleTranslator._languageModeMap.Add("bn", "bn"); { "bn", "bn"},
GoogleTranslator._languageModeMap.Add("bg", "bg"); { "bg", "bg"},
GoogleTranslator._languageModeMap.Add("ca", "ca"); { "ca", "ca"},
GoogleTranslator._languageModeMap.Add("zh-CN", "zh-CN"); { "zh-CN", "zh-CN"},
GoogleTranslator._languageModeMap.Add("hr", "hr"); { "hr", "hr"},
GoogleTranslator._languageModeMap.Add("cs", "cs"); { "cs", "cs"},
GoogleTranslator._languageModeMap.Add("da", "da"); { "da", "da"},
GoogleTranslator._languageModeMap.Add("nl", "nl"); { "nl", "nl"},
GoogleTranslator._languageModeMap.Add("en", "en"); { "en", "en"},
GoogleTranslator._languageModeMap.Add("eo", "eo"); { "eo", "eo"},
GoogleTranslator._languageModeMap.Add("et", "et"); { "et", "et"},
GoogleTranslator._languageModeMap.Add("tl", "tl"); { "tl", "tl"},
GoogleTranslator._languageModeMap.Add("fi", "fi"); { "fi", "fi"},
GoogleTranslator._languageModeMap.Add("fr", "fr"); { "fr", "fr"},
GoogleTranslator._languageModeMap.Add("gl", "gl"); { "gl", "gl"},
GoogleTranslator._languageModeMap.Add("de", "de"); { "de", "de"},
GoogleTranslator._languageModeMap.Add("ka", "ka"); { "ka", "ka"},
GoogleTranslator._languageModeMap.Add("el", "el"); { "el", "el"},
GoogleTranslator._languageModeMap.Add("ht", "ht"); { "ht", "ht"},
GoogleTranslator._languageModeMap.Add("iw", "iw"); { "iw", "iw"},
GoogleTranslator._languageModeMap.Add("hi", "hi"); { "hi", "hi"},
GoogleTranslator._languageModeMap.Add("hu", "hu"); { "hu", "hu"},
GoogleTranslator._languageModeMap.Add("is", "is"); { "is", "is"},
GoogleTranslator._languageModeMap.Add("id", "id"); { "id", "id"},
GoogleTranslator._languageModeMap.Add("ga", "ga"); { "ga", "ga"},
GoogleTranslator._languageModeMap.Add("it", "it"); { "it", "it"},
GoogleTranslator._languageModeMap.Add("ja", "ja"); { "ja", "ja"},
GoogleTranslator._languageModeMap.Add("ko", "ko"); { "ko", "ko"},
GoogleTranslator._languageModeMap.Add("lo", "lo"); { "lo", "lo"},
GoogleTranslator._languageModeMap.Add("la", "la"); { "la", "la"},
GoogleTranslator._languageModeMap.Add("lv", "lv"); { "lv", "lv"},
GoogleTranslator._languageModeMap.Add("lt", "lt"); { "lt", "lt"},
GoogleTranslator._languageModeMap.Add("mk", "mk"); { "mk", "mk"},
GoogleTranslator._languageModeMap.Add("ms", "ms"); { "ms", "ms"},
GoogleTranslator._languageModeMap.Add("mt", "mt"); { "mt", "mt"},
GoogleTranslator._languageModeMap.Add("no", "no"); { "no", "no"},
GoogleTranslator._languageModeMap.Add("fa", "fa"); { "fa", "fa"},
GoogleTranslator._languageModeMap.Add("pl", "pl"); { "pl", "pl"},
GoogleTranslator._languageModeMap.Add("pt", "pt"); { "pt", "pt"},
GoogleTranslator._languageModeMap.Add("ro", "ro"); { "ro", "ro"},
GoogleTranslator._languageModeMap.Add("ru", "ru"); { "ru", "ru"},
GoogleTranslator._languageModeMap.Add("sr", "sr"); { "sr", "sr"},
GoogleTranslator._languageModeMap.Add("sk", "sk"); { "sk", "sk"},
GoogleTranslator._languageModeMap.Add("sl", "sl"); { "sl", "sl"},
GoogleTranslator._languageModeMap.Add("es", "es"); { "es", "es"},
GoogleTranslator._languageModeMap.Add("sw", "sw"); { "sw", "sw"},
GoogleTranslator._languageModeMap.Add("sv", "sv"); { "sv", "sv"},
GoogleTranslator._languageModeMap.Add("ta", "ta"); { "ta", "ta"},
GoogleTranslator._languageModeMap.Add("te", "te"); { "te", "te"},
GoogleTranslator._languageModeMap.Add("th", "th"); { "th", "th"},
GoogleTranslator._languageModeMap.Add("tr", "tr"); { "tr", "tr"},
GoogleTranslator._languageModeMap.Add("uk", "uk"); { "uk", "uk"},
GoogleTranslator._languageModeMap.Add("ur", "ur"); { "ur", "ur"},
GoogleTranslator._languageModeMap.Add("vi", "vi"); { "vi", "vi"},
GoogleTranslator._languageModeMap.Add("cy", "cy"); { "cy", "cy"},
GoogleTranslator._languageModeMap.Add("yi", "yi"); { "yi", "yi"},
};
} }
} }

View File

@ -12,8 +12,8 @@ namespace NadekoBot.Modules.Translator
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "trans") cgb.CreateCommand(Module.Prefix + "translate")
.Alias(Module.Prefix + "translate") .Alias(Module.Prefix + "trans")
.Description($"Translates from>to text. From the given language to the destiation language.\n**Usage**: {Module.Prefix}trans en>fr Hello") .Description($"Translates from>to text. From the given language to the destiation language.\n**Usage**: {Module.Prefix}trans en>fr Hello")
.Parameter("langs", ParameterType.Required) .Parameter("langs", ParameterType.Required)
.Parameter("text", ParameterType.Unparsed) .Parameter("text", ParameterType.Unparsed)

View File

@ -40,7 +40,6 @@ namespace NadekoBot
public static LocalizedStrings Locale { get; set; } = new LocalizedStrings(); public static LocalizedStrings Locale { get; set; } = new LocalizedStrings();
public static string BotMention { get; set; } = ""; public static string BotMention { get; set; } = "";
public static bool Ready { get; set; } = false; public static bool Ready { get; set; } = false;
public static bool IsBot { get; set; } = false;
private static Channel OwnerPrivateChannel { get; set; } private static Channel OwnerPrivateChannel { get; set; }
@ -88,10 +87,10 @@ namespace NadekoBot
} }
//if password is not entered, prompt for password //if password is not entered, prompt for password
if (string.IsNullOrWhiteSpace(Creds.Password) && string.IsNullOrWhiteSpace(Creds.Token)) if (string.IsNullOrWhiteSpace(Creds.Token))
{ {
Console.WriteLine("Password blank. Please enter your password:\n"); Console.WriteLine("Token blank. Please enter your bot's token:\n");
Creds.Password = Console.ReadLine(); Creds.Token = Console.ReadLine();
} }
Console.WriteLine(string.IsNullOrWhiteSpace(Creds.GoogleAPIKey) Console.WriteLine(string.IsNullOrWhiteSpace(Creds.GoogleAPIKey)
@ -159,8 +158,8 @@ namespace NadekoBot
})); }));
//install modules //install modules
modules.Add(new AdministrationModule(), "Administration", ModuleFilter.None);
modules.Add(new HelpModule(), "Help", ModuleFilter.None); modules.Add(new HelpModule(), "Help", ModuleFilter.None);
modules.Add(new AdministrationModule(), "Administration", ModuleFilter.None);
modules.Add(new PermissionModule(), "Permissions", ModuleFilter.None); modules.Add(new PermissionModule(), "Permissions", ModuleFilter.None);
modules.Add(new Conversations(), "Conversations", ModuleFilter.None); modules.Add(new Conversations(), "Conversations", ModuleFilter.None);
modules.Add(new GamblingModule(), "Gambling", ModuleFilter.None); modules.Add(new GamblingModule(), "Gambling", ModuleFilter.None);
@ -181,20 +180,11 @@ namespace NadekoBot
Client.ExecuteAndWait(async () => Client.ExecuteAndWait(async () =>
{ {
try try
{
if (string.IsNullOrWhiteSpace(Creds.Token))
await Client.Connect(Creds.Username, Creds.Password).ConfigureAwait(false);
else
{ {
await Client.Connect(Creds.Token).ConfigureAwait(false); await Client.Connect(Creds.Token).ConfigureAwait(false);
IsBot = true;
}
} }
catch (Exception ex) catch (Exception ex)
{ {
if (string.IsNullOrWhiteSpace(Creds.Token))
Console.WriteLine($"Probably wrong EMAIL or PASSWORD.");
else
Console.WriteLine($"Token is wrong. Don't set a token if you don't have an official BOT account."); Console.WriteLine($"Token is wrong. Don't set a token if you don't have an official BOT account.");
Console.WriteLine(ex); Console.WriteLine(ex);
Console.ReadKey(); Console.ReadKey();
@ -253,31 +243,13 @@ namespace NadekoBot
if (ConfigHandler.IsBlackListed(e)) if (ConfigHandler.IsBlackListed(e))
return; return;
if (!NadekoBot.Config.DontJoinServers && !IsBot)
{
try
{
await (await Client.GetInvite(e.Message.Text).ConfigureAwait(false)).Accept().ConfigureAwait(false);
await e.Channel.SendMessage("I got in!").ConfigureAwait(false);
return;
}
catch
{
if (e.User.Id == 109338686889476096)
{ //carbonitex invite
await e.Channel.SendMessage("Failed to join the server.").ConfigureAwait(false);
return;
}
}
}
if (Config.ForwardMessages && !NadekoBot.Creds.OwnerIds.Contains(e.User.Id) && OwnerPrivateChannel != null) if (Config.ForwardMessages && !NadekoBot.Creds.OwnerIds.Contains(e.User.Id) && OwnerPrivateChannel != null)
await OwnerPrivateChannel.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```").ConfigureAwait(false); await OwnerPrivateChannel.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```").ConfigureAwait(false);
if (repliedRecently) return; if (repliedRecently) return;
repliedRecently = true; repliedRecently = true;
if (e.Message.RawText != "-h") if (e.Message.RawText != NadekoBot.Config.CommandPrefixes.Help + "h")
await e.Channel.SendMessage(HelpCommand.DMHelpString).ConfigureAwait(false); await e.Channel.SendMessage(HelpCommand.DMHelpString).ConfigureAwait(false);
await Task.Delay(2000).ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false);
repliedRecently = false; repliedRecently = false;

View File

@ -201,7 +201,6 @@
<Compile Include="Modules\Games\Commands\Trivia\TriviaGame.cs" /> <Compile Include="Modules\Games\Commands\Trivia\TriviaGame.cs" />
<Compile Include="Modules\Games\Commands\Trivia\TriviaQuestion.cs" /> <Compile Include="Modules\Games\Commands\Trivia\TriviaQuestion.cs" />
<Compile Include="Modules\Games\Commands\Trivia\TriviaQuestionPool.cs" /> <Compile Include="Modules\Games\Commands\Trivia\TriviaQuestionPool.cs" />
<Compile Include="Modules\Conversations\Commands\RequestsCommand.cs" />
<Compile Include="Modules\Administration\Commands\ServerGreetCommand.cs" /> <Compile Include="Modules\Administration\Commands\ServerGreetCommand.cs" />
<Compile Include="Modules\Games\Commands\SpeedTyping.cs" /> <Compile Include="Modules\Games\Commands\SpeedTyping.cs" />
<Compile Include="Modules\Gambling\Helpers\Cards.cs" /> <Compile Include="Modules\Gambling\Helpers\Cards.cs" />

View File

@ -1,4 +1,5 @@
using Discord; using Discord;
using NadekoBot.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -10,6 +11,7 @@ namespace NadekoBot.Classes.JSONModels
public bool DontJoinServers { get; set; } = false; public bool DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true; public bool ForwardMessages { get; set; } = true;
public bool IsRotatingStatus { get; set; } = false; public bool IsRotatingStatus { get; set; } = false;
public int BufferSize { get; set; } = 4.MiB();
[JsonIgnore] [JsonIgnore]
public List<Quote> Quotes { get; set; } = new List<Quote>(); public List<Quote> Quotes { get; set; } = new List<Quote>();
@ -131,6 +133,17 @@ namespace NadekoBot.Classes.JSONModels
public string CurrencySign { get; set; } = "🌸"; public string CurrencySign { get; set; } = "🌸";
public string CurrencyName { get; set; } = "NadekoFlower"; public string CurrencyName { get; set; } = "NadekoFlower";
public string DMHelpString { get; set; } = "Type `-h` for help."; public string DMHelpString { get; set; } = "Type `-h` for help.";
public string HelpString { get; set; } = @"You can use `{0}modules` command to see a list of all modules.
You can use `{0}commands ModuleName`
(for example `{0}commands Administration`) to see a list of all of the commands in that module.
For a specific command help, use `{0}h ""Command name""` (for example `-h ""!m q""`)
**LIST OF COMMANDS CAN BE FOUND ON THIS LINK**
<https://github.com/Kwoth/NadekoBot/blob/master/commandlist.md>
Nadeko Support Server: <https://discord.gg/0ehQwTK2RBjAxzEY>";
} }
public class CommandPrefixesModel public class CommandPrefixesModel

View File

@ -6,17 +6,16 @@ namespace NadekoBot.Classes.JSONModels
{ {
public class Credentials public class Credentials
{ {
public string Username = "myemail@email.com"; public string Token { get; set; } = "";
public string Password = "xxxxxxx"; public string ClientId { get; set; } = "116275390695079945";
public string Token = ""; public ulong BotId { get; set; } = 1231231231231;
public ulong BotId = 1231231231231; public ulong[] OwnerIds { get; set; } = { 123123123123, 5675675679845 };
public string GoogleAPIKey = ""; public string GoogleAPIKey { get; set; } = "";
public ulong[] OwnerIds = { 123123123123, 5675675679845 }; public string SoundCloudClientID { get; set; } = "";
public string TrelloAppKey = ""; public string MashapeKey { get; set; } = "";
public string SoundCloudClientID = ""; public string LOLAPIKey { get; set; } = "";
public string MashapeKey = ""; public string TrelloAppKey { get; set; } = "";
public string LOLAPIKey = ""; public string CarbonKey { get; set; } = "";
public string CarbonKey = "";
} }
[DebuggerDisplay("{items[0].id.playlistId}")] [DebuggerDisplay("{items[0].id.playlistId}")]
public class YoutubePlaylistSearch public class YoutubePlaylistSearch

View File

@ -1,16 +1,15 @@
{ {
"Username": "myemail@email.com",
"Password": "xxxxxxx",
"Token": "", "Token": "",
"ClientId": "116275390695079945",
"BotId": 1231231231231, "BotId": 1231231231231,
"GoogleAPIKey": "",
"OwnerIds": [ "OwnerIds": [
123123123123, 123123123123,
5675675679845 5675675679845
], ],
"TrelloAppKey": "", "GoogleAPIKey": "",
"SoundCloudClientID": "", "SoundCloudClientID": "",
"MashapeKey": "", "MashapeKey": "",
"LOLAPIKey": "", "LOLAPIKey": "",
"TrelloAppKey": "",
"CarbonKey": "" "CarbonKey": ""
} }

View File

@ -2,6 +2,7 @@
"DontJoinServers": false, "DontJoinServers": false,
"ForwardMessages": true, "ForwardMessages": true,
"IsRotatingStatus": false, "IsRotatingStatus": false,
"BufferSize": 4194304,
"RemindMessageFormat": "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗", "RemindMessageFormat": "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗",
"CustomReactions": { "CustomReactions": {
"\\o\\": [ "\\o\\": [
@ -120,5 +121,6 @@
], ],
"CurrencySign": "🌸", "CurrencySign": "🌸",
"CurrencyName": "NadekoFlower", "CurrencyName": "NadekoFlower",
"DMHelpString": "Type `-h` for help." "DMHelpString": "Type `-h` for help.",
"HelpString": "You can use `{0}modules` command to see a list of all modules.\r\nYou can use `{0}commands ModuleName`\r\n(for example `{0}commands Administration`) to see a list of all of the commands in that module.\r\nFor a specific command help, use `{0}h \"Command name\"` (for example `-h \"!m q\"`)\r\n\r\n\r\n**LIST OF COMMANDS CAN BE FOUND ON THIS LINK**\r\n<https://github.com/Kwoth/NadekoBot/blob/master/commandlist.md>\r\n\r\n\r\nNadeko Support Server: <https://discord.gg/0ehQwTK2RBjAxzEY>"
} }