Skip to content

Commit

Permalink
Fixes PokeName for non Beta Testers
Browse files Browse the repository at this point in the history
  • Loading branch information
DJKoston committed Feb 11, 2023
1 parent 01be604 commit dcea555
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions GGTwitchBot.Bot/Bot.cs
Expand Up @@ -20,8 +20,8 @@ public class Bot
public string pokeName = null;
public bool pokeNameSet = false;

public string pokeBotUsername = "pokemoncommunitygame";
//public string pokeBotUsername = "djkoston";
//public string pokeBotUsername = "pokemoncommunitygame";
public string pokeBotUsername = "djkoston";

public Bot(IServiceProvider services, IConfiguration configuration)
{
Expand Down Expand Up @@ -522,32 +522,32 @@ private async void OnMessageReceived(object sender, OnMessageReceivedArgs e)
await _pokecatchService.RemoveAllCatchesAsync(e.ChatMessage.Channel);
Log($"Pokecatch started in {e.ChatMessage.Channel}");

if (betaTesters.Contains(e.ChatMessage.Channel))
{
HttpClient client = new();
HttpClient client = new();

if (newPCGSpawn == false)
if (newPCGSpawn == false)
{
using (Stream dataStream = await client.GetStreamAsync("https://poketwitch.bframework.de/info/events/last_spawn/"))
{
using (Stream dataStream = await client.GetStreamAsync("https://poketwitch.bframework.de/info/events/last_spawn/"))
{
StreamReader reader = new(dataStream);
StreamReader reader = new(dataStream);

string responseFromServer = reader.ReadToEnd();
string responseFromServer = reader.ReadToEnd();

var pcgAPI = JObject.Parse(responseFromServer);
var dexNumber = Convert.ToInt32(pcgAPI["pokedex_id"]).ToString("000");
var pcgAPI = JObject.Parse(responseFromServer);
var dexNumber = Convert.ToInt32(pcgAPI["pokedex_id"]).ToString("000");

pcgSpawn = await _pcgService.GetPokemonByDexNumberAsync(dexNumber);
pcgSpawn = await _pcgService.GetPokemonByDexNumberAsync(dexNumber);

if (pcgSpawn == null)
{
pcgSpawn = await _pcgService.GetPokemonByNameAsync(pokeName);
}
if (pcgSpawn == null)
{
pcgSpawn = await _pcgService.GetPokemonByNameAsync(pokeName);
}

newPCGSpawn = true;
}

newPCGSpawn = true;
}

if (betaTesters.Contains(e.ChatMessage.Channel))
{
GGSendMessage(e.ChatMessage.Channel, $"[#{pcgSpawn.DexNumber} {pcgSpawn.Name}] -> [Type] {pcgSpawn.Type} [Tier] {pcgSpawn.Tier} [Gen] {pcgSpawn.Generation} [Dex] {pcgSpawn.DexInfo} [Ball] {pcgSpawn.SuggestedBalls} [BST] {pcgSpawn.BST}");

var weeklyFile = File.ReadAllLines("/home/container/weekly.txt");
Expand Down Expand Up @@ -763,7 +763,7 @@ private void OnGGClientConnected(object sender, OnConnectedArgs e)

foreach (Streams stream in streamsToConnect)
{
GGTwitch.JoinChannel(stream.StreamerUsername);
//GGTwitch.JoinChannel(stream.StreamerUsername);
}
}

Expand Down

0 comments on commit dcea555

Please sign in to comment.