even more cleanup

This commit is contained in:
Adam R. Grey 2021-10-24 01:25:17 -04:00
parent 3f717df1d4
commit 09c69bcd19
5 changed files with 17 additions and 16 deletions

2
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net5.0/twitcher.dll",
"program": "${workspaceFolder}/bin/Debug/net5.0/twitch-agent.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

6
.vscode/tasks.json vendored
View File

@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/twitcher.csproj",
"${workspaceFolder}/twitch-agent.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/twitcher.csproj",
"${workspaceFolder}/twitch-agent.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@ -32,7 +32,7 @@
"args": [
"watch",
"run",
"${workspaceFolder}/twitcher.csproj",
"${workspaceFolder}/twitch-agent.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],

View File

@ -1,5 +1,6 @@
using franz;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using TwitchEventSub.Types.EventSubSubscription;
@ -36,16 +37,15 @@ namespace twitcher
//tf.ProduceMessage(new silver_messages.directorial.execute_command(){command = "ssl_expose", args = {twitcherConf.port.ToString()}});
httpd = new TwitchEventSub.Receiver(twitcherConf.port, twitcherConf.clientId, twitcherConf.clientSecret, twitcherConf.public_uri);
Task.WaitAll(
httpd.go(),
Task.Run(() => {httpd.Subscribe(SubscribableTypes.channel_follow,
new TwitchEventSub.Types.Conditions.ChannelFollow() { broadcaster_user_id = "12826" },
(tg) => {
Console.WriteLine("I'm the handler for a twitchogram!");
Console.WriteLine(JsonConvert.SerializeObject(tg));
}
);})
var theRunTask = httpd.go();
httpd.Subscribe(SubscribableTypes.channel_follow,
new TwitchEventSub.Types.Conditions.ChannelFollow() { broadcaster_user_id = "12826" },
(tg) => {
Console.WriteLine("I'm the handler for a twitchogram!");
Console.WriteLine(JsonConvert.SerializeObject(tg));
}
);
Task.WaitAll(theRunTask);
}
}
}

View File

@ -133,7 +133,6 @@ namespace TwitchEventSub
HttpListenerResponse response = context.Response;
string page = context.Request.Url.LocalPath.Substring(1);
Console.WriteLine($"{DateTime.Now.ToShortTimeString()} page requested: {page}");
var resp = "no resource";
response.StatusCode = (int)HttpStatusCode.NotFound;
lock (psuedoResources)
@ -213,8 +212,10 @@ namespace TwitchEventSub
}
}
}
Console.WriteLine($"returning status code {response.StatusCode}");
if(response.StatusCode != (int)HttpStatusCode.OK)
{
Console.WriteLine($"returning status code {response.StatusCode}");
}
byte[] buffer = Encoding.UTF8.GetBytes(resp);
response.ContentLength64 = buffer.Length;
Stream st = response.OutputStream;