Client id added to creds, no more username/pass, cleanup, HelpString added to creds (-h command). No more support for normal user accounts.

This commit is contained in:
Master Kwoth
2016-06-15 19:03:00 +02:00
parent c9a0b39d69
commit 5b379f7ffa
8 changed files with 43 additions and 92 deletions

View File

@ -728,7 +728,7 @@ namespace NadekoBot.Modules.Administration
{
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")
@ -744,7 +744,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);

View File

@ -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
{
@ -188,32 +183,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 +275,7 @@ namespace NadekoBot.Modules.Conversations
}
private static Func<CommandEventArgs, Task> SayYes()
=> async e => await e.Channel.SendMessage("Yes. :)").ConfigureAwait(false);
}

View File

@ -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;