added weather example, fixed some descriptions, forgot to close #231
This commit is contained in:
parent
5abd1e8800
commit
a7e2771fcc
@ -1,6 +1,7 @@
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Modules;
|
using NadekoBot.Modules;
|
||||||
|
using NadekoBot.Modules.Permissions.Classes;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -79,57 +80,51 @@ namespace NadekoBot.Classes.Conversations.Commands
|
|||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("dr")
|
cgb.CreateCommand("dr")
|
||||||
.Description("Deletes a request. Only owner is able to do this.")
|
.Description("Deletes a request. **Owner Only!**")
|
||||||
.Parameter("reqNumber", ParameterType.Required)
|
.Parameter("reqNumber", ParameterType.Required)
|
||||||
|
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (NadekoBot.IsOwner(e.User.Id))
|
try
|
||||||
{
|
{
|
||||||
try
|
if (DeleteRequest(int.Parse(e.Args[0])))
|
||||||
{
|
{
|
||||||
if (DeleteRequest(int.Parse(e.Args[0])))
|
await e.Channel.SendMessage(e.User.Mention + " Request deleted.").ConfigureAwait(false);
|
||||||
{
|
|
||||||
await e.Channel.SendMessage(e.User.Mention + " Request deleted.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await e.Channel.SendMessage("No request on that number.").ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
else
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage("Error deleting request, probably NaN error.").ConfigureAwait(false);
|
await e.Channel.SendMessage("No request on that number.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else await e.Channel.SendMessage("You don't have permission to do that.").ConfigureAwait(false);
|
catch
|
||||||
|
{
|
||||||
|
await e.Channel.SendMessage("Error deleting request, probably NaN error.").ConfigureAwait(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("rr")
|
cgb.CreateCommand("rr")
|
||||||
.Description("Resolves a request. Only owner is able to do this.")
|
.Description("Resolves a request. **Owner Only!**")
|
||||||
.Parameter("reqNumber", ParameterType.Required)
|
.Parameter("reqNumber", ParameterType.Required)
|
||||||
|
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (NadekoBot.IsOwner(e.User.Id))
|
try
|
||||||
{
|
{
|
||||||
try
|
var sc = ResolveRequest(int.Parse(e.Args[0]));
|
||||||
|
if (sc != null)
|
||||||
{
|
{
|
||||||
var sc = ResolveRequest(int.Parse(e.Args[0]));
|
await e.Channel.SendMessage(e.User.Mention + " Request resolved, notice sent.").ConfigureAwait(false);
|
||||||
if (sc != null)
|
await NadekoBot.Client.GetServer((ulong)sc.ServerId).GetUser((ulong)sc.UserId).Send("**This request of yours has been resolved:**\n" + sc.RequestText).ConfigureAwait(false);
|
||||||
{
|
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage("Error resolving request, probably NaN error.").ConfigureAwait(false);
|
await e.Channel.SendMessage("No request on that number.").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else await e.Channel.SendMessage("You don't have permission to do that.").ConfigureAwait(false);
|
catch
|
||||||
|
{
|
||||||
|
await e.Channel.SendMessage("Error resolving request, probably NaN error.").ConfigureAwait(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
commands.ForEach(cmd => cmd.Init(cgb));
|
commands.ForEach(cmd => cmd.Init(cgb));
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "we")
|
cgb.CreateCommand(Prefix + "we")
|
||||||
.Description("Shows weather data for a specified city and a country BOTH ARE REQUIRED. Weather api is very random if you make a mistake.")
|
.Description($"Shows weather data for a specified city and a country. BOTH ARE REQUIRED. Use country abbrevations.\n**Usage**: {Prefix}we Moscow RF")
|
||||||
.Parameter("city", ParameterType.Required)
|
.Parameter("city", ParameterType.Required)
|
||||||
.Parameter("country", ParameterType.Required)
|
.Parameter("country", ParameterType.Required)
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
@ -159,16 +159,16 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
await e.Channel.SendMessage(obj["items"][0]["link"].ToString()).ConfigureAwait(false);
|
await e.Channel.SendMessage(obj["items"][0]["link"].ToString()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException exception)
|
catch (HttpRequestException exception)
|
||||||
{
|
{
|
||||||
if (exception.Message.Contains ("403 (Forbidden)"))
|
if (exception.Message.Contains("403 (Forbidden)"))
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage ("Daily limit reached!");
|
await e.Channel.SendMessage("Daily limit reached!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage ("Something went wrong.");
|
await e.Channel.SendMessage("Something went wrong.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "ir")
|
cgb.CreateCommand(Prefix + "ir")
|
||||||
@ -185,16 +185,16 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
await e.Channel.SendMessage(obj["items"][0]["link"].ToString()).ConfigureAwait(false);
|
await e.Channel.SendMessage(obj["items"][0]["link"].ToString()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException exception)
|
catch (HttpRequestException exception)
|
||||||
{
|
{
|
||||||
if (exception.Message.Contains ("403 (Forbidden)"))
|
if (exception.Message.Contains("403 (Forbidden)"))
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage ("Daily limit reached!");
|
await e.Channel.SendMessage("Daily limit reached!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage ("Something went wrong.");
|
await e.Channel.SendMessage("Something went wrong.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cgb.CreateCommand(Prefix + "lmgtfy")
|
cgb.CreateCommand(Prefix + "lmgtfy")
|
||||||
.Description("Google something for an idiot.")
|
.Description("Google something for an idiot.")
|
||||||
|
Loading…
Reference in New Issue
Block a user