Merge pull request #1 from Kwoth/dev

Dev
This commit is contained in:
miraai 2016-08-11 15:31:08 +02:00 committed by GitHub
commit 8d7536ca24
8 changed files with 36 additions and 23 deletions

View File

@ -64,7 +64,7 @@ namespace NadekoBot.Classes
await saveLock.WaitAsync(); await saveLock.WaitAsync();
try try
{ {
File.WriteAllText(filePath, JsonConvert.SerializeObject(configs, Formatting.Indented)); await Task.Run(() => File.WriteAllText(filePath, JsonConvert.SerializeObject(configs, Formatting.Indented)));
} }
finally finally
{ {
@ -208,11 +208,9 @@ namespace NadekoBot.Classes
[JsonIgnore] [JsonIgnore]
private bool exclusiveSelfAssignedRoles = false; private bool exclusiveSelfAssignedRoles = false;
public bool ExclusiveSelfAssignedRoles public bool ExclusiveSelfAssignedRoles {
{
get { return exclusiveSelfAssignedRoles; } get { return exclusiveSelfAssignedRoles; }
set set {
{
exclusiveSelfAssignedRoles = value; exclusiveSelfAssignedRoles = value;
if (!SpecificConfigurations.Instantiated) return; if (!SpecificConfigurations.Instantiated) return;
OnPropertyChanged(); OnPropertyChanged();

View File

@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Gambling
cgb.CreateCommand(Module.Prefix + "rolluo") cgb.CreateCommand(Module.Prefix + "rolluo")
.Description("Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice (unordered)." + .Description("Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice (unordered)." +
$" If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `{Prefix}roll` or `{Prefix}roll` 7 or `{Prefix}roll 3d5`") $" If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `{Prefix}rolluo` or `{Prefix}rolluo 7` or `{Prefix}rolluo 3d5`")
.Parameter("num", ParameterType.Optional) .Parameter("num", ParameterType.Optional)
.Do(RollFunc(false)); .Do(RollFunc(false));

View File

@ -18,7 +18,7 @@ namespace NadekoBot.Modules.Games.Commands
internal override void Init(CommandGroupBuilder cgb) internal override void Init(CommandGroupBuilder cgb)
{ {
cgb.CreateCommand(Module.Prefix + "poll") cgb.CreateCommand(Module.Prefix + "poll")
.Description($"Creates a poll, only person who has manage server permission can do it. | `{Prefix}poll Question?;Answer1;Answ 2;A_3`") .Description($"Creates a poll, only person who has manage server permission can do it. **Needs Manage Server Permissions**| `{Prefix}poll Question?;Answer1;Answ 2;A_3`")
.Parameter("allargs", ParameterType.Unparsed) .Parameter("allargs", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {

View File

@ -297,10 +297,22 @@ namespace NadekoBot.Modules.Music.Classes
if (video == null) // do something with this error if (video == null) // do something with this error
throw new Exception("Could not load any video elements based on the query."); throw new Exception("Could not load any video elements based on the query.");
var m = Regex.Match(query, @"\?t=(?<t>\d*)");
var m = Regex.Match(query, @"\?t=((?<h>\d*)h)?((?<m>\d*)m)?((?<s>\d*)s?)?");
int gotoTime = 0; int gotoTime = 0;
if (m.Captures.Count > 0) if (m.Captures.Count > 0)
int.TryParse(m.Groups["t"].ToString(), out gotoTime); {
int hours;
int minutes;
int seconds;
int.TryParse(m.Groups["h"].ToString(), out hours);
int.TryParse(m.Groups["m"].ToString(), out minutes);
int.TryParse(m.Groups["s"].ToString(), out seconds);
gotoTime = hours * 60 * 60 + minutes * 60 + seconds;
}
var song = new Song(new SongInfo var song = new Song(new SongInfo
{ {
Title = video.Title.Substring(0, video.Title.Length - 10), // removing trailing "- You Tube" Title = video.Title.Substring(0, video.Title.Length - 10), // removing trailing "- You Tube"

View File

@ -466,7 +466,7 @@ namespace NadekoBot.Modules.Music
//var msRegex = new Regex(@"(?<n1>\d+)>(?<n2>\d+)", RegexOptions.Compiled); //var msRegex = new Regex(@"(?<n1>\d+)>(?<n2>\d+)", RegexOptions.Compiled);
cgb.CreateCommand(Prefix + "movesong") cgb.CreateCommand(Prefix + "movesong")
.Alias(Prefix + "ms") .Alias(Prefix + "ms")
.Description($"Moves a song from one position to another. | `{Prefix} ms` 5>3") .Description($"Moves a song from one position to another. | `{Prefix} ms 5>3`")
.Parameter("fromto") .Parameter("fromto")
.Do(async e => .Do(async e =>
{ {
@ -502,7 +502,7 @@ namespace NadekoBot.Modules.Music
cgb.CreateCommand(Prefix + "setmaxqueue") cgb.CreateCommand(Prefix + "setmaxqueue")
.Alias(Prefix + "smq") .Alias(Prefix + "smq")
.Description($"Sets a maximum queue size. Supply 0 or no argument to have no limit. | `{Prefix}smq` 50 or `{Prefix}smq`") .Description($"Sets a maximum queue size. Supply 0 or no argument to have no limit. | `{Prefix}smq 50` or `{Prefix}smq`")
.Parameter("size", ParameterType.Unparsed) .Parameter("size", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {

View File

@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Searches.Commands
}); });
cgb.CreateCommand(Module.Prefix + "osu b") cgb.CreateCommand(Module.Prefix + "osu b")
.Description($"Shows information about an osu beatmap. |`{Prefix}osu b` https://osu.ppy.sh/s/127712") .Description($"Shows information about an osu beatmap. |`{Prefix}osu b https://osu.ppy.sh/s/127712`")
.Parameter("map", ParameterType.Unparsed) .Parameter("map", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{ {

View File

@ -99,6 +99,8 @@ namespace NadekoBot.Modules.Translator.Helpers
{ "bengali", "bn"}, { "bengali", "bn"},
{ "bulgarian", "bg"}, { "bulgarian", "bg"},
{ "catalan", "ca"}, { "catalan", "ca"},
{ "chinese-traditional", "zh-TW"},
{ "chinese-simplified", "zh-CN"},
{ "chinese", "zh-CN"}, { "chinese", "zh-CN"},
{ "croatian", "hr"}, { "croatian", "hr"},
{ "czech", "cs"}, { "czech", "cs"},
@ -163,6 +165,7 @@ namespace NadekoBot.Modules.Translator.Helpers
{ "bn", "bn"}, { "bn", "bn"},
{ "bg", "bg"}, { "bg", "bg"},
{ "ca", "ca"}, { "ca", "ca"},
{ "zh-TW", "zh-TW"},
{ "zh-CN", "zh-CN"}, { "zh-CN", "zh-CN"},
{ "hr", "hr"}, { "hr", "hr"},
{ "cs", "cs"}, { "cs", "cs"},

View File

@ -14,9 +14,9 @@ Command and aliases | Description | Usage
----------------|--------------|------- ----------------|--------------|-------
`.grdel` | Toggles automatic deletion of greet and bye messages. **Needs Manage Server Permissions.**| `.grdel` `.grdel` | Toggles automatic deletion of greet and bye messages. **Needs Manage Server Permissions.**| `.grdel`
`.greet` | Toggles anouncements on the current channel when someone joins the server. **Needs Manage Server Permissions.**| `.greet` `.greet` | Toggles anouncements on the current channel when someone joins the server. **Needs Manage Server Permissions.**| `.greet`
`.greetmsg` | Sets a new join announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.**| `.greetmsg Welcome to the server, %user%.` `.greetmsg` | Sets a new join announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.**| `.greetmsg Welcome, %user%.`
`.bye` | Toggles anouncements on the current channel when someone leaves the server. | `.bye` `.bye` | Toggles anouncements on the current channel when someone leaves the server. | `.bye`
`.byemsg` | Sets a new leave announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current bye message. **Needs Manage Server Permissions.**| `.byemsg %user% has left the server.` `.byemsg` | Sets a new leave announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current bye message. **Needs Manage Server Permissions.**| `.byemsg %user% has left.`
`.byepm` | Toggles whether the good bye messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**| `.byepm` `.byepm` | Toggles whether the good bye messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**| `.byepm`
`.greetpm` | Toggles whether the greet messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**| `.greetpm` `.greetpm` | Toggles whether the greet messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**| `.greetpm`
`.spmom` | Toggles whether mentions of other offline users on your server will send a pm to them. **Needs Manage Server Permissions.**| `.spmom` `.spmom` | Toggles whether mentions of other offline users on your server will send a pm to them. **Needs Manage Server Permissions.**| `.spmom`
@ -73,7 +73,7 @@ Command and aliases | Description | Usage
`.settopic`, `.st` | Sets a topic on the current channel. **Needs Manage Channel Permissions.** | `.st My new topic` `.settopic`, `.st` | Sets a topic on the current channel. **Needs Manage Channel Permissions.** | `.st My new topic`
`.setchanlname`, `.schn` | Changed the name of the current channel. **Needs Manage Channel Permissions.**| `.schn NewName` `.setchanlname`, `.schn` | Changed the name of the current channel. **Needs Manage Channel Permissions.**| `.schn NewName`
`.heap` | Shows allocated memory - **Bot Owner Only!** | `.heap` `.heap` | Shows allocated memory - **Bot Owner Only!** | `.heap`
`.prune`, `.clr` | `.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel. | `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X` `.prune`, `.clr` | `.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel. **Needs Manage Messages Permissions**| `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X`
`.die` | Shuts the bot down and notifies users about the restart. **Bot Owner Only!** | `.die` `.die` | Shuts the bot down and notifies users about the restart. **Bot Owner Only!** | `.die`
`.setname`, `.newnm` | Give the bot a new name. **Bot Owner Only!** | `.newnm BotName` `.setname`, `.newnm` | Give the bot a new name. **Bot Owner Only!** | `.newnm BotName`
`.newavatar`, `.setavatar` | Sets a new avatar image for the NadekoBot. Argument is a direct link to an image. **Bot Owner Only!** | `.setavatar http://i.imgur.com/xTG3a1I.jpg` `.newavatar`, `.setavatar` | Sets a new avatar image for the NadekoBot. Argument is a direct link to an image. **Bot Owner Only!** | `.setavatar http://i.imgur.com/xTG3a1I.jpg`
@ -168,7 +168,7 @@ Command and aliases | Description | Usage
`$flip` | Flips coin(s) - heads or tails, and shows an image. | `$flip` or `$flip 3` `$flip` | Flips coin(s) - heads or tails, and shows an image. | `$flip` or `$flip 3`
`$betflip`, `$bf` | Bet to guess will the result be heads or tails. Guessing award you double flowers you've bet. | `$bf 5 heads` or `$bf 3 t` `$betflip`, `$bf` | Bet to guess will the result be heads or tails. Guessing award you double flowers you've bet. | `$bf 5 heads` or `$bf 3 t`
`$roll` | Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice. If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `$roll` or `$roll 7` or `$roll 3d5` `$roll` | Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice. If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `$roll` or `$roll 7` or `$roll 3d5`
`$rolluo` | Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice (unordered). If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `$roll` or `$roll` 7 or `$roll 3d5` `$rolluo` | Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice (unordered). If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. | `$rolluo` or `$rolluo 7` or `$rolluo 3d5`
`$nroll` | Rolls in a given range. | `$nroll 5` (rolls 0-5) or `$nroll 5-15` `$nroll` | Rolls in a given range. | `$nroll 5` (rolls 0-5) or `$nroll 5-15`
`$race` | Starts a new animal race. | `$race` `$race` | Starts a new animal race. | `$race`
`$joinrace`, `$jr` | Joins a new race. You can specify an amount of flowers for betting (optional). You will get YourBet*(participants-1) back if you win. | `$jr` or `$jr 5` `$joinrace`, `$jr` | Joins a new race. You can specify an amount of flowers for betting (optional). You will get YourBet*(participants-1) back if you win. | `$jr` or `$jr 5`
@ -189,7 +189,7 @@ Command and aliases | Description | Usage
`>typestart` | Starts a typing contest. | `>typestart` `>typestart` | Starts a typing contest. | `>typestart`
`>typestop` | Stops a typing contest on the current channel. | `>typestop` `>typestop` | Stops a typing contest on the current channel. | `>typestop`
`>typeadd` | Adds a new article to the typing contest. Owner only. | `>typeadd wordswords` `>typeadd` | Adds a new article to the typing contest. Owner only. | `>typeadd wordswords`
`>poll` | Creates a poll, only person who has manage server permission can do it. | `>poll Question?;Answer1;Answ 2;A_3` `>poll` | Creates a poll, only person who has manage server permission can do it. **Needs Manage Server Permissions**| `>poll Question?;Answer1;Answ 2;A_3`
`>pollend` | Stops active poll on this server and prints the results in this channel. | `>pollend` `>pollend` | Stops active poll on this server and prints the results in this channel. | `>pollend`
`>pick` | Picks a flower planted in this channel. | `>pick` `>pick` | Picks a flower planted in this channel. | `>pick`
`>plant` | Spend a flower to plant it in this channel. (If bot is restarted or crashes, flower will be lost) | `>plant` `>plant` | Spend a flower to plant it in this channel. (If bot is restarted or crashes, flower will be lost) | `>plant`
@ -218,14 +218,14 @@ Command and aliases | Description | Usage
`!!half` | Sets the music volume to 50%. | `!!half` `!!half` | Sets the music volume to 50%. | `!!half`
`!!shuffle`, `!!sh` | Shuffles the current playlist. | `!!sh` `!!shuffle`, `!!sh` | Shuffles the current playlist. | `!!sh`
`!!playlist`, `!!pl` | Queues up to 500 songs from a youtube playlist specified by a link, or keywords. | `!!pl playlist link or name` `!!playlist`, `!!pl` | Queues up to 500 songs from a youtube playlist specified by a link, or keywords. | `!!pl playlist link or name`
`!!soundcloudpl`, `!!scpl` | Queue a soundcloud playlist using a link. | `!!scpl https://soundcloud.com/saratology/sets/symphony` `!!soundcloudpl`, `!!scpl` | Queue a soundcloud playlist using a link. | `!!scpl soundcloudseturl`
`!!localplaylst`, `!!lopl` | Queues all songs from a directory. **Bot Owner Only!** | `!!lopl C:/music/classical` `!!localplaylst`, `!!lopl` | Queues all songs from a directory. **Bot Owner Only!** | `!!lopl C:/music/classical`
`!!radio`, `!!ra` | Queues a radio stream from a link. It can be a direct mp3 radio stream, .m3u, .pls .asx or .xspf (Usage Video: <https://streamable.com/al54>) | `!!ra radio link here` `!!radio`, `!!ra` | Queues a radio stream from a link. It can be a direct mp3 radio stream, .m3u, .pls .asx or .xspf (Usage Video: <https://streamable.com/al54>) | `!!ra radio link here`
`!!local`, `!!lo` | Queues a local file by specifying a full path. **Bot Owner Only!** | `!!lo C:/music/mysong.mp3` `!!local`, `!!lo` | Queues a local file by specifying a full path. **Bot Owner Only!** | `!!lo C:/music/mysong.mp3`
`!!move`, `!!mv` | Moves the bot to your voice channel. (works only if music is already playing) | `!!mv` `!!move`, `!!mv` | Moves the bot to your voice channel. (works only if music is already playing) | `!!mv`
`!!remove`, `!!rm` | Remove a song by its # in the queue, or 'all' to remove whole queue. | `!!rm 5` `!!remove`, `!!rm` | Remove a song by its # in the queue, or 'all' to remove whole queue. | `!!rm 5`
`!!movesong`, `!!ms` | Moves a song from one position to another. | `!! ms` 5>3 `!!movesong`, `!!ms` | Moves a song from one position to another. | `!! ms 5>3`
`!!setmaxqueue`, `!!smq` | Sets a maximum queue size. Supply 0 or no argument to have no limit. | `!!smq` 50 or `!!smq` `!!setmaxqueue`, `!!smq` | Sets a maximum queue size. Supply 0 or no argument to have no limit. | `!!smq 50` or `!!smq`
`!!cleanup` | Cleans up hanging voice connections. **Bot Owner Only!** | `!!cleanup` `!!cleanup` | Cleans up hanging voice connections. **Bot Owner Only!** | `!!cleanup`
`!!reptcursong`, `!!rcs` | Toggles repeat of current song. | `!!rcs` `!!reptcursong`, `!!rcs` | Toggles repeat of current song. | `!!rcs`
`!!rpeatplaylst`, `!!rpl` | Toggles repeat of all songs in the queue (every song that finishes is added to the end of the queue). | `!!rpl` `!!rpeatplaylst`, `!!rpl` | Toggles repeat of all songs in the queue (every song that finishes is added to the end of the queue). | `!!rpl`
@ -255,7 +255,7 @@ Command and aliases | Description | Usage
`~wowjoke` | Get one of Kwoth's penultimate WoW jokes. | `~wowjoke` `~wowjoke` | Get one of Kwoth's penultimate WoW jokes. | `~wowjoke`
`~calculate`, `~calc` | Evaluate a mathematical expression. | `~calc 1+1` `~calculate`, `~calc` | Evaluate a mathematical expression. | `~calc 1+1`
`~osu` | Shows osu stats for a player. | `~osu Name` or `~osu Name taiko` `~osu` | Shows osu stats for a player. | `~osu Name` or `~osu Name taiko`
`~osu b` | Shows information about an osu beatmap. |`~osu b` https://osu.ppy.sh/s/127712 `~osu b` | Shows information about an osu beatmap. |`~osu b https://osu.ppy.sh/s/127712`
`~osu top5` | Displays a user's top 5 plays. |`~osu top5 Name` `~osu top5` | Displays a user's top 5 plays. |`~osu top5 Name`
`~pokemon`, `~poke` | Searches for a pokemon. | `~poke Sylveon` `~pokemon`, `~poke` | Searches for a pokemon. | `~poke Sylveon`
`~pokemonability`, `~pokeab` | Searches for a pokemon ability. | `~pokeab "water gun"` `~pokemonability`, `~pokeab` | Searches for a pokemon ability. | `~pokeab "water gun"`