Changed some commands names to avoid conflicts

This commit is contained in:
Master Kwoth 2017-06-02 03:44:59 +02:00
parent 25a977545c
commit 524452e72e
10 changed files with 90 additions and 69 deletions

View File

@ -117,7 +117,7 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Claim(int number, int baseNumber, [Remainder] string other_name = null) public async Task BaseCall(int number, int baseNumber, [Remainder] string other_name = null)
{ {
var warsInfo = _service.GetWarInfo(Context.Guild, number); var warsInfo = _service.GetWarInfo(Context.Guild, number);
if (warsInfo == null || warsInfo.Item1.Count == 0) if (warsInfo == null || warsInfo.Item1.Count == 0)
@ -144,21 +144,21 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ClaimFinish1(int number, int baseNumber = 0) public async Task CallFinish1(int number, int baseNumber = 0)
{ {
await FinishClaim(number, baseNumber - 1, 1); await FinishClaim(number, baseNumber - 1, 1);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ClaimFinish2(int number, int baseNumber = 0) public async Task CallFinish2(int number, int baseNumber = 0)
{ {
await FinishClaim(number, baseNumber - 1, 2); await FinishClaim(number, baseNumber - 1, 2);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ClaimFinish(int number, int baseNumber = 0) public async Task CallFinish(int number, int baseNumber = 0)
{ {
await FinishClaim(number, baseNumber - 1); await FinishClaim(number, baseNumber - 1);
} }

View File

@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Gambling
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ShuffleDeck() public async Task DeckShuffle()
{ {
//var channel = (ITextChannel)Context.Channel; //var channel = (ITextChannel)Context.Channel;

View File

@ -493,7 +493,7 @@ namespace NadekoBot.Modules.Music
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[Priority(0)] [Priority(0)]
public Task Remove(int num) public Task SongRemove(int num)
{ {
MusicPlayer musicPlayer; MusicPlayer musicPlayer;
if ((musicPlayer = _music.GetPlayer(Context.Guild.Id)) == null) if ((musicPlayer = _music.GetPlayer(Context.Guild.Id)) == null)
@ -508,7 +508,7 @@ namespace NadekoBot.Modules.Music
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[Priority(1)] [Priority(1)]
public async Task Remove(string all) public async Task SongRemove(string all)
{ {
if (all.Trim().ToUpperInvariant() != "ALL") if (all.Trim().ToUpperInvariant() != "ALL")
return; return;

View File

@ -667,7 +667,6 @@ namespace NadekoBot.Modules.Searches
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.AddField(efb => efb.WithName("Username").WithValue(usr.ToString()).WithIsInline(false)) .AddField(efb => efb.WithName("Username").WithValue(usr.ToString()).WithIsInline(false))
.AddField(efb => efb.WithName("Avatar Url").WithValue(shortenedAvatarUrl).WithIsInline(false)) .AddField(efb => efb.WithName("Avatar Url").WithValue(shortenedAvatarUrl).WithIsInline(false))
//.AddField(efb => efb.WithName("Avatar Id").WithValue(usr.AvatarId).WithIsInline(false))
.WithThumbnailUrl(avatarUrl), Context.User.Mention).ConfigureAwait(false); .WithThumbnailUrl(avatarUrl), Context.User.Mention).ConfigureAwait(false);
} }

View File

@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Utility
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task SearchQuote(string keyword, [Remainder] string text) public async Task QuoteSearch(string keyword, [Remainder] string text)
{ {
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
return; return;

View File

@ -260,7 +260,7 @@ namespace NadekoBot.Modules.Utility
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task UserId(IGuildUser target = null) public async Task UserId([Remainder] IGuildUser target = null)
{ {
var usr = target ?? Context.User; var usr = target ?? Context.User;
await ReplyConfirmLocalized("userid", "🆔", Format.Bold(usr.ToString()), await ReplyConfirmLocalized("userid", "🆔", Format.Bold(usr.ToString()),

View File

@ -25,6 +25,7 @@ using NadekoBot.Services.Administration;
using NadekoBot.Services.Permissions; using NadekoBot.Services.Permissions;
using NadekoBot.Services.Utility; using NadekoBot.Services.Utility;
using NadekoBot.Services.Help; using NadekoBot.Services.Help;
using NadekoBot.Extensions;
namespace NadekoBot namespace NadekoBot
{ {
@ -256,6 +257,15 @@ namespace NadekoBot
await commandHandler.StartHandling().ConfigureAwait(false); await commandHandler.StartHandling().ConfigureAwait(false);
var _ = await CommandService.AddModulesAsync(this.GetType().GetTypeInfo().Assembly); var _ = await CommandService.AddModulesAsync(this.GetType().GetTypeInfo().Assembly);
//Console.WriteLine(string.Join(", ", CommandService.Commands
// .Distinct(x => x.Name + x.Module.Name)
// .SelectMany(x => x.Aliases)
// .GroupBy(x => x)
// .Where(x => x.Count() > 1)
// .Select(x => x.Key + $"({x.Count()})")));
#if GLOBAL_NADEKO #if GLOBAL_NADEKO
//unload modules which are not available on the public bot //unload modules which are not available on the public bot
CommandService CommandService

View File

@ -550,13 +550,13 @@
<value>`{0}cr Awesome Role`</value> <value>`{0}cr Awesome Role`</value>
</data> </data>
<data name="rolecolor_cmd" xml:space="preserve"> <data name="rolecolor_cmd" xml:space="preserve">
<value>rolecolor rc</value> <value>rolecolor roleclr</value>
</data> </data>
<data name="rolecolor_desc" xml:space="preserve"> <data name="rolecolor_desc" xml:space="preserve">
<value>Set a role's color to the hex or 0-255 rgb color value provided.</value> <value>Set a role's color to the hex or 0-255 rgb color value provided.</value>
</data> </data>
<data name="rolecolor_usage" xml:space="preserve"> <data name="rolecolor_usage" xml:space="preserve">
<value>`{0}rc Admin 255 200 100` or `{0}rc Admin ffba55`</value> <value>`{0}roleclr Admin 255 200 100` or `{0}roleclr Admin ffba55`</value>
</data> </data>
<data name="ban_cmd" xml:space="preserve"> <data name="ban_cmd" xml:space="preserve">
<value>ban b</value> <value>ban b</value>
@ -676,7 +676,7 @@
<value>`{0}schn NewName`</value> <value>`{0}schn NewName`</value>
</data> </data>
<data name="prune_cmd" xml:space="preserve"> <data name="prune_cmd" xml:space="preserve">
<value>prune clr</value> <value>prune clear</value>
</data> </data>
<data name="prune_desc" xml:space="preserve"> <data name="prune_desc" xml:space="preserve">
<value>`{0}prune` removes all Nadeko's messages in the last 100 messages. `{0}prune X` removes last `X` number of messages from the channel (up to 100). `{0}prune @Someone` removes all Someone's messages in the last 100 messages. `{0}prune @Someone X` removes last `X` number of 'Someone's' messages in the channel.</value> <value>`{0}prune` removes all Nadeko's messages in the last 100 messages. `{0}prune X` removes last `X` number of messages from the channel (up to 100). `{0}prune @Someone` removes all Someone's messages in the last 100 messages. `{0}prune @Someone X` removes last `X` number of 'Someone's' messages in the channel.</value>
@ -871,7 +871,7 @@
<value>Shows user ID.</value> <value>Shows user ID.</value>
</data> </data>
<data name="userid_usage" xml:space="preserve"> <data name="userid_usage" xml:space="preserve">
<value>`{0}uid` or `{0}uid "@SomeGuy"`</value> <value>`{0}uid` or `{0}uid @SomeGuy`</value>
</data> </data>
<data name="channelid_cmd" xml:space="preserve"> <data name="channelid_cmd" xml:space="preserve">
<value>channelid cid</value> <value>channelid cid</value>
@ -1143,13 +1143,13 @@
<data name="showquote_usage" xml:space="preserve"> <data name="showquote_usage" xml:space="preserve">
<value>`{0}.. abc`</value> <value>`{0}.. abc`</value>
</data> </data>
<data name="searchquote_cmd" xml:space="preserve"> <data name="quotesearch_cmd" xml:space="preserve">
<value>qsearch</value> <value>qsearch</value>
</data> </data>
<data name="searchquote_desc" xml:space="preserve"> <data name="quotesearch_desc" xml:space="preserve">
<value>Shows a random quote for a keyword that contains any text specified in the search.</value> <value>Shows a random quote for a keyword that contains any text specified in the search.</value>
</data> </data>
<data name="searchquote_usage" xml:space="preserve"> <data name="quotesearch_usage" xml:space="preserve">
<value>`{0}qsearch keyword text`</value> <value>`{0}qsearch keyword text`</value>
</data> </data>
<data name="quoteid_cmd" xml:space="preserve"> <data name="quoteid_cmd" xml:space="preserve">
@ -1161,14 +1161,14 @@
<data name="quoteid_usage" xml:space="preserve"> <data name="quoteid_usage" xml:space="preserve">
<value>`{0}qid 123456`</value> <value>`{0}qid 123456`</value>
</data> </data>
<data name="deletequote_cmd" xml:space="preserve"> <data name="quotedelete_cmd" xml:space="preserve">
<value>deletequote delq</value> <value>quotedel qdel</value>
</data> </data>
<data name="deletequote_desc" xml:space="preserve"> <data name="quotedelete_desc" xml:space="preserve">
<value>Deletes a quote with the specified ID. You have to be either server Administrator or the creator of the quote to delete it.</value> <value>Deletes a quote with the specified ID. You have to be either server Administrator or the creator of the quote to delete it.</value>
</data> </data>
<data name="deletequote_usage" xml:space="preserve"> <data name="quotedelete_usage" xml:space="preserve">
<value>`{0}delq 123456`</value> <value>`{0}qdel 123456`</value>
</data> </data>
<data name="draw_cmd" xml:space="preserve"> <data name="draw_cmd" xml:space="preserve">
<value>draw</value> <value>draw</value>
@ -1180,13 +1180,13 @@
<value>`{0}draw` or `{0}draw 5`</value> <value>`{0}draw` or `{0}draw 5`</value>
</data> </data>
<data name="shuffleplaylist_cmd" xml:space="preserve"> <data name="shuffleplaylist_cmd" xml:space="preserve">
<value>shuffle sh</value> <value>playlistshuffle plsh</value>
</data> </data>
<data name="shuffleplaylist_desc" xml:space="preserve"> <data name="shuffleplaylist_desc" xml:space="preserve">
<value>Shuffles the current playlist.</value> <value>Shuffles the current playlist.</value>
</data> </data>
<data name="shuffleplaylist_usage" xml:space="preserve"> <data name="shuffleplaylist_usage" xml:space="preserve">
<value>`{0}sh`</value> <value>`{0}plsh`</value>
</data> </data>
<data name="flip_cmd" xml:space="preserve"> <data name="flip_cmd" xml:space="preserve">
<value>flip</value> <value>flip</value>
@ -1267,7 +1267,7 @@
<value>Give someone a certain amount of currency.</value> <value>Give someone a certain amount of currency.</value>
</data> </data>
<data name="give_usage" xml:space="preserve"> <data name="give_usage" xml:space="preserve">
<value>`{0}give 1 "@SomeGuy"`</value> <value>`{0}give 1 @SomeGuy`</value>
</data> </data>
<data name="award_cmd" xml:space="preserve"> <data name="award_cmd" xml:space="preserve">
<value>award</value> <value>award</value>
@ -1285,7 +1285,7 @@
<value>Takes a certain amount of currency from someone.</value> <value>Takes a certain amount of currency from someone.</value>
</data> </data>
<data name="take_usage" xml:space="preserve"> <data name="take_usage" xml:space="preserve">
<value>`{0}take 1 "@someguy"`</value> <value>`{0}take 1 @SomeGuy`</value>
</data> </data>
<data name="betroll_cmd" xml:space="preserve"> <data name="betroll_cmd" xml:space="preserve">
<value>betroll br</value> <value>betroll br</value>
@ -1611,14 +1611,14 @@
<data name="move_usage" xml:space="preserve"> <data name="move_usage" xml:space="preserve">
<value>`{0}mv`</value> <value>`{0}mv`</value>
</data> </data>
<data name="remove_cmd" xml:space="preserve"> <data name="songremove_cmd" xml:space="preserve">
<value>remove rm</value> <value>songremove srm</value>
</data> </data>
<data name="remove_desc" xml:space="preserve"> <data name="remove_desc" xml:space="preserve">
<value>Remove a song by its # in the queue, or 'all' to remove whole queue.</value> <value>Remove a song by its # in the queue, or 'all' to remove all songs from the queue.</value>
</data> </data>
<data name="remove_usage" xml:space="preserve"> <data name="remove_usage" xml:space="preserve">
<value>`{0}rm 5`</value> <value>`{0}srm 5`</value>
</data> </data>
<data name="movesong_cmd" xml:space="preserve"> <data name="movesong_cmd" xml:space="preserve">
<value>movesong ms</value> <value>movesong ms</value>
@ -2059,7 +2059,7 @@
<value>Returns a Google reverse image search for someone's avatar.</value> <value>Returns a Google reverse image search for someone's avatar.</value>
</data> </data>
<data name="revav_usage" xml:space="preserve"> <data name="revav_usage" xml:space="preserve">
<value>`{0}revav "@SomeGuy"`</value> <value>`{0}revav @SomeGuy`</value>
</data> </data>
<data name="revimg_cmd" xml:space="preserve"> <data name="revimg_cmd" xml:space="preserve">
<value>revimg</value> <value>revimg</value>
@ -2089,13 +2089,13 @@
<value>`{0}wiki query`</value> <value>`{0}wiki query`</value>
</data> </data>
<data name="color_cmd" xml:space="preserve"> <data name="color_cmd" xml:space="preserve">
<value>color clr</value> <value>color</value>
</data> </data>
<data name="color_desc" xml:space="preserve"> <data name="color_desc" xml:space="preserve">
<value>Shows you what color corresponds to that hex.</value> <value>Shows you what color corresponds to that hex.</value>
</data> </data>
<data name="color_usage" xml:space="preserve"> <data name="color_usage" xml:space="preserve">
<value>`{0}clr 00ff00`</value> <value>`{0}color 00ff00`</value>
</data> </data>
<data name="videocall_cmd" xml:space="preserve"> <data name="videocall_cmd" xml:space="preserve">
<value>videocall</value> <value>videocall</value>
@ -2104,7 +2104,7 @@
<value>Creates a private &lt;http://www.appear.in&gt; video call link for you and other mentioned people. The link is sent to mentioned people via a private message.</value> <value>Creates a private &lt;http://www.appear.in&gt; video call link for you and other mentioned people. The link is sent to mentioned people via a private message.</value>
</data> </data>
<data name="videocall_usage" xml:space="preserve"> <data name="videocall_usage" xml:space="preserve">
<value>`{0}videocall "@SomeGuy"`</value> <value>`{0}videocall "@the First" "@Xyz"`</value>
</data> </data>
<data name="avatar_cmd" xml:space="preserve"> <data name="avatar_cmd" xml:space="preserve">
<value>avatar av</value> <value>avatar av</value>
@ -2113,7 +2113,7 @@
<value>Shows a mentioned person's avatar.</value> <value>Shows a mentioned person's avatar.</value>
</data> </data>
<data name="avatar_usage" xml:space="preserve"> <data name="avatar_usage" xml:space="preserve">
<value>`{0}av "@SomeGuy"`</value> <value>`{0}av @SomeGuy`</value>
</data> </data>
<data name="hentai_cmd" xml:space="preserve"> <data name="hentai_cmd" xml:space="preserve">
<value>hentai</value> <value>hentai</value>
@ -2169,15 +2169,6 @@
<data name="e621_usage" xml:space="preserve"> <data name="e621_usage" xml:space="preserve">
<value>`{0}e621 yuri kissing`</value> <value>`{0}e621 yuri kissing`</value>
</data> </data>
<data name="cp_cmd" xml:space="preserve">
<value>cp</value>
</data>
<data name="cp_desc" xml:space="preserve">
<value>We all know where this will lead you to.</value>
</data>
<data name="cp_usage" xml:space="preserve">
<value>`{0}cp`</value>
</data>
<data name="boobs_cmd" xml:space="preserve"> <data name="boobs_cmd" xml:space="preserve">
<value>boobs</value> <value>boobs</value>
</data> </data>
@ -2223,44 +2214,44 @@
<data name="listwar_usage" xml:space="preserve"> <data name="listwar_usage" xml:space="preserve">
<value>`{0}lw [war_number]` or `{0}lw`</value> <value>`{0}lw [war_number]` or `{0}lw`</value>
</data> </data>
<data name="claim_cmd" xml:space="preserve"> <data name="basecall_cmd" xml:space="preserve">
<value>claim call c</value> <value>basecall</value>
</data> </data>
<data name="claim_desc" xml:space="preserve"> <data name="basecall_desc" xml:space="preserve">
<value>Claims a certain base from a certain war. You can supply a name in the third optional argument to claim in someone else's place.</value> <value>Claims a certain base from a certain war. You can supply a name in the third optional argument to claim in someone else's place.</value>
</data> </data>
<data name="claim_usage" xml:space="preserve"> <data name="basecall_usage" xml:space="preserve">
<value>`{0}call [war_number] [base_number] [optional_other_name]`</value> <value>`{0}basecall [war_number] [base_number] [optional_other_name]`</value>
</data> </data>
<data name="claimfinish_cmd" xml:space="preserve"> <data name="callfinish_cmd" xml:space="preserve">
<value>claimfinish cf</value> <value>callfinish cf</value>
</data> </data>
<data name="claimfinish_desc" xml:space="preserve"> <data name="callfinish_desc" xml:space="preserve">
<value>Finish your claim with 3 stars if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value> <value>Finish your claim with 3 stars if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value>
</data> </data>
<data name="claimfinish_usage" xml:space="preserve"> <data name="callfinish_usage" xml:space="preserve">
<value>`{0}cf 1` or `{0}cf 1 5`</value> <value>`{0}cf 1` or `{0}cf 1 5`</value>
</data> </data>
<data name="claimfinish2_cmd" xml:space="preserve"> <data name="callfinish2_cmd" xml:space="preserve">
<value>claimfinish2 cf2</value> <value>callfinish2 cf2</value>
</data> </data>
<data name="claimfinish2_desc" xml:space="preserve"> <data name="callfinish2_desc" xml:space="preserve">
<value>Finish your claim with 2 stars if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value> <value>Finish your claim with 2 stars if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value>
</data> </data>
<data name="claimfinish2_usage" xml:space="preserve"> <data name="callfinish2_usage" xml:space="preserve">
<value>`{0}cf2 1` or `{0}cf2 1 5`</value> <value>`{0}cf2 1` or `{0}cf2 1 5`</value>
</data> </data>
<data name="claimfinish1_cmd" xml:space="preserve"> <data name="callfinish1_cmd" xml:space="preserve">
<value>claimfinish1 cf1</value> <value>callfinish1 cf1</value>
</data> </data>
<data name="claimfinish1_desc" xml:space="preserve"> <data name="callfinish1_desc" xml:space="preserve">
<value>Finish your claim with 1 star if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value> <value>Finish your claim with 1 star if you destroyed a base. First argument is the war number, optional second argument is a base number if you want to finish for someone else.</value>
</data> </data>
<data name="claimfinish1_usage" xml:space="preserve"> <data name="callfinish1_usage" xml:space="preserve">
<value>`{0}cf1 1` or `{0}cf1 1 5`</value> <value>`{0}cf1 1` or `{0}cf1 1 5`</value>
</data> </data>
<data name="unclaim_cmd" xml:space="preserve"> <data name="unclaim_cmd" xml:space="preserve">
<value>unclaim ucall uc</value> <value>uncall</value>
</data> </data>
<data name="unclaim_desc" xml:space="preserve"> <data name="unclaim_desc" xml:space="preserve">
<value>Removes your claim from a certain war. Optional second argument denotes a person in whose place to unclaim</value> <value>Removes your claim from a certain war. Optional second argument denotes a person in whose place to unclaim</value>
@ -2335,10 +2326,10 @@
<value>Check how much currency a person has. (Defaults to yourself)</value> <value>Check how much currency a person has. (Defaults to yourself)</value>
</data> </data>
<data name="cash_usage" xml:space="preserve"> <data name="cash_usage" xml:space="preserve">
<value>`{0}$$` or `{0}$$ @SomeGuy`</value> <value>`{0}$` or `{0}$ @SomeGuy`</value>
</data> </data>
<data name="cash_cmd" xml:space="preserve"> <data name="cash_cmd" xml:space="preserve">
<value>cash $$</value> <value>$ currency $$ $$$ cash cur</value>
</data> </data>
<data name="listperms_desc" xml:space="preserve"> <data name="listperms_desc" xml:space="preserve">
<value>Lists whole permission chain with their indexes. You can specify an optional page number if there are a lot of permissions.</value> <value>Lists whole permission chain with their indexes. You can specify an optional page number if there are a lot of permissions.</value>
@ -2403,14 +2394,14 @@
<data name="showemojis_usage" xml:space="preserve"> <data name="showemojis_usage" xml:space="preserve">
<value>`{0}se A message full of SPECIAL emojis`</value> <value>`{0}se A message full of SPECIAL emojis`</value>
</data> </data>
<data name="shuffledeck_cmd" xml:space="preserve"> <data name="deckshuffle_cmd" xml:space="preserve">
<value>shuffle sh</value> <value>deckshuffle dsh</value>
</data> </data>
<data name="shuffledeck_desc" xml:space="preserve"> <data name="deckshuffle_desc" xml:space="preserve">
<value>Reshuffles all cards back into the deck.</value> <value>Reshuffles all cards back into the deck.</value>
</data> </data>
<data name="shuffledeck_usage" xml:space="preserve"> <data name="deckshuffle_usage" xml:space="preserve">
<value>`{0}sh`</value> <value>`{0}dsh`</value>
</data> </data>
<data name="forwardmessages_cmd" xml:space="preserve"> <data name="forwardmessages_cmd" xml:space="preserve">
<value>fwmsgs</value> <value>fwmsgs</value>

View File

@ -18,6 +18,12 @@ namespace NadekoBot.Extensions
{ {
public static class Extensions public static class Extensions
{ {
public static void ThrowIfNull<T>(this T obj, string name) where T : class
{
if (obj == null)
throw new ArgumentNullException(nameof(name));
}
public static ConcurrentDictionary<TKey, TValue> ToConcurrent<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> dict) public static ConcurrentDictionary<TKey, TValue> ToConcurrent<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> dict)
=> new ConcurrentDictionary<TKey, TValue>(dict); => new ConcurrentDictionary<TKey, TValue>(dict);

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NadekoBot.Extensions
{
public static class IEnumerableExtensions
{
public static IEnumerable<T> Distinct<T, U>(this IEnumerable<T> data, Func<T, U> getKey) =>
data.GroupBy(x => getKey(x))
.Select(x => x.First());
}
}