commit
fb3b311e43
@ -6,9 +6,7 @@ using NadekoBot.DataModels;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Administration.Commands;
|
||||
using NadekoBot.Modules.Permissions.Classes;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -37,7 +35,7 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
public override void Install(ModuleManager manager)
|
||||
{
|
||||
|
||||
|
||||
manager.CreateCommands("", cgb =>
|
||||
{
|
||||
|
||||
@ -58,7 +56,7 @@ namespace NadekoBot.Modules.Administration
|
||||
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")
|
||||
.Parameter("user_name", ParameterType.Required)
|
||||
.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")
|
||||
.Parameter("user_name", ParameterType.Required)
|
||||
.Parameter("role_name", ParameterType.Unparsed)
|
||||
@ -138,8 +136,8 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "renr")
|
||||
.Alias(Prefix + "renamerole")
|
||||
cgb.CreateCommand(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`")
|
||||
.Parameter("r1", ParameterType.Required)
|
||||
.Parameter("r2", ParameterType.Required)
|
||||
@ -152,7 +150,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var roleToEdit = e.Server.FindRoles(r1).FirstOrDefault();
|
||||
if (roleToEdit == null)
|
||||
{
|
||||
await e.Channel.SendMessage("Can't find that role.");
|
||||
await e.Channel.SendMessage("Can't find that role.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,19 +158,19 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
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;
|
||||
}
|
||||
await roleToEdit.Edit(r2);
|
||||
await e.Channel.SendMessage("Role renamed.");
|
||||
await e.Channel.SendMessage("Role renamed.").ConfigureAwait(false);
|
||||
}
|
||||
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")
|
||||
.Parameter("user_name", ParameterType.Unparsed)
|
||||
.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`")
|
||||
.Parameter("role_name", ParameterType.Unparsed)
|
||||
.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);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "b").Alias(Prefix + "ban")
|
||||
cgb.CreateCommand(Prefix + "ban").Alias(Prefix + "b")
|
||||
.Parameter("user", ParameterType.Required)
|
||||
.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.")
|
||||
@ -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("msg", ParameterType.Unparsed)
|
||||
.Description("Kicks a mentioned user.")
|
||||
@ -428,7 +462,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "undeafen")
|
||||
.Alias(Prefix + "undeaf")
|
||||
.Alias(Prefix + "undef")
|
||||
.Description("Undeafens mentioned user or users")
|
||||
.Parameter("throwaway", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
@ -454,8 +488,9 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "rvch")
|
||||
.Description("Removes a voice channel with a given name.")
|
||||
cgb.CreateCommand(Prefix + "delvoichanl")
|
||||
.Alias(Prefix + "dvch")
|
||||
.Description("Deletes a voice channel with a given name.")
|
||||
.Parameter("channel_name", ParameterType.Required)
|
||||
.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.")
|
||||
.Parameter("channel_name", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
@ -495,8 +531,9 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "rch").Alias(Prefix + "rtch")
|
||||
.Description("Removes a text channel with a given name.")
|
||||
cgb.CreateCommand(Prefix + "deltxtchanl")
|
||||
.Alias(Prefix + "dtch")
|
||||
.Description("Deletes a text channel with a given name.")
|
||||
.Parameter("channel_name", ParameterType.Required)
|
||||
.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.")
|
||||
.Parameter("channel_name", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
@ -535,8 +573,8 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "st").Alias(Prefix + "settopic")
|
||||
.Alias(Prefix + "topic")
|
||||
cgb.CreateCommand(Prefix + "settopic")
|
||||
.Alias(Prefix + "st")
|
||||
.Description($"Sets a topic on the current channel.\n**Usage**: `{Prefix}st My new topic`")
|
||||
.AddCheck(SimpleCheckers.ManageChannels())
|
||||
.Parameter("topic", ParameterType.Unparsed)
|
||||
@ -547,8 +585,8 @@ namespace NadekoBot.Modules.Administration
|
||||
await e.Channel.SendMessage(":ok: **New channel topic set.**").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "schn").Alias(Prefix + "setchannelname")
|
||||
.Alias(Prefix + "topic")
|
||||
cgb.CreateCommand(Prefix + "setchanlname")
|
||||
.Alias(Prefix + "schn")
|
||||
.Description("Changed the name of the current channel.")
|
||||
.AddCheck(SimpleCheckers.ManageChannels())
|
||||
.Parameter("name", ParameterType.Unparsed)
|
||||
@ -561,7 +599,7 @@ namespace NadekoBot.Modules.Administration
|
||||
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.")
|
||||
.Parameter("user", ParameterType.Unparsed)
|
||||
.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);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "cid").Alias(Prefix + "channelid")
|
||||
cgb.CreateCommand(Prefix + "channelid").Alias(Prefix + "cid")
|
||||
.Description("Shows current channel ID.")
|
||||
.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.")
|
||||
.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")
|
||||
.Description("Shows allocated memory - **Owner Only!**")
|
||||
.Description("Shows allocated memory - **Bot Owner Only!**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -605,7 +643,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "prune")
|
||||
.Alias(".clr")
|
||||
.Alias(Prefix + "clr")
|
||||
.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`")
|
||||
.Parameter("user_or_num", ParameterType.Optional)
|
||||
@ -675,8 +713,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "die")
|
||||
.Alias(Prefix + "graceful")
|
||||
.Description("Shuts the bot down and notifies users about the restart. **Owner Only!**")
|
||||
.Description("Shuts the bot down and notifies users about the restart. **Bot Owner Only!**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -685,33 +722,21 @@ namespace NadekoBot.Modules.Administration
|
||||
Environment.Exit(0);
|
||||
});
|
||||
|
||||
//cgb.CreateCommand(Prefix + "newnick")
|
||||
// .Alias(Prefix + "setnick")
|
||||
// .Description("Give the bot a new nickname. You need manage server permissions.")
|
||||
// .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!**")
|
||||
cgb.CreateCommand(Prefix + "setname")
|
||||
.Alias(Prefix + "newnm")
|
||||
.Description("Give the bot a new name. **Bot Owner Only!**")
|
||||
.Parameter("new_name", ParameterType.Unparsed)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
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")
|
||||
.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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
@ -722,7 +747,7 @@ namespace NadekoBot.Modules.Administration
|
||||
var avatarAddress = e.GetArg("img");
|
||||
var imageStream = await SearchHelper.GetResponseStreamAsync(avatarAddress).ConfigureAwait(false);
|
||||
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.
|
||||
await e.Channel.SendMessage("New avatar set.").ConfigureAwait(false);
|
||||
@ -732,7 +757,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "setgame")
|
||||
.Description("Sets the bots game. **Owner Only!**")
|
||||
.Description("Sets the bots game. **Bot Owner Only!**")
|
||||
.Parameter("set_game", ParameterType.Unparsed)
|
||||
.Do(e =>
|
||||
{
|
||||
@ -759,23 +784,23 @@ namespace NadekoBot.Modules.Administration
|
||||
Channel commsChannel = null;
|
||||
|
||||
cgb.CreateCommand(Prefix + "commsuser")
|
||||
.Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel. **Owner Only!**")
|
||||
.Parameter("name", ParameterType.Unparsed)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
|
||||
if (commsUser != null)
|
||||
{
|
||||
commsChannel = null;
|
||||
await e.Channel.SendMessage("User for comms set.").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
await e.Channel.SendMessage("No server specified or user.").ConfigureAwait(false);
|
||||
});
|
||||
.Description("Sets a user for through-bot communication. Only works if server is set. Resets commschannel. **Bot Owner Only!**")
|
||||
.Parameter("name", ParameterType.Unparsed)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
|
||||
if (commsUser != null)
|
||||
{
|
||||
commsChannel = null;
|
||||
await e.Channel.SendMessage("User for comms set.").ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
await e.Channel.SendMessage("No server specified or user.").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
@ -788,7 +813,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
@ -804,7 +829,7 @@ namespace NadekoBot.Modules.Administration
|
||||
});
|
||||
|
||||
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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.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);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "menrole")
|
||||
.Alias(Prefix + "mentionrole")
|
||||
cgb.CreateCommand(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.")
|
||||
.Parameter("roles", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
@ -880,23 +905,8 @@ namespace NadekoBot.Modules.Administration
|
||||
}).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")
|
||||
.Description("Clears the message queue. **Owner Only!**")
|
||||
.Description("Clears the message queue. **Bot Owner Only!**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(e =>
|
||||
{
|
||||
@ -917,9 +927,7 @@ namespace NadekoBot.Modules.Administration
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER
|
||||
cgb.CreateCommand(Prefix + "adddon")
|
||||
.Alias(Prefix + "donadd")
|
||||
cgb.CreateCommand(Prefix + "donadd")
|
||||
.Description("Add a donator to the database.")
|
||||
.Parameter("donator")
|
||||
.Parameter("amount")
|
||||
@ -939,46 +947,24 @@ namespace NadekoBot.Modules.Administration
|
||||
UserName = donator.Name,
|
||||
UserId = (long)donator.Id
|
||||
});
|
||||
e.Channel.SendMessage("Successfuly added a new donator. 👑");
|
||||
e.Channel.SendMessage("Successfuly added a new donator. 👑").ConfigureAwait(false);
|
||||
}
|
||||
catch { }
|
||||
}).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")
|
||||
.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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
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")
|
||||
@ -997,9 +983,9 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
int i = 0;
|
||||
if (arr.Length == 0)
|
||||
await e.Channel.SendMessage("Nobody. (not 100% sure)");
|
||||
await e.Channel.SendMessage("Nobody. (not 100% sure)").ConfigureAwait(false);
|
||||
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")
|
||||
@ -1013,25 +999,11 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
return;
|
||||
}
|
||||
await srvr.Leave();
|
||||
await e.Channel.SendMessage("`Done.`");
|
||||
await srvr.Leave().ConfigureAwait(false);
|
||||
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 { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
{
|
||||
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;
|
||||
}
|
||||
var r = e.GetArg("role")?.Trim();
|
||||
@ -52,19 +52,19 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
{
|
||||
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;
|
||||
}
|
||||
var role = e.Server.FindRoles(r).FirstOrDefault();
|
||||
|
||||
if (role == null)
|
||||
{
|
||||
await e.Channel.SendMessage("💢 `Role not found.`");
|
||||
await e.Channel.SendMessage("💢 `Role not found.`").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
config.AutoAssignedRole = role.Id;
|
||||
await e.Channel.SendMessage("`Auto assigned role is set.`");
|
||||
await e.Channel.SendMessage("`Auto assigned role is set.`").ConfigureAwait(false);
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
{
|
||||
var Prefix = Module.Prefix;
|
||||
|
||||
cgb.CreateCommand(Prefix + "addcustomreaction")
|
||||
cgb.CreateCommand(Prefix + "addcustreact")
|
||||
.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())
|
||||
.Parameter("name", ParameterType.Required)
|
||||
.Parameter("message", ParameterType.Unparsed)
|
||||
@ -38,12 +38,12 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
NadekoBot.Config.CustomReactions[name].Add(message);
|
||||
else
|
||||
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);
|
||||
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "listcustomreactions")
|
||||
cgb.CreateCommand(Prefix + "listcustreact")
|
||||
.Alias(Prefix + "lcr")
|
||||
.Description($"Lists all current custom reactions (paginated with 5 commands per page).\n**Usage**:{Prefix}lcr 1")
|
||||
.Parameter("num", ParameterType.Required)
|
||||
@ -52,10 +52,10 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
int num;
|
||||
if (!int.TryParse(e.GetArg("num"), out num) || num <= 0) return;
|
||||
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")
|
||||
.Description("Deletes a custom reaction with given name (and index)")
|
||||
.Parameter("name", ParameterType.Required)
|
||||
@ -68,7 +68,7 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
return;
|
||||
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;
|
||||
}
|
||||
string message = "";
|
||||
@ -94,8 +94,8 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
NadekoBot.Config.CustomReactions.Remove(name);
|
||||
message = $"Deleted custom reaction: `{name}`";
|
||||
}
|
||||
await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig());
|
||||
await e.Channel.SendMessage(message);
|
||||
await Task.Run(() => Classes.JSONModels.ConfigHandler.SaveConfig()).ConfigureAwait(false);
|
||||
await e.Channel.SendMessage(message).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "sinfo")
|
||||
.Alias(Module.Prefix + "serverinfo")
|
||||
cgb.CreateCommand(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")
|
||||
.Parameter("server", ParameterType.Optional)
|
||||
.Do(async e =>
|
||||
@ -47,8 +47,8 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "cinfo")
|
||||
.Alias(Module.Prefix + "channelinfo")
|
||||
cgb.CreateCommand(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")
|
||||
.Parameter("channel", ParameterType.Optional)
|
||||
.Do(async e =>
|
||||
@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "uinfo")
|
||||
.Alias(Module.Prefix + "userinfo")
|
||||
cgb.CreateCommand(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")
|
||||
.Parameter("user", ParameterType.Optional)
|
||||
.Do(async e =>
|
||||
|
@ -328,14 +328,13 @@ $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
|
||||
});
|
||||
|
||||
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.ManageServer())
|
||||
.Do(DoFunc());
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "userpresence")
|
||||
.Description("Starts logging to this channel when someone from the server goes online/offline/idle. **Owner Only!**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Description("Starts logging to this channel when someone from the server goes online/offline/idle.")
|
||||
.AddCheck(SimpleCheckers.ManageServer())
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -351,9 +350,8 @@ $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
|
||||
});
|
||||
|
||||
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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.AddCheck(SimpleCheckers.ManageServer())
|
||||
.Do(async e =>
|
||||
{
|
||||
|
@ -85,10 +85,12 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
// if both null, disable
|
||||
if (string.IsNullOrWhiteSpace(msg) && string.IsNullOrWhiteSpace(minutesStr))
|
||||
{
|
||||
await e.Channel.SendMessage("Repeating disabled").ConfigureAwait(false);
|
||||
|
||||
Repeater rep;
|
||||
if (repeaters.TryRemove(e.Server, out rep))
|
||||
rep.MessageTimer.Stop();
|
||||
if (!repeaters.TryRemove(e.Server, out rep))
|
||||
return;
|
||||
rep.MessageTimer.Stop();
|
||||
await e.Channel.SendMessage("Repeating disabled").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
int minutes;
|
||||
|
@ -42,15 +42,9 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "slowmode")
|
||||
.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())
|
||||
.Do(async e =>
|
||||
{
|
||||
//var minutesStr = e.GetArg("minutes");
|
||||
//if (string.IsNullOrWhiteSpace(minutesStr)) {
|
||||
// RatelimitingChannels.Remove(e.Channel.Id);
|
||||
// return;
|
||||
//}
|
||||
ConcurrentDictionary<ulong, DateTime> throwaway;
|
||||
if (RatelimitingChannels.TryRemove(e.Channel.Id, out throwaway))
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
cgb.CreateCommand(Module.Prefix + "remindmsg")
|
||||
.Description("Sets message for when the remind is triggered. " +
|
||||
" 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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
|
@ -121,19 +121,26 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
await e.Channel.SendMessage($":anger:You already have {role.Name} role.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
await e.User.AddRoles(role).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
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);
|
||||
await Task.Delay(3000);
|
||||
await msg.Delete();
|
||||
try
|
||||
{
|
||||
await e.Message.Delete();
|
||||
await e.Message.Delete().ConfigureAwait(false);
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "iamn")
|
||||
.Alias(Module.Prefix + "iamnot")
|
||||
cgb.CreateCommand(Module.Prefix + "iamnot")
|
||||
.Alias(Module.Prefix + "iamn")
|
||||
.Description("Removes a role to you that you choose. " +
|
||||
"Role must be on a list of self-assignable roles." +
|
||||
"\n**Usage**: .iamn Gamer")
|
||||
|
@ -1,11 +1,7 @@
|
||||
using NadekoBot.Classes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Modules.Permissions.Classes;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Modules.Administration.Commands
|
||||
{
|
||||
@ -18,14 +14,14 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.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) ??
|
||||
NadekoBot.Client.FindServers(arg.Trim()).FirstOrDefault();
|
||||
NadekoBot.Client.FindServers(arg).FirstOrDefault();
|
||||
if (server == null)
|
||||
{
|
||||
await e.Channel.SendMessage("Cannot find that server").ConfigureAwait(false);
|
||||
@ -33,13 +29,13 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
}
|
||||
if (!server.IsOwner)
|
||||
{
|
||||
await server.Leave();
|
||||
await server.Leave().ConfigureAwait(false);
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
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.**")
|
||||
.AddCheck(SimpleCheckers.CanManageRoles)
|
||||
.AddCheck(SimpleCheckers.ManageChannels())
|
||||
@ -116,8 +117,8 @@ namespace NadekoBot.Modules.Administration.Commands
|
||||
await e.Channel.SendMessage("`Done.`");
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "v+t")
|
||||
.Alias(Module.Prefix + "voice+text")
|
||||
cgb.CreateCommand(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." +
|
||||
"If you are server owner, keep in mind you will see them all the time regardless.")
|
||||
.AddCheck(SimpleCheckers.ManageChannels())
|
||||
|
@ -75,8 +75,8 @@ namespace NadekoBot.Modules.ClashOfClans
|
||||
//war with the index X started.
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "sw")
|
||||
.Alias(Prefix + "startwar")
|
||||
cgb.CreateCommand(Prefix + "startwar")
|
||||
.Alias(Prefix + "sw")
|
||||
.Description("Starts a war with a given number.")
|
||||
.Parameter("number", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
@ -177,8 +177,8 @@ namespace NadekoBot.Modules.ClashOfClans
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "cf")
|
||||
.Alias(Prefix + "claimfinish")
|
||||
cgb.CreateCommand(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]")
|
||||
.Parameter("number", ParameterType.Required)
|
||||
.Parameter("other_name", ParameterType.Unparsed)
|
||||
|
@ -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) { }
|
||||
}
|
||||
}
|
@ -39,7 +39,8 @@ namespace NadekoBot.Modules.Conversations.Commands
|
||||
file = RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year"))
|
||||
? null
|
||||
: e.GetArg("year"));
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var avatar = await GetAvatar(usr.AvatarUrl);
|
||||
text = usr.Name;
|
||||
@ -63,16 +64,13 @@ namespace NadekoBot.Modules.Conversations.Commands
|
||||
public Stream RipUser(string name, Image avatar, string year = null)
|
||||
{
|
||||
var bm = Resources.rip;
|
||||
var offset = name.Length * 2;
|
||||
var fontSize = 20;
|
||||
if (name.Length > 10)
|
||||
{
|
||||
fontSize -= (name.Length - 10) / 2;
|
||||
}
|
||||
|
||||
//TODO use measure string
|
||||
int width = 300;
|
||||
var fontSize = width / name.Length -2;
|
||||
if (fontSize > 20) fontSize = 20;
|
||||
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.DrawImage(avatar, 80, 135);
|
||||
@ -86,19 +84,14 @@ namespace NadekoBot.Modules.Conversations.Commands
|
||||
public Stream RipName(string name, string year = null)
|
||||
{
|
||||
var bm = Resources.rip;
|
||||
|
||||
int width = 190;
|
||||
var offset = name.Length * 5;
|
||||
|
||||
var fontSize = 20;
|
||||
|
||||
if (name.Length > 10)
|
||||
{
|
||||
fontSize -= (name.Length - 10) / 2;
|
||||
}
|
||||
|
||||
//TODO use measure string
|
||||
var fontSize = width / name.Length;
|
||||
if (fontSize > 20) fontSize = 20;
|
||||
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.Flush();
|
||||
g.Dispose();
|
||||
|
@ -4,18 +4,13 @@ using Discord.Modules;
|
||||
using NadekoBot.Classes.Conversations.Commands;
|
||||
using NadekoBot.DataModels;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Classes;
|
||||
using System.Drawing.Drawing2D;
|
||||
using NadekoBot.Modules.Conversations.Commands;
|
||||
using NadekoBot.Modules.Permissions.Classes;
|
||||
using NadekoBot.Properties;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Modules.Conversations.Commands;
|
||||
|
||||
namespace NadekoBot.Modules.Conversations
|
||||
{
|
||||
@ -25,7 +20,6 @@ namespace NadekoBot.Modules.Conversations
|
||||
public Conversations()
|
||||
{
|
||||
commands.Add(new CopyCommand(this));
|
||||
commands.Add(new RequestsCommand(this));
|
||||
commands.Add(new RipCommand(this));
|
||||
}
|
||||
|
||||
@ -188,32 +182,6 @@ namespace NadekoBot.Modules.Conversations
|
||||
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")
|
||||
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
|
||||
.Do(async e =>
|
||||
@ -306,7 +274,7 @@ namespace NadekoBot.Modules.Conversations
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static Func<CommandEventArgs, Task> SayYes()
|
||||
=> async e => await e.Channel.SendMessage("Yes. :)").ConfigureAwait(false);
|
||||
}
|
||||
|
@ -5,34 +5,42 @@ using NadekoBot.Modules.Permissions.Classes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Modules.CustomReactions
|
||||
{
|
||||
class CustomReactionsModule : DiscordModule
|
||||
internal class CustomReactionsModule : DiscordModule
|
||||
{
|
||||
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()
|
||||
{
|
||||
commandFuncs = new Dictionary<string, Func<CommandEventArgs, string>>
|
||||
commandFuncs = new Dictionary<Regex, Func<CommandEventArgs, Match, string>>
|
||||
{
|
||||
{"%rng%", (e) => rng.Next().ToString()},
|
||||
{"%mention%", (e) => NadekoBot.BotMention },
|
||||
{"%user%", e => e.User.Mention },
|
||||
{"%target%", e => e.GetArg("args")?.Trim() ?? "" },
|
||||
{new Regex(@"(?:%rng%|%rng:(\d{1,9})-(\d{1,9})%)"), (e,m) => {
|
||||
int start, end;
|
||||
if (m.Groups[1].Success)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
manager.CreateCommands("", cgb =>
|
||||
{
|
||||
|
||||
cgb.AddCheck(PermissionChecker.Instance);
|
||||
|
||||
foreach (var command in NadekoBot.Config.CustomReactions)
|
||||
@ -47,11 +55,12 @@ namespace NadekoBot.Modules.CustomReactions
|
||||
.Do(async e =>
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
});
|
||||
|
||||
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())
|
||||
.Parameter("amount", ParameterType.Required)
|
||||
.Parameter("receiver", ParameterType.Unparsed)
|
||||
@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
});
|
||||
|
||||
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())
|
||||
.Parameter("amount", ParameterType.Required)
|
||||
.Parameter("rektperson", ParameterType.Unparsed)
|
||||
|
@ -28,15 +28,14 @@ namespace NadekoBot.Classes.Help.Commands
|
||||
await e.Channel.SendMessage($"`Help for '{com.Text}':` {com.Description}").ConfigureAwait(false);
|
||||
}).ConfigureAwait(false);
|
||||
};
|
||||
public static string HelpString => (NadekoBot.IsBot
|
||||
? $"To add me to your server, use this link -> <https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303>\n"
|
||||
: $"To invite me to your server, just send me an invite link here.") +
|
||||
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}modules` command to see a list of all modules.\n" +
|
||||
$"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" +
|
||||
$"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 HelpString {
|
||||
get {
|
||||
var str = string.IsNullOrWhiteSpace(NadekoBot.Creds.ClientId) && !NadekoBot.Config.DontJoinServers
|
||||
? 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)
|
||||
: "";
|
||||
return str + String.Format(NadekoBot.Config.HelpString, NadekoBot.Config.CommandPrefixes.Help);
|
||||
}
|
||||
}
|
||||
|
||||
public static string DMHelpString => NadekoBot.Config.DMHelpString;
|
||||
|
||||
@ -79,7 +78,7 @@ Version: `{NadekoStats.Instance.BotVersion}`";
|
||||
.Parameter("command", ParameterType.Unparsed)
|
||||
.Do(HelpFunc());
|
||||
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())
|
||||
.Do(DoGitFunc());
|
||||
cgb.CreateCommand(Module.Prefix + "readme")
|
||||
|
@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Help
|
||||
.Description("List all bot modules.")
|
||||
.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);
|
||||
});
|
||||
|
||||
@ -41,16 +41,27 @@ namespace NadekoBot.Modules.Help
|
||||
.Parameter("module", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
var module = e.GetArg("module")?.Trim().ToLower();
|
||||
if (string.IsNullOrWhiteSpace(module))
|
||||
return;
|
||||
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();
|
||||
if (!cmdsArray.Any())
|
||||
{
|
||||
await e.Channel.SendMessage("That module does not exist.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
await e.Channel.SendMessage("`List of commands:` \n• " + string.Join("\n• ", cmdsArray.Select(c => c.Text)))
|
||||
.ConfigureAwait(false);
|
||||
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);
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
$"**【 {SongInfo.Title.TrimTo(55)} 】**`{(SongInfo.Provider ?? "-")}`";
|
||||
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;
|
||||
public MusicPlayer MusicPlayer { get; set; }
|
||||
|
@ -23,22 +23,6 @@ namespace NadekoBot.Modules.Music
|
||||
|
||||
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;
|
||||
@ -54,8 +38,8 @@ namespace NadekoBot.Modules.Music
|
||||
|
||||
commands.ForEach(cmd => cmd.Init(cgb));
|
||||
|
||||
cgb.CreateCommand("n")
|
||||
.Alias("next")
|
||||
cgb.CreateCommand("next")
|
||||
.Alias("n")
|
||||
.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`")
|
||||
.Do(e =>
|
||||
@ -66,8 +50,8 @@ namespace NadekoBot.Modules.Music
|
||||
musicPlayer.Next();
|
||||
});
|
||||
|
||||
cgb.CreateCommand("s")
|
||||
.Alias("stop")
|
||||
cgb.CreateCommand("stop")
|
||||
.Alias("s")
|
||||
.Description("Stops the music and clears the playlist. Stays in the channel.\n**Usage**: `!m s`")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -80,8 +64,8 @@ namespace NadekoBot.Modules.Music
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("d")
|
||||
.Alias("destroy")
|
||||
cgb.CreateCommand("destroy")
|
||||
.Alias("d")
|
||||
.Description("Completely stops the music and unbinds the bot from the channel. " +
|
||||
"(may cause weird behaviour)\n**Usage**: `!m d`")
|
||||
.Do(async e =>
|
||||
@ -95,8 +79,8 @@ namespace NadekoBot.Modules.Music
|
||||
}).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("p")
|
||||
.Alias("pause")
|
||||
cgb.CreateCommand("pause")
|
||||
.Alias("p")
|
||||
.Description("Pauses or Unpauses the song.\n**Usage**: `!m p`")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -111,7 +95,8 @@ namespace NadekoBot.Modules.Music
|
||||
await e.Channel.SendMessage("🎵`Music Player unpaused.`").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("q")
|
||||
cgb.CreateCommand("queue")
|
||||
.Alias("q")
|
||||
.Alias("yq")
|
||||
.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`")
|
||||
@ -126,9 +111,10 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand("lq")
|
||||
.Alias("ls").Alias("lp")
|
||||
cgb.CreateCommand("listqueue")
|
||||
.Alias("lq")
|
||||
.Description("Lists up to 15 currently queued songs.\n**Usage**: `!m lq`")
|
||||
.Parameter("page", ParameterType.Optional)
|
||||
.Do(async e =>
|
||||
{
|
||||
MusicPlayer musicPlayer;
|
||||
@ -137,6 +123,13 @@ namespace NadekoBot.Modules.Music
|
||||
await e.Channel.SendMessage("🎵 No active music player.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
int page;
|
||||
if (!int.TryParse(e.GetArg("page"), out page) || page <= 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
|
||||
var currentSong = musicPlayer.CurrentSong;
|
||||
if (currentSong == null)
|
||||
return;
|
||||
@ -145,17 +138,19 @@ namespace NadekoBot.Modules.Music
|
||||
toSend += "🔂";
|
||||
else if (musicPlayer.RepeatPlaylist)
|
||||
toSend += "🔁";
|
||||
toSend += $" **{musicPlayer.Playlist.Count}** `tracks currently queued.` ";
|
||||
toSend += $" **{musicPlayer.Playlist.Count}** `tracks currently queued. Showing page {page}` ";
|
||||
if (musicPlayer.Playlist.Count >= MusicPlayer.MaximumPlaylistSize)
|
||||
toSend += "**Song queue is full!**\n";
|
||||
else
|
||||
toSend += "\n";
|
||||
var number = 1;
|
||||
await e.Channel.SendMessage(toSend + string.Join("\n", musicPlayer.Playlist.Take(15).Select(v => $"`{number++}.` {v.PrettyName}"))).ConfigureAwait(false);
|
||||
const int itemsPerPage = 15;
|
||||
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")
|
||||
.Alias("playing")
|
||||
cgb.CreateCommand("nowplaying")
|
||||
.Alias("np")
|
||||
.Description("Shows the song currently playing.\n**Usage**: `!m np`")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -169,7 +164,8 @@ namespace NadekoBot.Modules.Music
|
||||
$"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("vol")
|
||||
cgb.CreateCommand("volume")
|
||||
.Alias("vol")
|
||||
.Description("Sets the music volume 0-100%\n**Usage**: `!m vol 50`")
|
||||
.Parameter("val", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
@ -190,8 +186,8 @@ namespace NadekoBot.Modules.Music
|
||||
await e.Channel.SendMessage($"🎵 `Volume set to {volume}%`").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("dv")
|
||||
.Alias("defvol")
|
||||
cgb.CreateCommand("defvol")
|
||||
.Alias("dv")
|
||||
.Description("Sets the default music volume when music playback is started (0-100)." +
|
||||
" Does not persist through restarts.\n**Usage**: `!m dv 80`")
|
||||
.Parameter("val", ParameterType.Required)
|
||||
@ -208,7 +204,7 @@ namespace NadekoBot.Modules.Music
|
||||
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`")
|
||||
.Do(e =>
|
||||
{
|
||||
@ -244,7 +240,8 @@ namespace NadekoBot.Modules.Music
|
||||
musicPlayer.SetVolume(50);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("sh")
|
||||
cgb.CreateCommand("shuffle")
|
||||
.Alias("sh")
|
||||
.Description("Shuffles the current playlist.\n**Usage**: `!m sh`")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -263,7 +260,8 @@ namespace NadekoBot.Modules.Music
|
||||
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`")
|
||||
.Parameter("playlist", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
@ -304,8 +302,9 @@ namespace NadekoBot.Modules.Music
|
||||
await msg.Edit("🎵 `Playlist queue complete.`").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("lopl")
|
||||
.Description("Queues all songs from a directory. **Owner Only!**\n**Usage**: `!m lopl C:/music/classical`")
|
||||
cgb.CreateCommand("localplaylst")
|
||||
.Alias("lopl")
|
||||
.Description("Queues all songs from a directory. **Bot Owner Only!**\n**Usage**: `!m lopl C:/music/classical`")
|
||||
.Parameter("directory", ParameterType.Unparsed)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
@ -344,8 +343,9 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand("lo")
|
||||
.Description("Queues a local file by specifying a full path. **Owner Only!**\n**Usage**: `!m lo C:/music/mysong.mp3`")
|
||||
cgb.CreateCommand("local")
|
||||
.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)
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.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);
|
||||
});
|
||||
|
||||
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`")
|
||||
.Do(e =>
|
||||
{
|
||||
@ -399,7 +400,7 @@ namespace NadekoBot.Modules.Music
|
||||
});
|
||||
|
||||
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())
|
||||
.Do(e =>
|
||||
{
|
||||
@ -416,8 +417,8 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand("rcs")
|
||||
.Alias("repeatcurrentsong")
|
||||
cgb.CreateCommand("reptcursong")
|
||||
.Alias("rcs")
|
||||
.Description("Toggles repeat of current song.\n**Usage**: `!m rcs`")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -434,8 +435,8 @@ namespace NadekoBot.Modules.Music
|
||||
.ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand("rpl")
|
||||
.Alias("repeatplaylist")
|
||||
cgb.CreateCommand("rpeatplaylst")
|
||||
.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`")
|
||||
.Do(async e =>
|
||||
{
|
||||
|
@ -51,8 +51,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "cfi")
|
||||
.Alias(Module.Prefix + "channelfilterinvites")
|
||||
cgb.CreateCommand(Module.Prefix + "chnlfilterinv")
|
||||
.Alias(Module.Prefix + "cfi")
|
||||
.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." +
|
||||
"\n**Usage**: ;cfi enable #general-chat")
|
||||
@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "sfi")
|
||||
.Alias(Module.Prefix + "serverfilterinvites")
|
||||
cgb.CreateCommand(Module.Prefix + "srvrfilterinv")
|
||||
.Alias(Module.Prefix + "sfi")
|
||||
.Description("Enables or disables automatic deleting of invites on the server.\n**Usage**: ;sfi disable")
|
||||
.Parameter("bool")
|
||||
.Do(async e =>
|
||||
|
@ -49,8 +49,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "cfw")
|
||||
.Alias(Module.Prefix + "channelfilterwords")
|
||||
cgb.CreateCommand(Module.Prefix + "chnlfilterwords")
|
||||
.Alias(Module.Prefix + "cfw")
|
||||
.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." +
|
||||
"\n**Usage**: ;cfw enable #general-chat")
|
||||
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "afw")
|
||||
.Alias(Module.Prefix + "addfilteredword")
|
||||
cgb.CreateCommand(Module.Prefix + "addfilterword")
|
||||
.Alias(Module.Prefix + "afw")
|
||||
.Description("Adds a new word to the list of filtered words" +
|
||||
"\n**Usage**: ;afw poop")
|
||||
.Parameter("word", ParameterType.Unparsed)
|
||||
@ -108,8 +108,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "rfw")
|
||||
.Alias(Module.Prefix + "removefilteredword")
|
||||
cgb.CreateCommand(Module.Prefix + "rmvfilterword")
|
||||
.Alias(Module.Prefix + "rfw")
|
||||
.Description("Removes the word from the list of filtered words" +
|
||||
"\n**Usage**: ;rw poop")
|
||||
.Parameter("word", ParameterType.Unparsed)
|
||||
@ -130,8 +130,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "lfw")
|
||||
.Alias(Module.Prefix + "listfilteredwords")
|
||||
cgb.CreateCommand(Module.Prefix + "lstfilterwords")
|
||||
.Alias(Module.Prefix + "lfw")
|
||||
.Description("Shows a list of filtered words" +
|
||||
"\n**Usage**: ;lfw")
|
||||
.Do(async e =>
|
||||
@ -150,8 +150,8 @@ namespace NadekoBot.Modules.Permissions.Commands
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Module.Prefix + "sfw")
|
||||
.Alias(Module.Prefix + "serverfilterwords")
|
||||
cgb.CreateCommand(Module.Prefix + "srvrfilterwords")
|
||||
.Alias(Module.Prefix + "sfw")
|
||||
.Description("Enables or disables automatic deleting of messages containing forbidden words on the server.\n**Usage**: ;sfw disable")
|
||||
.Parameter("bool")
|
||||
.Do(async e =>
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "rpc")
|
||||
.Alias(Prefix + "rolepermissionscopy")
|
||||
cgb.CreateCommand(Prefix + "rolepermscopy")
|
||||
.Alias(Prefix + "rpc")
|
||||
.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)
|
||||
.Do(async e =>
|
||||
@ -86,8 +86,8 @@ namespace NadekoBot.Modules.Permissions
|
||||
await e.Channel.SendMessage($"💢{ex.Message}");
|
||||
}
|
||||
});
|
||||
cgb.CreateCommand(Prefix + "cpc")
|
||||
.Alias(Prefix + "channelpermissionscopy")
|
||||
cgb.CreateCommand(Prefix + "chnlpermscopy")
|
||||
.Alias(Prefix + "cpc")
|
||||
.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)
|
||||
.Do(async e =>
|
||||
@ -114,8 +114,8 @@ namespace NadekoBot.Modules.Permissions
|
||||
await e.Channel.SendMessage($"💢{ex.Message}");
|
||||
}
|
||||
});
|
||||
cgb.CreateCommand(Prefix + "upc")
|
||||
.Alias(Prefix + "userpermissionscopy")
|
||||
cgb.CreateCommand(Prefix + "usrpermscopy")
|
||||
.Alias(Prefix + "upc")
|
||||
.Description($"Copies BOT PERMISSIONS (not discord permissions) from one role to another.\n**Usage**:`{Prefix}upc @SomeUser ~ @SomeOtherUser`")
|
||||
.Parameter("from_to", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
@ -155,7 +155,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
await e.Channel.SendMessage($"Verbosity set to {val}.").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "serverperms")
|
||||
cgb.CreateCommand(Prefix + "srvrperms")
|
||||
.Alias(Prefix + "sp")
|
||||
.Description("Shows banned permissions for this server.")
|
||||
.Do(async e =>
|
||||
@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
await e.Channel.SendMessage(perms.ToString()).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "channelperms")
|
||||
cgb.CreateCommand(Prefix + "chnlperms")
|
||||
.Alias(Prefix + "cp")
|
||||
.Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev")
|
||||
.Parameter("channel", ParameterType.Unparsed)
|
||||
@ -241,7 +241,8 @@ namespace NadekoBot.Modules.Permissions
|
||||
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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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)
|
||||
.Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]")
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("channel", ParameterType.Unparsed)
|
||||
.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("bool", ParameterType.Required)
|
||||
.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("role", ParameterType.Unparsed)
|
||||
.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("bool", ParameterType.Required)
|
||||
.Parameter("channel", ParameterType.Unparsed)
|
||||
|
@ -194,8 +194,8 @@ namespace NadekoBot.Modules.Pokemon
|
||||
await e.Channel.SendMessage(response).ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "ml")
|
||||
.Alias("movelist")
|
||||
cgb.CreateCommand(Prefix + "movelist")
|
||||
.Alias(Prefix + "ml")
|
||||
.Description("Lists the moves you are able to use")
|
||||
.Do(async e =>
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Discord.Commands;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.Modules;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes.JSONModels;
|
||||
@ -27,7 +28,7 @@ namespace NadekoBot.Modules.Searches
|
||||
commands.Add(new StreamNotifications(this));
|
||||
commands.Add(new ConverterCommand(this));
|
||||
commands.Add(new RedditCommand(this));
|
||||
commands.Add(new WowJokeCommand(this));
|
||||
commands.Add(new WowJokeCommand(this));
|
||||
commands.Add(new CalcCommand(this));
|
||||
commands.Add(new WowJokeCommand(this));
|
||||
rng = new Random();
|
||||
@ -392,8 +393,8 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
await e.Channel.SendMessage("`" + JObject.Parse(response)["value"]["joke"].ToString() + "` 😆").ConfigureAwait(false);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "mi")
|
||||
.Alias(Prefix + "magicitem")
|
||||
cgb.CreateCommand(Prefix + "magicitem")
|
||||
.Alias(Prefix + "mi")
|
||||
.Description("Shows a random magicitem from <https://1d4chan.org/wiki/List_of_/tg/%27s_magic_items>")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -472,7 +473,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
var red = Convert.ToInt32(arg1.Substring(0, 2), 16);
|
||||
var green = Convert.ToInt32(arg1.Substring(2, 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))
|
||||
{
|
||||
@ -482,6 +483,29 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
@ -106,40 +105,41 @@ namespace NadekoBot.Modules.Translator.Helpers
|
||||
translation = text.Substring(startQuote + 1, endQuote - startQuote - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Translation of phrase
|
||||
text = text.Substring(0, index);
|
||||
text = text.Replace("],[", ",");
|
||||
text = text.Replace("]", string.Empty);
|
||||
text = text.Replace("[", string.Empty);
|
||||
text = text.Replace("\",\"", "\"");
|
||||
|
||||
// Get translated phrases
|
||||
string[] phrases = text.Split(new[] { '\"' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; (i < phrases.Count()); i += 2)
|
||||
else
|
||||
{
|
||||
string translatedPhrase = phrases[i];
|
||||
if (translatedPhrase.StartsWith(",,"))
|
||||
// Translation of phrase
|
||||
text = text.Substring(0, index);
|
||||
text = text.Replace("],[", ",");
|
||||
text = text.Replace("]", string.Empty);
|
||||
text = text.Replace("[", string.Empty);
|
||||
text = text.Replace("\",\"", "\"");
|
||||
|
||||
// Get translated phrases
|
||||
string[] phrases = text.Split(new[] { '\"' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; (i < phrases.Count()); i += 2)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
string translatedPhrase = phrases[i];
|
||||
if (translatedPhrase.StartsWith(",,"))
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
translation += translatedPhrase + " ";
|
||||
}
|
||||
translation += translatedPhrase + " ";
|
||||
}
|
||||
|
||||
// Fix up translation
|
||||
translation = translation.Trim();
|
||||
translation = translation.Replace(" ?", "?");
|
||||
translation = translation.Replace(" !", "!");
|
||||
translation = translation.Replace(" ,", ",");
|
||||
translation = translation.Replace(" .", ".");
|
||||
translation = translation.Replace(" ;", ";");
|
||||
|
||||
// And translation speech URL
|
||||
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);
|
||||
}
|
||||
|
||||
// Fix up translation
|
||||
translation = translation.Trim();
|
||||
translation = translation.Replace(" ?", "?");
|
||||
translation = translation.Replace(" !", "!");
|
||||
translation = translation.Replace(" ,", ",");
|
||||
translation = translation.Replace(" .", ".");
|
||||
translation = translation.Replace(" ;", ";");
|
||||
|
||||
// And translation speech URL
|
||||
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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -176,134 +176,135 @@ namespace NadekoBot.Modules.Translator.Helpers
|
||||
{
|
||||
if (GoogleTranslator._languageModeMap == null)
|
||||
{
|
||||
GoogleTranslator._languageModeMap = new Dictionary<string, string>();
|
||||
GoogleTranslator._languageModeMap.Add("afrikaans", "af");
|
||||
GoogleTranslator._languageModeMap.Add("albanian", "sq");
|
||||
GoogleTranslator._languageModeMap.Add("arabic", "ar");
|
||||
GoogleTranslator._languageModeMap.Add("armenian", "hy");
|
||||
GoogleTranslator._languageModeMap.Add("azerbaijani", "az");
|
||||
GoogleTranslator._languageModeMap.Add("basque", "eu");
|
||||
GoogleTranslator._languageModeMap.Add("belarusian", "be");
|
||||
GoogleTranslator._languageModeMap.Add("bengali", "bn");
|
||||
GoogleTranslator._languageModeMap.Add("bulgarian", "bg");
|
||||
GoogleTranslator._languageModeMap.Add("catalan", "ca");
|
||||
GoogleTranslator._languageModeMap.Add("chinese", "zh-CN");
|
||||
GoogleTranslator._languageModeMap.Add("croatian", "hr");
|
||||
GoogleTranslator._languageModeMap.Add("czech", "cs");
|
||||
GoogleTranslator._languageModeMap.Add("danish", "da");
|
||||
GoogleTranslator._languageModeMap.Add("dutch", "nl");
|
||||
GoogleTranslator._languageModeMap.Add("english", "en");
|
||||
GoogleTranslator._languageModeMap.Add("esperanto", "eo");
|
||||
GoogleTranslator._languageModeMap.Add("estonian", "et");
|
||||
GoogleTranslator._languageModeMap.Add("filipino", "tl");
|
||||
GoogleTranslator._languageModeMap.Add("finnish", "fi");
|
||||
GoogleTranslator._languageModeMap.Add("french", "fr");
|
||||
GoogleTranslator._languageModeMap.Add("galician", "gl");
|
||||
GoogleTranslator._languageModeMap.Add("german", "de");
|
||||
GoogleTranslator._languageModeMap.Add("georgian", "ka");
|
||||
GoogleTranslator._languageModeMap.Add("greek", "el");
|
||||
GoogleTranslator._languageModeMap.Add("haitian Creole", "ht");
|
||||
GoogleTranslator._languageModeMap.Add("hebrew", "iw");
|
||||
GoogleTranslator._languageModeMap.Add("hindi", "hi");
|
||||
GoogleTranslator._languageModeMap.Add("hungarian", "hu");
|
||||
GoogleTranslator._languageModeMap.Add("icelandic", "is");
|
||||
GoogleTranslator._languageModeMap.Add("indonesian", "id");
|
||||
GoogleTranslator._languageModeMap.Add("irish", "ga");
|
||||
GoogleTranslator._languageModeMap.Add("italian", "it");
|
||||
GoogleTranslator._languageModeMap.Add("japanese", "ja");
|
||||
GoogleTranslator._languageModeMap.Add("korean", "ko");
|
||||
GoogleTranslator._languageModeMap.Add("lao", "lo");
|
||||
GoogleTranslator._languageModeMap.Add("latin", "la");
|
||||
GoogleTranslator._languageModeMap.Add("latvian", "lv");
|
||||
GoogleTranslator._languageModeMap.Add("lithuanian", "lt");
|
||||
GoogleTranslator._languageModeMap.Add("macedonian", "mk");
|
||||
GoogleTranslator._languageModeMap.Add("malay", "ms");
|
||||
GoogleTranslator._languageModeMap.Add("maltese", "mt");
|
||||
GoogleTranslator._languageModeMap.Add("norwegian", "no");
|
||||
GoogleTranslator._languageModeMap.Add("persian", "fa");
|
||||
GoogleTranslator._languageModeMap.Add("polish", "pl");
|
||||
GoogleTranslator._languageModeMap.Add("portuguese", "pt");
|
||||
GoogleTranslator._languageModeMap.Add("romanian", "ro");
|
||||
GoogleTranslator._languageModeMap.Add("russian", "ru");
|
||||
GoogleTranslator._languageModeMap.Add("serbian", "sr");
|
||||
GoogleTranslator._languageModeMap.Add("slovak", "sk");
|
||||
GoogleTranslator._languageModeMap.Add("slovenian", "sl");
|
||||
GoogleTranslator._languageModeMap.Add("spanish", "es");
|
||||
GoogleTranslator._languageModeMap.Add("swahili", "sw");
|
||||
GoogleTranslator._languageModeMap.Add("swedish", "sv");
|
||||
GoogleTranslator._languageModeMap.Add("tamil", "ta");
|
||||
GoogleTranslator._languageModeMap.Add("telugu", "te");
|
||||
GoogleTranslator._languageModeMap.Add("thai", "th");
|
||||
GoogleTranslator._languageModeMap.Add("turkish", "tr");
|
||||
GoogleTranslator._languageModeMap.Add("ukrainian", "uk");
|
||||
GoogleTranslator._languageModeMap.Add("urdu", "ur");
|
||||
GoogleTranslator._languageModeMap.Add("vietnamese", "vi");
|
||||
GoogleTranslator._languageModeMap.Add("welsh", "cy");
|
||||
GoogleTranslator._languageModeMap.Add("yiddish", "yi");
|
||||
GoogleTranslator._languageModeMap = new Dictionary<string, string>() {
|
||||
{ "afrikaans", "af"},
|
||||
{ "albanian", "sq"},
|
||||
{ "arabic", "ar"},
|
||||
{ "armenian", "hy"},
|
||||
{ "azerbaijani", "az"},
|
||||
{ "basque", "eu"},
|
||||
{ "belarusian", "be"},
|
||||
{ "bengali", "bn"},
|
||||
{ "bulgarian", "bg"},
|
||||
{ "catalan", "ca"},
|
||||
{ "chinese", "zh-CN"},
|
||||
{ "croatian", "hr"},
|
||||
{ "czech", "cs"},
|
||||
{ "danish", "da"},
|
||||
{ "dutch", "nl"},
|
||||
{ "english", "en"},
|
||||
{ "esperanto", "eo"},
|
||||
{ "estonian", "et"},
|
||||
{ "filipino", "tl"},
|
||||
{ "finnish", "fi"},
|
||||
{ "french", "fr"},
|
||||
{ "galician", "gl"},
|
||||
{ "german", "de"},
|
||||
{ "georgian", "ka"},
|
||||
{ "greek", "el"},
|
||||
{ "haitian Creole", "ht"},
|
||||
{ "hebrew", "iw"},
|
||||
{ "hindi", "hi"},
|
||||
{ "hungarian", "hu"},
|
||||
{ "icelandic", "is"},
|
||||
{ "indonesian", "id"},
|
||||
{ "irish", "ga"},
|
||||
{ "italian", "it"},
|
||||
{ "japanese", "ja"},
|
||||
{ "korean", "ko"},
|
||||
{ "lao", "lo"},
|
||||
{ "latin", "la"},
|
||||
{ "latvian", "lv"},
|
||||
{ "lithuanian", "lt"},
|
||||
{ "macedonian", "mk"},
|
||||
{ "malay", "ms"},
|
||||
{ "maltese", "mt"},
|
||||
{ "norwegian", "no"},
|
||||
{ "persian", "fa"},
|
||||
{ "polish", "pl"},
|
||||
{ "portuguese", "pt"},
|
||||
{ "romanian", "ro"},
|
||||
{ "russian", "ru"},
|
||||
{ "serbian", "sr"},
|
||||
{ "slovak", "sk"},
|
||||
{ "slovenian", "sl"},
|
||||
{ "spanish", "es"},
|
||||
{ "swahili", "sw"},
|
||||
{ "swedish", "sv"},
|
||||
{ "tamil", "ta"},
|
||||
{ "telugu", "te"},
|
||||
{ "thai", "th"},
|
||||
{ "turkish", "tr"},
|
||||
{ "ukrainian", "uk"},
|
||||
{ "urdu", "ur"},
|
||||
{ "vietnamese", "vi"},
|
||||
{ "welsh", "cy"},
|
||||
{ "yiddish", "yi"},
|
||||
|
||||
GoogleTranslator._languageModeMap.Add("af", "af");
|
||||
GoogleTranslator._languageModeMap.Add("sq", "sq");
|
||||
GoogleTranslator._languageModeMap.Add("ar", "ar");
|
||||
GoogleTranslator._languageModeMap.Add("hy", "hy");
|
||||
GoogleTranslator._languageModeMap.Add("az", "az");
|
||||
GoogleTranslator._languageModeMap.Add("eu", "eu");
|
||||
GoogleTranslator._languageModeMap.Add("be", "be");
|
||||
GoogleTranslator._languageModeMap.Add("bn", "bn");
|
||||
GoogleTranslator._languageModeMap.Add("bg", "bg");
|
||||
GoogleTranslator._languageModeMap.Add("ca", "ca");
|
||||
GoogleTranslator._languageModeMap.Add("zh-CN", "zh-CN");
|
||||
GoogleTranslator._languageModeMap.Add("hr", "hr");
|
||||
GoogleTranslator._languageModeMap.Add("cs", "cs");
|
||||
GoogleTranslator._languageModeMap.Add("da", "da");
|
||||
GoogleTranslator._languageModeMap.Add("nl", "nl");
|
||||
GoogleTranslator._languageModeMap.Add("en", "en");
|
||||
GoogleTranslator._languageModeMap.Add("eo", "eo");
|
||||
GoogleTranslator._languageModeMap.Add("et", "et");
|
||||
GoogleTranslator._languageModeMap.Add("tl", "tl");
|
||||
GoogleTranslator._languageModeMap.Add("fi", "fi");
|
||||
GoogleTranslator._languageModeMap.Add("fr", "fr");
|
||||
GoogleTranslator._languageModeMap.Add("gl", "gl");
|
||||
GoogleTranslator._languageModeMap.Add("de", "de");
|
||||
GoogleTranslator._languageModeMap.Add("ka", "ka");
|
||||
GoogleTranslator._languageModeMap.Add("el", "el");
|
||||
GoogleTranslator._languageModeMap.Add("ht", "ht");
|
||||
GoogleTranslator._languageModeMap.Add("iw", "iw");
|
||||
GoogleTranslator._languageModeMap.Add("hi", "hi");
|
||||
GoogleTranslator._languageModeMap.Add("hu", "hu");
|
||||
GoogleTranslator._languageModeMap.Add("is", "is");
|
||||
GoogleTranslator._languageModeMap.Add("id", "id");
|
||||
GoogleTranslator._languageModeMap.Add("ga", "ga");
|
||||
GoogleTranslator._languageModeMap.Add("it", "it");
|
||||
GoogleTranslator._languageModeMap.Add("ja", "ja");
|
||||
GoogleTranslator._languageModeMap.Add("ko", "ko");
|
||||
GoogleTranslator._languageModeMap.Add("lo", "lo");
|
||||
GoogleTranslator._languageModeMap.Add("la", "la");
|
||||
GoogleTranslator._languageModeMap.Add("lv", "lv");
|
||||
GoogleTranslator._languageModeMap.Add("lt", "lt");
|
||||
GoogleTranslator._languageModeMap.Add("mk", "mk");
|
||||
GoogleTranslator._languageModeMap.Add("ms", "ms");
|
||||
GoogleTranslator._languageModeMap.Add("mt", "mt");
|
||||
GoogleTranslator._languageModeMap.Add("no", "no");
|
||||
GoogleTranslator._languageModeMap.Add("fa", "fa");
|
||||
GoogleTranslator._languageModeMap.Add("pl", "pl");
|
||||
GoogleTranslator._languageModeMap.Add("pt", "pt");
|
||||
GoogleTranslator._languageModeMap.Add("ro", "ro");
|
||||
GoogleTranslator._languageModeMap.Add("ru", "ru");
|
||||
GoogleTranslator._languageModeMap.Add("sr", "sr");
|
||||
GoogleTranslator._languageModeMap.Add("sk", "sk");
|
||||
GoogleTranslator._languageModeMap.Add("sl", "sl");
|
||||
GoogleTranslator._languageModeMap.Add("es", "es");
|
||||
GoogleTranslator._languageModeMap.Add("sw", "sw");
|
||||
GoogleTranslator._languageModeMap.Add("sv", "sv");
|
||||
GoogleTranslator._languageModeMap.Add("ta", "ta");
|
||||
GoogleTranslator._languageModeMap.Add("te", "te");
|
||||
GoogleTranslator._languageModeMap.Add("th", "th");
|
||||
GoogleTranslator._languageModeMap.Add("tr", "tr");
|
||||
GoogleTranslator._languageModeMap.Add("uk", "uk");
|
||||
GoogleTranslator._languageModeMap.Add("ur", "ur");
|
||||
GoogleTranslator._languageModeMap.Add("vi", "vi");
|
||||
GoogleTranslator._languageModeMap.Add("cy", "cy");
|
||||
GoogleTranslator._languageModeMap.Add("yi", "yi");
|
||||
{ "af", "af"},
|
||||
{ "sq", "sq"},
|
||||
{ "ar", "ar"},
|
||||
{ "hy", "hy"},
|
||||
{ "az", "az"},
|
||||
{ "eu", "eu"},
|
||||
{ "be", "be"},
|
||||
{ "bn", "bn"},
|
||||
{ "bg", "bg"},
|
||||
{ "ca", "ca"},
|
||||
{ "zh-CN", "zh-CN"},
|
||||
{ "hr", "hr"},
|
||||
{ "cs", "cs"},
|
||||
{ "da", "da"},
|
||||
{ "nl", "nl"},
|
||||
{ "en", "en"},
|
||||
{ "eo", "eo"},
|
||||
{ "et", "et"},
|
||||
{ "tl", "tl"},
|
||||
{ "fi", "fi"},
|
||||
{ "fr", "fr"},
|
||||
{ "gl", "gl"},
|
||||
{ "de", "de"},
|
||||
{ "ka", "ka"},
|
||||
{ "el", "el"},
|
||||
{ "ht", "ht"},
|
||||
{ "iw", "iw"},
|
||||
{ "hi", "hi"},
|
||||
{ "hu", "hu"},
|
||||
{ "is", "is"},
|
||||
{ "id", "id"},
|
||||
{ "ga", "ga"},
|
||||
{ "it", "it"},
|
||||
{ "ja", "ja"},
|
||||
{ "ko", "ko"},
|
||||
{ "lo", "lo"},
|
||||
{ "la", "la"},
|
||||
{ "lv", "lv"},
|
||||
{ "lt", "lt"},
|
||||
{ "mk", "mk"},
|
||||
{ "ms", "ms"},
|
||||
{ "mt", "mt"},
|
||||
{ "no", "no"},
|
||||
{ "fa", "fa"},
|
||||
{ "pl", "pl"},
|
||||
{ "pt", "pt"},
|
||||
{ "ro", "ro"},
|
||||
{ "ru", "ru"},
|
||||
{ "sr", "sr"},
|
||||
{ "sk", "sk"},
|
||||
{ "sl", "sl"},
|
||||
{ "es", "es"},
|
||||
{ "sw", "sw"},
|
||||
{ "sv", "sv"},
|
||||
{ "ta", "ta"},
|
||||
{ "te", "te"},
|
||||
{ "th", "th"},
|
||||
{ "tr", "tr"},
|
||||
{ "uk", "uk"},
|
||||
{ "ur", "ur"},
|
||||
{ "vi", "vi"},
|
||||
{ "cy", "cy"},
|
||||
{ "yi", "yi"},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace NadekoBot.Modules.Translator
|
||||
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "trans")
|
||||
.Alias(Module.Prefix + "translate")
|
||||
cgb.CreateCommand(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")
|
||||
.Parameter("langs", ParameterType.Required)
|
||||
.Parameter("text", ParameterType.Unparsed)
|
||||
|
@ -40,7 +40,6 @@ namespace NadekoBot
|
||||
public static LocalizedStrings Locale { get; set; } = new LocalizedStrings();
|
||||
public static string BotMention { get; set; } = "";
|
||||
public static bool Ready { get; set; } = false;
|
||||
public static bool IsBot { get; set; } = false;
|
||||
|
||||
private static Channel OwnerPrivateChannel { get; set; }
|
||||
|
||||
@ -88,10 +87,10 @@ namespace NadekoBot
|
||||
}
|
||||
|
||||
//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");
|
||||
Creds.Password = Console.ReadLine();
|
||||
Console.WriteLine("Token blank. Please enter your bot's token:\n");
|
||||
Creds.Token = Console.ReadLine();
|
||||
}
|
||||
|
||||
Console.WriteLine(string.IsNullOrWhiteSpace(Creds.GoogleAPIKey)
|
||||
@ -159,8 +158,8 @@ namespace NadekoBot
|
||||
}));
|
||||
|
||||
//install modules
|
||||
modules.Add(new AdministrationModule(), "Administration", 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 Conversations(), "Conversations", ModuleFilter.None);
|
||||
modules.Add(new GamblingModule(), "Gambling", ModuleFilter.None);
|
||||
@ -182,20 +181,11 @@ namespace NadekoBot
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Creds.Token))
|
||||
await Client.Connect(Creds.Username, Creds.Password).ConfigureAwait(false);
|
||||
else
|
||||
{
|
||||
await Client.Connect(Creds.Token).ConfigureAwait(false);
|
||||
IsBot = true;
|
||||
}
|
||||
await Client.Connect(Creds.Token).ConfigureAwait(false);
|
||||
}
|
||||
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.ReadKey();
|
||||
return;
|
||||
@ -253,31 +243,13 @@ namespace NadekoBot
|
||||
if (ConfigHandler.IsBlackListed(e))
|
||||
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)
|
||||
await OwnerPrivateChannel.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```").ConfigureAwait(false);
|
||||
|
||||
if (repliedRecently) return;
|
||||
|
||||
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 Task.Delay(2000).ConfigureAwait(false);
|
||||
repliedRecently = false;
|
||||
|
@ -201,7 +201,6 @@
|
||||
<Compile Include="Modules\Games\Commands\Trivia\TriviaGame.cs" />
|
||||
<Compile Include="Modules\Games\Commands\Trivia\TriviaQuestion.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\Games\Commands\SpeedTyping.cs" />
|
||||
<Compile Include="Modules\Gambling\Helpers\Cards.cs" />
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Discord;
|
||||
using NadekoBot.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -10,6 +11,7 @@ namespace NadekoBot.Classes.JSONModels
|
||||
public bool DontJoinServers { get; set; } = false;
|
||||
public bool ForwardMessages { get; set; } = true;
|
||||
public bool IsRotatingStatus { get; set; } = false;
|
||||
public int BufferSize { get; set; } = 4.MiB();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<Quote> Quotes { get; set; } = new List<Quote>();
|
||||
@ -131,6 +133,17 @@ namespace NadekoBot.Classes.JSONModels
|
||||
public string CurrencySign { get; set; } = "🌸";
|
||||
public string CurrencyName { get; set; } = "NadekoFlower";
|
||||
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
|
||||
|
@ -6,17 +6,16 @@ namespace NadekoBot.Classes.JSONModels
|
||||
{
|
||||
public class Credentials
|
||||
{
|
||||
public string Username = "myemail@email.com";
|
||||
public string Password = "xxxxxxx";
|
||||
public string Token = "";
|
||||
public ulong BotId = 1231231231231;
|
||||
public string GoogleAPIKey = "";
|
||||
public ulong[] OwnerIds = { 123123123123, 5675675679845 };
|
||||
public string TrelloAppKey = "";
|
||||
public string SoundCloudClientID = "";
|
||||
public string MashapeKey = "";
|
||||
public string LOLAPIKey = "";
|
||||
public string CarbonKey = "";
|
||||
public string Token { get; set; } = "";
|
||||
public string ClientId { get; set; } = "116275390695079945";
|
||||
public ulong BotId { get; set; } = 1231231231231;
|
||||
public ulong[] OwnerIds { get; set; } = { 123123123123, 5675675679845 };
|
||||
public string GoogleAPIKey { get; set; } = "";
|
||||
public string SoundCloudClientID { get; set; } = "";
|
||||
public string MashapeKey { get; set; } = "";
|
||||
public string LOLAPIKey { get; set; } = "";
|
||||
public string TrelloAppKey { get; set; } = "";
|
||||
public string CarbonKey { get; set; } = "";
|
||||
}
|
||||
[DebuggerDisplay("{items[0].id.playlistId}")]
|
||||
public class YoutubePlaylistSearch
|
||||
|
@ -1,16 +1,15 @@
|
||||
{
|
||||
"Username": "myemail@email.com",
|
||||
"Password": "xxxxxxx",
|
||||
"Token": "",
|
||||
"ClientId": "116275390695079945",
|
||||
"BotId": 1231231231231,
|
||||
"GoogleAPIKey": "",
|
||||
"OwnerIds": [
|
||||
123123123123,
|
||||
5675675679845
|
||||
],
|
||||
"TrelloAppKey": "",
|
||||
"GoogleAPIKey": "",
|
||||
"SoundCloudClientID": "",
|
||||
"MashapeKey": "",
|
||||
"LOLAPIKey": "",
|
||||
"TrelloAppKey": "",
|
||||
"CarbonKey": ""
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
"DontJoinServers": false,
|
||||
"ForwardMessages": true,
|
||||
"IsRotatingStatus": false,
|
||||
"BufferSize": 4194304,
|
||||
"RemindMessageFormat": "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗",
|
||||
"CustomReactions": {
|
||||
"\\o\\": [
|
||||
@ -120,5 +121,6 @@
|
||||
],
|
||||
"CurrencySign": "🌸",
|
||||
"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>"
|
||||
}
|
Loading…
Reference in New Issue
Block a user