fixed prune, improved pokenoms
This commit is contained in:
		| @@ -385,9 +385,14 @@ namespace NadekoBot.Modules { | ||||
|                             var lastmessage = e.Channel.Messages.LastOrDefault(); | ||||
|                             while (num > 0 && lastmessage != null) { | ||||
|                                 msgs.ForEach(async m => await m.Delete()); | ||||
|                                 num -= 100; | ||||
|                                 int toDelete; | ||||
|                                 if (num > 100) | ||||
|                                     toDelete = 100; | ||||
|                                 else | ||||
|                                     toDelete = num; | ||||
|                                 num -= toDelete; | ||||
|                                 lastmessage = msgs.LastOrDefault(); | ||||
|                                 msgs = await e.Channel.DownloadMessages(100, lastmessage?.Id); | ||||
|                                 msgs = await e.Channel.DownloadMessages(toDelete, lastmessage?.Id); | ||||
|                             } | ||||
|                         } catch (Exception) { await e.Send("Failed pruning. Make sure the bot has correct permissions."); } | ||||
|  | ||||
|   | ||||
| @@ -26,12 +26,11 @@ namespace NadekoBot.Modules | ||||
|                     .Parameter("target",Discord.Commands.ParameterType.Required) | ||||
|                     .Do(async e => | ||||
|                     { | ||||
|                          | ||||
|                         var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault(); | ||||
|                         var usrType = GetType(usr.Id); | ||||
|                         string response = ""; | ||||
|                         int dmg = GetDamage(usrType, e.GetArg("attack_type").ToLowerInvariant()); | ||||
|                         response = e.GetArg("attack_type") + (e.GetArg("attack_type")=="splash"?"es ":"s ") + usr.Mention + " for " + dmg+".\n"; | ||||
|                         response = e.GetArg("attack_type") + (e.GetArg("attack_type") == "splash" ? "es " : "s ") + $"{usr.Mention}{GetImage(usrType)} for {dmg}\n"; | ||||
|                         if (dmg >= 65) | ||||
|                         { | ||||
|                             response += "It's super effective!"; | ||||
| @@ -39,7 +38,7 @@ namespace NadekoBot.Modules | ||||
|                         else if (dmg <= 35) { | ||||
|                             response += "Ineffective!"; | ||||
|                         } | ||||
|                         await e.Send(NadekoBot.botMention + " " + response); | ||||
|                         await e.Send($"{ e.User.Mention }{GetImage(GetType(e.User.Id))} {response}"); | ||||
|                     }); | ||||
|  | ||||
|                 cgb.CreateCommand("poketype") | ||||
| @@ -51,11 +50,37 @@ namespace NadekoBot.Modules | ||||
|                         if (usr == null) { | ||||
|                             await e.Send("No such person."); | ||||
|                         } | ||||
|  | ||||
|                         await e.Send(usr.Name + "'s type is " + GetType(usr.Id)); | ||||
|                         var t = GetType(usr.Id); | ||||
|                         await e.Send($"{usr.Name}'s type is {GetImage(t)} {t}"); | ||||
|                     }); | ||||
|             }); | ||||
|         } | ||||
|         /* | ||||
|  | ||||
|             🌿 or 🍃 or 🌱 Grass | ||||
| ⚡ Electric | ||||
| ❄ Ice | ||||
| ☁ Fly | ||||
| 🔥 Fire | ||||
| 💧 or 💦 Water | ||||
| ⭕ Normal | ||||
| 🐛 Insect | ||||
| 🌟 or 💫 or ✨ Fairy | ||||
|     */ | ||||
|         string GetImage(PokeType t) { | ||||
|             switch (t) { | ||||
|                 case PokeType.WATER: | ||||
|                     return "💦"; | ||||
|                 case PokeType.GRASS: | ||||
|                     return "🌿"; | ||||
|                 case PokeType.FIRE: | ||||
|                     return "🔥"; | ||||
|                 case PokeType.ELECTRICAL: | ||||
|                     return "⚡️"; | ||||
|                 default: | ||||
|                     return "⭕️"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private int GetDamage(PokeType targetType, string v) | ||||
|         { | ||||
| @@ -98,6 +123,9 @@ namespace NadekoBot.Modules | ||||
|         } | ||||
|  | ||||
|         private PokeType GetType(ulong id) { | ||||
|             if (id == 113760353979990024) | ||||
|                 return PokeType.FIRE; | ||||
|  | ||||
|             var remainder = id % 10; | ||||
|             if (remainder < 3) | ||||
|                 return PokeType.WATER; | ||||
|   | ||||
| @@ -77,10 +77,6 @@ | ||||
|       <HintPath>..\packages\VideoLibrary.1.3.3\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="libvideo.compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\VideoLibrary.Compat.1.3.3\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.compat.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|   | ||||
| @@ -12,5 +12,4 @@ | ||||
|   <package id="RestSharp" version="105.2.3" targetFramework="net452" /> | ||||
|   <package id="taglib" version="2.1.0.0" targetFramework="net452" /> | ||||
|   <package id="VideoLibrary" version="1.3.3" targetFramework="net452" /> | ||||
|   <package id="VideoLibrary.Compat" version="1.3.3" targetFramework="net452" /> | ||||
| </packages> | ||||
		Reference in New Issue
	
	Block a user