Some minor stuff, working on self assigned roles next

This commit is contained in:
Master Kwoth 2016-03-15 02:41:27 +01:00
parent 4045cc9308
commit 2c17c7b223
4 changed files with 40 additions and 12 deletions

View File

@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace NadekoBot.Classes.JSONModels {
internal class LocalizedStrings {
public string[] Insults { get; } = {
public string[] Insults { get; set; } = {
" You are a poop.", " You're a jerk.",
" I will eat you when I get my powers back."
};
public string[] Praises = {
public string[] Praises { get; set; } = {
" You are cool.",
" You are nice!",
" You did a good job.",
@ -19,5 +15,36 @@ namespace NadekoBot.Classes.JSONModels {
" is awesome!",
" Wow."
};
public static string[] GetAvailableLocales() {
Directory.CreateDirectory("data/locales");
return Directory.GetFiles("data/locales");
}
//public static void HandleLocalization() {
// var locales = LocalizedStrings.GetAvailableLocales();
// Console.WriteLine("Pick a language:\n" +
// "1. English");
// for (var i = 0; i < locales.Length; i++) {
// Console.WriteLine((i + 2) + ". " + Path.GetFileNameWithoutExtension(locales[i]));
// }
// File.WriteAllText("data/locales/english.json", JsonConvert.SerializeObject(new LocalizedStrings(), Formatting.Indented));
// try {
// Console.WriteLine($"Type in a number from {1} to {locales.Length + 1}\n");
// var input = Console.ReadLine();
// if (input != "1")
// Locale = LocalizedStrings.LoadLocale(locales[int.Parse(input) - 2]);
// } catch (Exception ex) {
// Console.ForegroundColor = ConsoleColor.Red;
// Console.WriteLine(ex);
// Console.ReadKey();
// return;
// }
//}
public static LocalizedStrings LoadLocale(string localeFile) =>
Newtonsoft.Json.JsonConvert.DeserializeObject<LocalizedStrings>(File.ReadAllText(localeFile));
}
}

View File

@ -118,7 +118,7 @@ namespace NadekoBot.Commands {
NadekoBot.Config.ObservingStreams.Remove(toRemove);
ConfigHandler.SaveConfig();
await e.Channel.SendMessage($":ok: Removed `{toRemove.Username}`'s stream from hitbox notifications");
await e.Channel.SendMessage($":ok: Removed `{toRemove.Username}`'s stream from notifications.");
});
cgb.CreateCommand(Module.Prefix + "liststreams")

View File

@ -30,6 +30,7 @@ namespace NadekoBot.Modules {
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
cgb.CreateCommand("e")
.Description("You did it.")
.Do(async e => {
await e.Channel.SendMessage($"{e.User.Name} did it. 😒 🔫");
});
@ -305,7 +306,7 @@ namespace NadekoBot.Modules {
});
cgb.CreateCommand("bb")
.Description("Says bye to someone. **Usage**: @NadekoBot bb @X")
.Description("Says bye to someone.\n**Usage**: @NadekoBot bb @X")
.Parameter("ppl", ParameterType.Unparsed)
.Do(async e => {
var str = "Bye";
@ -375,7 +376,7 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("av").Alias("avatar")
.Parameter("mention", ParameterType.Required)
.Description("Shows a mentioned person's avatar. **Usage**: ~av @X")
.Description("Shows a mentioned person's avatar.\n**Usage**: ~av @X")
.Do(async e => {
var usr = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (usr == null) {

View File

@ -7,6 +7,7 @@ using NadekoBot.Modules;
using Discord.Modules;
using Discord.Audio;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Classes.JSONModels;
@ -24,6 +25,7 @@ namespace NadekoBot {
private static void Main() {
Console.OutputEncoding = Encoding.Unicode;
// generate credentials example so people can know about the changes i make
try {
File.WriteAllText("credentials_example.json", JsonConvert.SerializeObject(new Credentials(), Formatting.Indented));
@ -163,8 +165,6 @@ namespace NadekoBot {
public static bool IsOwner(ulong id) => Creds.OwnerIds.Contains(id);
public static bool IsOwner(User u) => IsOwner(u.Id);
public async Task SendMessageToOwner(string message) {
if (Config.ForwardMessages && OwnerPrivateChannel != null)
await OwnerPrivateChannel.SendMessage(message);