fixed fish problem

also removed some unused code
master
Lan 3 years ago
parent 75095f36a5
commit 55fc6f4842
  1. BIN
      Kehyeedra3/AIMLbot.dll
  2. 36
      Kehyeedra3/Bot.cs
  3. 58
      Kehyeedra3/Command handler.cs
  4. 16
      Kehyeedra3/Commands/Economy.cs
  5. 2
      Kehyeedra3/Commands/Help.cs
  6. 2
      Kehyeedra3/Commands/Interactive.cs
  7. 3
      Kehyeedra3/Commands/Stuff.cs
  8. 6
      Kehyeedra3/Kehyeedra3.csproj
  9. 2
      Kehyeedra3/RatelimitAttribute.cs

Binary file not shown.

@ -4,7 +4,6 @@ using Discord;
using Discord.Commands; using Discord.Commands;
using Discord.WebSocket; using Discord.WebSocket;
using System.IO; using System.IO;
using AIMLbot;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System.Timers; using System.Timers;
using System.Net; using System.Net;
@ -21,14 +20,12 @@ namespace Kehyeedra3
/// Star Vars /// Star Vars
public static bool IsReady { get; private set; } public static bool IsReady { get; private set; }
public static DiscordSocketClient _bot; public static DiscordSocketClient _bot;
public static System.Timers.Timer Clockboy; //public static System.Timers.Timer Clockboy;
public static AudioService AudioService; public static AudioService AudioService;
public static CommandService _cmds; public static CommandService _cmds;
public static IServiceProvider _dmap; public static IServiceProvider _dmap;
public static CommandServiceConfig _cmdsconfig; public static CommandServiceConfig _cmdsconfig;
public static Random _rnd = new Random(); public static Random _rnd = new Random();
public static AIMLbot.Bot ChatService;
public static AIMLbot.User ChatUser;
public static string PathToUserData; public static string PathToUserData;
public static WebClient WeebClient; public static WebClient WeebClient;
public static ReminderService RmService; public static ReminderService RmService;
@ -38,8 +35,6 @@ namespace Kehyeedra3
// Environment.CurrentDirectory + @"Audio\cough1.wav", // Environment.CurrentDirectory + @"Audio\cough1.wav",
// Environment.CurrentDirectory + @"Audio\cough2.wav", // Environment.CurrentDirectory + @"Audio\cough2.wav",
// Environment.CurrentDirectory + @"Audio\wilhelmcough.wav", // Environment.CurrentDirectory + @"Audio\wilhelmcough.wav",
// Environment.CurrentDirectory + @"Audio\trapcough1.wav",
// Environment.CurrentDirectory + @"Audio\trapcough2.wav",
// Environment.CurrentDirectory + @"Audio\h3h3cough1.wav", // Environment.CurrentDirectory + @"Audio\h3h3cough1.wav",
// Environment.CurrentDirectory + @"Audio\h3h3cough2.wav", // Environment.CurrentDirectory + @"Audio\h3h3cough2.wav",
// Environment.CurrentDirectory + @"Audio\h3h3cough3.wav", // Environment.CurrentDirectory + @"Audio\h3h3cough3.wav",
@ -58,7 +53,7 @@ namespace Kehyeedra3
DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env")); DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env"));
var Config = Configuration.Load(); var Config = Configuration.Load();
Clockboy = new System.Timers.Timer(); //Clockboy = new System.Timers.Timer();
WeebClient = new WebClient(); WeebClient = new WebClient();
@ -89,7 +84,6 @@ namespace Kehyeedra3
await CommandHandler.InstallCommands(); await CommandHandler.InstallCommands();
EventHandlers.InstallEventHandlers(); EventHandlers.InstallEventHandlers();
InstallChatService();
//Clockboy.Elapsed += Clockboy_Elapsed; //Clockboy.Elapsed += Clockboy_Elapsed;
//Clockboy.Interval = SRandom.Next(3600000, 14400000); //Clockboy.Interval = SRandom.Next(3600000, 14400000);
@ -146,7 +140,7 @@ namespace Kehyeedra3
_bot.Ready += _bot_Ready; _bot.Ready += _bot_Ready;
await _bot.LoginAsync(TokenType.Bot, Configuration.Load().Token); await _bot.LoginAsync(TokenType.Bot, Configuration.Load().Token);
await _bot.StartAsync(); await _bot.StartAsync();
Clockboy.Start(); //Clockboy.Start();
//new Thread(async x => //new Thread(async x =>
//{ //{
// await Bot.RmService.Tick(); // await Bot.RmService.Tick();
@ -188,28 +182,6 @@ namespace Kehyeedra3
Environment.Exit(0); Environment.Exit(0);
} }
} }
public static void InstallChatService()
{
try
{
string path = Path.Combine(Environment.CurrentDirectory, "config",
"Settings.xml");
if (File.Exists(path))
{
ChatService = new AIMLbot.Bot();
ChatService.loadSettings(path);
ChatService.isAcceptingUserInput = false;
ChatService.loadAIMLFromFiles();
ChatService.isAcceptingUserInput = true;
PathToUserData = Path.Combine(Environment.CurrentDirectory, "aimlusers");
Console.WriteLine("Loaded: Chat Service");
}
else { }
}
catch(Exception ex)
{
Console.WriteLine (ex);
}
}
} }
} }

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Discord.WebSocket; using Discord.WebSocket;
using Discord.Commands; using Discord.Commands;
using System.Reflection; using System.Reflection;
using AIMLbot;
using System.IO; using System.IO;
using System.Data; using System.Data;
using Discord; using Discord;
@ -16,59 +15,6 @@ namespace Kehyeedra3
//Set CommandHandler as partial class of Bot //Set CommandHandler as partial class of Bot
class CommandHandler : Bot class CommandHandler : Bot
{ {
public static async Task KizunaAi(ICommandContext Context, String Message)
{
try
{
if (Message.Contains($"{Context.Client.CurrentUser.Id}"))
{
var messagearr = Message.Split(' ');
Message = String.Join(" ", messagearr.Skip(1).ToArray());
}
if (Message.ToLowerInvariant().Contains("what is "))
{
string fiNum = Message.Substring(8);
string result = new DataTable().Compute(fiNum, null).ToString();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}, {fiNum} = {result}");
}
else
{
bool triggeredphrase = false;
KeyValuePair<string, string> trigger = new KeyValuePair<string, string>("", "");
foreach (var phrase in Configuration.Load().TriggerPhrases)
{
if (Message.ToLowerInvariant().Contains(phrase.Key))
{
triggeredphrase = true;
trigger = phrase;
break;
}
}
if (!triggeredphrase)
{
ChatUser = new AIMLbot.User(Convert.ToString(Context.User.Id + ".dat"), ChatService);
if (!File.Exists(PathToUserData + "\\" + Context.User.Id + ".dat"))
ChatUser.Predicates.DictionaryAsXML.Save(PathToUserData + "\\" + Context.User.Id + ".dat");
ChatUser = new AIMLbot.User(Convert.ToString(Context.User.Id), ChatService);
ChatUser.Predicates.loadSettings(PathToUserData + "\\" + Context.User.Id + ".dat");
var r = new AIMLbot.Request(Message, ChatUser, ChatService);
var userresp = ChatService.Chat(r);
var response = userresp.Output;
ChatUser.Predicates.DictionaryAsXML.Save(PathToUserData + "\\" + Context.User.Id + ".dat");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}, {response}");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}, {trigger.Value}");
}
}
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
public static async Task InstallCommands() public static async Task InstallCommands()
{ {
//adds HandleCommand to handle the commands from message received //adds HandleCommand to handle the commands from message received
@ -108,10 +54,6 @@ namespace Kehyeedra3
int argPos = 0; int argPos = 0;
if (message.HasMentionPrefix(_bot.CurrentUser, ref argPos))
{
await KizunaAi(Context, message.Content);
}
if (message.Content.Contains("\uD83C\uDD71")) //B emoji detector if (message.Content.Contains("\uD83C\uDD71")) //B emoji detector
{ {
await Context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {Context.User.Mention}"); await Context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {Context.User.Mention}");

@ -742,7 +742,7 @@ namespace Kehyeedra3.Commands
outputStream.Position = 0; outputStream.Position = 0;
await Context.Channel.SendFileAsync(outputStream, $"fish.{outFormat}"); await Context.Channel.SendFileAsync(outputStream, $"fish.{outFormat}", $"{Context.User.Mention}");
} }
else else
@ -1006,6 +1006,7 @@ namespace Kehyeedra3.Commands
} }
if (inv.Any()) if (inv.Any())
{ {
Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>(); Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> med = new Dictionary<FishSpecies, int>(); Dictionary<FishSpecies, int> med = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> large = new Dictionary<FishSpecies, int>(); Dictionary<FishSpecies, int> large = new Dictionary<FishSpecies, int>();
@ -1062,6 +1063,12 @@ namespace Kehyeedra3.Commands
foreach (var entry in inv) foreach (var entry in inv)
{ {
if (!fishes.Any(x => x.Id == entry.Key))
{
inv.Remove(entry.Key);
continue;
}
fishmote = fishes.FirstOrDefault(x => x.Id == entry.Key).Emote; fishmote = fishes.FirstOrDefault(x => x.Id == entry.Key).Emote;
if (!fishmote.Contains("><")) if (!fishmote.Contains("><"))
@ -1546,9 +1553,14 @@ namespace Kehyeedra3.Commands
{ {
inv = feeshUser.GetInventory(); inv = feeshUser.GetInventory();
} }
List<Fish> fishes = Fishing.GetFishList();
foreach (var entry in inv) foreach (var entry in inv)
{ {
if (!fishes.Any(x => x.Id == entry.Key))
{
inv.Remove(entry.Key);
continue;
}
if (entry.Value.Count() > 0) if (entry.Value.Count() > 0)
{ {
if (entry.Value[0] > 0) if (entry.Value[0] > 0)

@ -39,7 +39,7 @@ namespace Kehyeedra3.Commands
} }
embed.AddField(module.Name, coommands.ToString()); embed.AddField(module.Name, coommands.ToString());
} }
await ReplyAsync("Here's a list of commands search for the command to find what it be and what it do", false, embed.Build()); await ReplyAsync("Here's a list of commands, search for a command to find what it be and what it do", false, embed.Build());
} }
else else
{ {

@ -882,7 +882,7 @@ namespace Kehyeedra3.Commands
} }
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
else if (input == "bulksell") else if (input == "bulksell" || input == "bs")
{ {
int value = 0; int value = 0;
int count = 0; int count = 0;

@ -141,7 +141,8 @@ namespace Kehyeedra3.Commands
"I think so", "I think so",
"Mayhaps", "Mayhaps",
"Yeah but you're still gay", "Yeah but you're still gay",
"No kys" "No kys",
"Not today",
}; };
int randomIndex = rando.Next(predictions.Length); int randomIndex = rando.Next(predictions.Length);
string text = predictions[randomIndex]; string text = predictions[randomIndex];

@ -19,12 +19,6 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="AIMLbot">
<HintPath>AIMLbot.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="libsodium.dll"> <None Update="libsodium.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

@ -97,7 +97,7 @@ namespace Kehyeedra3
} }
else else
{ {
return Task.FromResult(PreconditionResult.FromError("BRRROOOooooO WGHAT THE TFUCUKL YOU ARE SttuPPIIIIDDDD jas fapped in public pa po pe")); return Task.FromResult(PreconditionResult.FromError("Ok retard calm down"));
} }
} }

Loading…
Cancel
Save