Merge pull request #11 from Kwoth/dev

update
This commit is contained in:
samvaio 2016-11-29 01:21:22 +05:30 committed by GitHub
commit 12a6f86d82
6 changed files with 85 additions and 9 deletions

@ -1 +1 @@
Subproject commit 9766a978b61294fda58964fc271d9c80c3c36e0b Subproject commit 95a4f7a73e2b66bef3a841ac6b415f7269839f42

View File

@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Administration
{ {
var t = Task.Run(async () => var t = Task.Run(async () =>
{ {
await Task.Delay(conf.AutoDeleteGreetMessagesTimer * 1000).ConfigureAwait(false); // 5 minutes await Task.Delay(conf.AutoDeleteByeMessagesTimer * 1000).ConfigureAwait(false); // 5 minutes
try { await toDelete.DeleteAsync().ConfigureAwait(false); } catch { } try { await toDelete.DeleteAsync().ConfigureAwait(false); } catch { }
}); });
} }
@ -90,7 +90,7 @@ namespace NadekoBot.Modules.Administration
try try
{ {
var toDelete = await channel.SendMessageAsync(msg.SanitizeMentions()).ConfigureAwait(false); var toDelete = await channel.SendMessageAsync(msg.SanitizeMentions()).ConfigureAwait(false);
if (conf.AutoDeleteByeMessagesTimer > 0) if (conf.AutoDeleteGreetMessagesTimer > 0)
{ {
var t = Task.Run(async () => var t = Task.Run(async () =>
{ {
@ -274,7 +274,7 @@ namespace NadekoBot.Modules.Administration
return; return;
} }
var sendGreetEnabled = ServerGreetCommands.SetGreetMessage(channel.Guild.Id, ref text); var sendGreetEnabled = ServerGreetCommands.SetGreetDmMessage(channel.Guild.Id, ref text);
await channel.SendMessageAsync("🆗 New DM greet message **set**.").ConfigureAwait(false); await channel.SendMessageAsync("🆗 New DM greet message **set**.").ConfigureAwait(false);
if (!sendGreetEnabled) if (!sendGreetEnabled)

View File

@ -208,6 +208,46 @@ $@"🌍 **Weather for** 【{obj["target"]}】
.ConfigureAwait(false); .ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task MagicTheGathering(IUserMessage umsg, [Remainder] string name = null)
{
var channel = (ITextChannel)umsg.Channel;
var arg = name;
if (string.IsNullOrWhiteSpace(arg))
{
await channel.SendMessageAsync("💢 `Please enter a card name to search for.`").ConfigureAwait(false);
return;
}
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
string response = "";
using (var http = new HttpClient())
{
http.DefaultRequestHeaders.Clear();
response = await http.GetStringAsync($"https://api.deckbrew.com/mtg/cards?name={Uri.EscapeUriString(arg)}")
.ConfigureAwait(false);
try
{
var items = JArray.Parse(response).Shuffle().ToList();
if (items == null)
throw new KeyNotFoundException("Cannot find a card by that name");
var msg = $@"```css
[☕ Magic The Gathering]: {items[0]["name"].ToString()}
[Store URL]: {await _google.ShortenUrl(items[0]["store_url"].ToString())}
[Cost]: {items[0]["cost"].ToString()}
[Description]: {items[0]["text"].ToString()}
```
{items[0]["editions"][0]["image_url"].ToString()}";
await channel.SendMessageAsync(msg).ConfigureAwait(false);
}
catch
{
await channel.SendMessageAsync($"💢 Error could not find the card {arg}").ConfigureAwait(false);
}
}
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Hearthstone(IUserMessage umsg, [Remainder] string name = null) public async Task Hearthstone(IUserMessage umsg, [Remainder] string name = null)

View File

@ -906,7 +906,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Toggles automatic deletion of bye messages.. /// Looks up a localized string similar to Sets the time it takes (in seconds) for bye messages to be auto-deleted. Set 0 to disable automatic deletion..
/// </summary> /// </summary>
public static string byedel_desc { public static string byedel_desc {
get { get {
@ -915,7 +915,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}byedel`. /// Looks up a localized string similar to `{0}byedel 0` or `{0}byedel 30`.
/// </summary> /// </summary>
public static string byedel_usage { public static string byedel_usage {
get { get {
@ -2688,7 +2688,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Toggles automatic deletion of greet messages.. /// Looks up a localized string similar to Sets the time it takes (in seconds) for greet messages to be auto-deleted. Set 0 to disable automatic deletion..
/// </summary> /// </summary>
public static string greetdel_desc { public static string greetdel_desc {
get { get {
@ -2697,7 +2697,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}greetdel`. /// Looks up a localized string similar to `{0}greetdel 0` or `{0}greetdel 30`.
/// </summary> /// </summary>
public static string greetdel_usage { public static string greetdel_usage {
get { get {
@ -3974,6 +3974,33 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to magicthegathering mtg.
/// </summary>
public static string magicthegathering_cmd {
get {
return ResourceManager.GetString("magicthegathering_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Searches for a Magic The Gathering card..
/// </summary>
public static string magicthegathering_desc {
get {
return ResourceManager.GetString("magicthegathering_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}magicthegathering about face` or `{0}mtg about face`.
/// </summary>
public static string magicthegathering_usage {
get {
return ResourceManager.GetString("magicthegathering_usage", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to manga mang mq. /// Looks up a localized string similar to manga mang mq.
/// </summary> /// </summary>

View File

@ -2700,4 +2700,13 @@
<data name="yandere_usage" xml:space="preserve"> <data name="yandere_usage" xml:space="preserve">
<value>`{0}yandere tag1+tag2`</value> <value>`{0}yandere tag1+tag2`</value>
</data> </data>
<data name="magicthegathering_cmd" xml:space="preserve">
<value>magicthegathering mtg</value>
</data>
<data name="magicthegathering_desc" xml:space="preserve">
<value>Searches for a Magic The Gathering card.</value>
</data>
<data name="magicthegathering_usage" xml:space="preserve">
<value>`{0}magicthegathering about face` or `{0}mtg about face`</value>
</data>
</root> </root>

View File

@ -1,7 +1,7 @@
{ {
"ClientId": 123123123, "ClientId": 123123123,
"BotId": null, "BotId": null,
"Token": "MTE5Nzc3MDIxMzE5NTc3NjEw.CxK2Og.N4u_RpZws88zmXWF16mQaQUSphI", "Token": "",
"OwnerIds": [ "OwnerIds": [
0 0
], ],