2016-03-28 04:36:59 +02:00
|
|
|
|
using Discord;
|
2016-06-17 14:03:26 +02:00
|
|
|
|
using NadekoBot.Extensions;
|
2016-03-28 04:36:59 +02:00
|
|
|
|
using Newtonsoft.Json;
|
2016-03-03 21:24:07 +01:00
|
|
|
|
using System.Collections.Generic;
|
2016-03-10 15:05:38 +01:00
|
|
|
|
using System.IO;
|
2016-07-07 04:46:33 +02:00
|
|
|
|
using System.Runtime.Serialization;
|
2016-07-23 15:04:33 +02:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-03-03 21:24:07 +01:00
|
|
|
|
|
2016-03-28 04:36:59 +02:00
|
|
|
|
namespace NadekoBot.Classes.JSONModels
|
|
|
|
|
{
|
|
|
|
|
public class Configuration
|
|
|
|
|
{
|
2016-04-02 23:17:42 +02:00
|
|
|
|
[JsonIgnore]
|
2016-07-07 04:46:33 +02:00
|
|
|
|
public static readonly Dictionary<string, List<string>> DefaultCustomReactions = new Dictionary<string, List<string>>
|
2016-04-27 12:37:37 +02:00
|
|
|
|
{
|
2016-04-27 15:12:38 +02:00
|
|
|
|
{@"\o\", new List<string>()
|
|
|
|
|
{ "/o/" } },
|
|
|
|
|
{"/o/", new List<string>()
|
|
|
|
|
{ @"\o\" } },
|
|
|
|
|
{"moveto", new List<string>() {
|
|
|
|
|
@"(👉 ͡° ͜ʖ ͡°)👉 %target%" } },
|
|
|
|
|
{"comeatmebro", new List<string>() {
|
|
|
|
|
"%target% (ง’̀-‘́)ง" } },
|
|
|
|
|
{"e", new List<string>() {
|
|
|
|
|
"%user% did it 😒 🔫",
|
|
|
|
|
"%target% did it 😒 🔫" } },
|
|
|
|
|
{"%mention% insult", new List<string>() {
|
|
|
|
|
"%target% You are a poop.",
|
|
|
|
|
"%target% You're a jerk.",
|
|
|
|
|
"%target% I will eat you when I get my powers back."
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% praise", new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"%target% You are cool.",
|
|
|
|
|
"%target% You are nice!",
|
|
|
|
|
"%target% You did a good job.",
|
|
|
|
|
"%target% You did something nice.",
|
|
|
|
|
"%target% is awesome!",
|
|
|
|
|
"%target% Wow."
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% pat", new List<string>() {
|
|
|
|
|
"http://i.imgur.com/IiQwK12.gif",
|
|
|
|
|
"http://i.imgur.com/JCXj8yD.gif",
|
|
|
|
|
"http://i.imgur.com/qqBl2bm.gif",
|
|
|
|
|
"http://i.imgur.com/eOJlnwP.gif",
|
|
|
|
|
"https://45.media.tumblr.com/229ec0458891c4dcd847545c81e760a5/tumblr_mpfy232F4j1rxrpjzo1_r2_500.gif",
|
|
|
|
|
"https://media.giphy.com/media/KZQlfylo73AMU/giphy.gif",
|
|
|
|
|
"https://media.giphy.com/media/12hvLuZ7uzvCvK/giphy.gif",
|
|
|
|
|
"http://gallery1.anivide.com/_full/65030_1382582341.gif",
|
|
|
|
|
"https://49.media.tumblr.com/8e8a099c4eba22abd3ec0f70fd087cce/tumblr_nxovj9oY861ur1mffo1_500.gif ",
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% cry", new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"http://i.imgur.com/Xg3i1Qy.gif",
|
|
|
|
|
"http://i.imgur.com/3K8DRrU.gif",
|
|
|
|
|
"http://i.imgur.com/k58BcAv.gif",
|
|
|
|
|
"http://i.imgur.com/I2fLXwo.gif"
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% are you real?", new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"%user%, I will be soon."
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% are you there?", new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"Yes. :)"
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% draw", new List<string>() {
|
|
|
|
|
"Sorry, I don't gamble, type $draw for that function."
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% bb", new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"Bye %target%"
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% call", new List<string>() {
|
|
|
|
|
"Calling %target%"
|
|
|
|
|
} },
|
|
|
|
|
{"%mention% disguise", new List<string>() {
|
2016-05-09 21:51:54 +02:00
|
|
|
|
"https://cdn.discordapp.com/attachments/140007341880901632/156721710458994690/Cc5mixjUYAADgBs.jpg",
|
|
|
|
|
"https://cdn.discordapp.com/attachments/140007341880901632/156721715831898113/hqdefault.jpg",
|
|
|
|
|
"https://cdn.discordapp.com/attachments/140007341880901632/156721724430352385/okawari_01_haruka_weird_mask.jpg",
|
|
|
|
|
"https://cdn.discordapp.com/attachments/140007341880901632/156721728763068417/mustache-best-girl.png"
|
2016-04-27 15:12:38 +02:00
|
|
|
|
|
2016-08-01 17:11:26 +02:00
|
|
|
|
} },
|
|
|
|
|
{"%mention% inv", new List<string>() {
|
|
|
|
|
"To invite your bot, click on this link -> <https://discordapp.com/oauth2/authorize?client_id=%target%&scope=bot&permissions=66186303>"
|
|
|
|
|
} },
|
|
|
|
|
{ "%mention% threaten", new List<string>() {
|
|
|
|
|
"You wanna die, %target%?"
|
2016-08-01 22:23:29 +02:00
|
|
|
|
} },
|
|
|
|
|
{ "%mention% archer", new List<string>() {
|
|
|
|
|
"http://i.imgur.com/Bha9NhL.jpg"
|
2016-04-27 15:12:38 +02:00
|
|
|
|
} }
|
2016-04-27 12:37:37 +02:00
|
|
|
|
};
|
2016-05-09 21:51:54 +02:00
|
|
|
|
|
2016-07-07 04:46:33 +02:00
|
|
|
|
public bool DontJoinServers { get; set; } = false;
|
|
|
|
|
public bool ForwardMessages { get; set; } = true;
|
2016-07-11 12:28:43 +02:00
|
|
|
|
public bool ForwardToAllOwners { get; set; } = false;
|
2016-07-07 04:46:33 +02:00
|
|
|
|
public bool IsRotatingStatus { get; set; } = false;
|
|
|
|
|
public int BufferSize { get; set; } = 4.MiB();
|
|
|
|
|
|
2016-07-25 04:21:37 +02:00
|
|
|
|
public string[] RaceAnimals { get; internal set; } = {
|
|
|
|
|
"🐼",
|
|
|
|
|
"🐻",
|
|
|
|
|
"🐧",
|
|
|
|
|
"🐨",
|
|
|
|
|
"🐬",
|
|
|
|
|
"🐞",
|
|
|
|
|
"🦀",
|
|
|
|
|
"🦄" };
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
2016-07-07 04:46:33 +02:00
|
|
|
|
public List<Quote> Quotes { get; set; } = new List<Quote>();
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public List<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
|
|
|
|
|
|
|
|
|
|
public string RemindMessageFormat { get; set; } = "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗";
|
|
|
|
|
|
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
|
|
|
public Dictionary<string, List<string>> CustomReactions { get; set; }
|
|
|
|
|
|
2016-03-06 11:53:45 +01:00
|
|
|
|
public List<string> RotatingStatuses { get; set; } = new List<string>();
|
2016-03-11 21:40:05 +01:00
|
|
|
|
public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel();
|
2016-03-06 11:53:45 +01:00
|
|
|
|
public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>();
|
|
|
|
|
public HashSet<ulong> ChannelBlacklist { get; set; } = new HashSet<ulong>();
|
2016-03-18 23:25:59 +01:00
|
|
|
|
|
2016-03-06 11:53:45 +01:00
|
|
|
|
public HashSet<ulong> UserBlacklist { get; set; } = new HashSet<ulong>() {
|
2016-03-04 10:45:41 +01:00
|
|
|
|
105309315895693312,
|
|
|
|
|
119174277298782216,
|
|
|
|
|
143515953525817344
|
|
|
|
|
};
|
2016-03-06 11:53:45 +01:00
|
|
|
|
|
2016-07-07 04:46:33 +02:00
|
|
|
|
[OnDeserialized]
|
|
|
|
|
internal void OnDeserialized(StreamingContext context)
|
|
|
|
|
{
|
|
|
|
|
if (CustomReactions == null)
|
|
|
|
|
{
|
|
|
|
|
CustomReactions = DefaultCustomReactions;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[OnSerializing]
|
|
|
|
|
internal void OnSerializing(StreamingContext context)
|
|
|
|
|
{
|
|
|
|
|
if (CustomReactions == null)
|
|
|
|
|
{
|
|
|
|
|
CustomReactions = DefaultCustomReactions;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-04-10 02:38:46 +02:00
|
|
|
|
|
2016-03-18 23:25:59 +01:00
|
|
|
|
public string[] _8BallResponses { get; set; } =
|
|
|
|
|
{
|
|
|
|
|
"Most definitely yes",
|
|
|
|
|
"For sure",
|
|
|
|
|
"As I see it, yes",
|
|
|
|
|
"My sources say yes",
|
|
|
|
|
"Yes",
|
|
|
|
|
"Most likely",
|
|
|
|
|
"Perhaps",
|
|
|
|
|
"Maybe",
|
|
|
|
|
"Not sure",
|
|
|
|
|
"It is uncertain",
|
|
|
|
|
"Ask me again later",
|
|
|
|
|
"Don't count on it",
|
|
|
|
|
"Probably not",
|
|
|
|
|
"Very doubtful",
|
|
|
|
|
"Most likely no",
|
|
|
|
|
"Nope",
|
|
|
|
|
"No",
|
|
|
|
|
"My sources say no",
|
|
|
|
|
"Dont even think about it",
|
|
|
|
|
"Definitely no",
|
|
|
|
|
"NO - It may cause disease contraction"
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-28 04:36:59 +02:00
|
|
|
|
public string CurrencySign { get; set; } = "🌸";
|
|
|
|
|
public string CurrencyName { get; set; } = "NadekoFlower";
|
2016-04-10 02:38:46 +02:00
|
|
|
|
public string DMHelpString { get; set; } = "Type `-h` for help.";
|
2016-06-15 19:03:00 +02:00
|
|
|
|
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>";
|
2016-03-03 21:24:07 +01:00
|
|
|
|
}
|
2016-03-11 21:40:05 +01:00
|
|
|
|
|
2016-03-28 04:36:59 +02:00
|
|
|
|
public class CommandPrefixesModel
|
|
|
|
|
{
|
2016-03-11 21:40:05 +01:00
|
|
|
|
public string Administration { get; set; } = ".";
|
|
|
|
|
public string Searches { get; set; } = "~";
|
|
|
|
|
public string NSFW { get; set; } = "~";
|
|
|
|
|
public string Conversations { get; set; } = "<@{0}>";
|
|
|
|
|
public string ClashOfClans { get; set; } = ",";
|
|
|
|
|
public string Help { get; set; } = "-";
|
2016-07-19 18:27:16 +02:00
|
|
|
|
public string Music { get; set; } = "!!";
|
2016-06-07 01:03:41 +02:00
|
|
|
|
public string Trello { get; set; } = "trello ";
|
2016-03-11 21:40:05 +01:00
|
|
|
|
public string Games { get; set; } = ">";
|
|
|
|
|
public string Gambling { get; set; } = "$";
|
2016-03-12 10:02:29 +01:00
|
|
|
|
public string Permissions { get; set; } = ";";
|
2016-03-15 20:21:27 +01:00
|
|
|
|
public string Programming { get; set; } = "%";
|
2016-03-28 16:44:39 +02:00
|
|
|
|
public string Pokemon { get; set; } = ">";
|
2016-06-27 22:33:03 +02:00
|
|
|
|
public string Utility { get; set; } = ".";
|
2016-03-11 21:40:05 +01:00
|
|
|
|
}
|
2016-03-10 15:05:38 +01:00
|
|
|
|
|
2016-03-28 04:36:59 +02:00
|
|
|
|
public static class ConfigHandler
|
|
|
|
|
{
|
2016-07-23 15:04:33 +02:00
|
|
|
|
private static readonly SemaphoreSlim configLock = new SemaphoreSlim(1, 1);
|
|
|
|
|
public static async Task SaveConfig()
|
2016-03-28 04:36:59 +02:00
|
|
|
|
{
|
2016-07-23 15:04:33 +02:00
|
|
|
|
await configLock.WaitAsync();
|
|
|
|
|
try
|
2016-03-28 04:36:59 +02:00
|
|
|
|
{
|
2016-03-10 15:05:38 +01:00
|
|
|
|
File.WriteAllText("data/config.json", JsonConvert.SerializeObject(NadekoBot.Config, Formatting.Indented));
|
|
|
|
|
}
|
2016-08-01 17:11:26 +02:00
|
|
|
|
finally
|
|
|
|
|
{
|
2016-07-23 15:04:33 +02:00
|
|
|
|
configLock.Release();
|
|
|
|
|
}
|
2016-03-10 15:05:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsBlackListed(MessageEventArgs evArgs) => IsUserBlacklisted(evArgs.User.Id) ||
|
|
|
|
|
(!evArgs.Channel.IsPrivate &&
|
|
|
|
|
(IsChannelBlacklisted(evArgs.Channel.Id) || IsServerBlacklisted(evArgs.Server.Id)));
|
|
|
|
|
|
|
|
|
|
public static bool IsServerBlacklisted(ulong id) => NadekoBot.Config.ServerBlacklist.Contains(id);
|
|
|
|
|
|
|
|
|
|
public static bool IsChannelBlacklisted(ulong id) => NadekoBot.Config.ChannelBlacklist.Contains(id);
|
|
|
|
|
|
|
|
|
|
public static bool IsUserBlacklisted(ulong id) => NadekoBot.Config.UserBlacklist.Contains(id);
|
|
|
|
|
}
|
2016-03-12 21:12:40 +01:00
|
|
|
|
|
2016-03-28 04:36:59 +02:00
|
|
|
|
public class Quote
|
|
|
|
|
{
|
2016-03-15 20:21:27 +01:00
|
|
|
|
public string Author { get; set; }
|
|
|
|
|
public string Text { get; set; }
|
|
|
|
|
|
|
|
|
|
public override string ToString() =>
|
|
|
|
|
$"{Text}\n\t*-{Author}*";
|
|
|
|
|
}
|
2016-04-10 02:38:46 +02:00
|
|
|
|
|
2016-03-03 21:24:07 +01:00
|
|
|
|
}
|