even more cleanup
This commit is contained in:
parent
3f717df1d4
commit
09c69bcd19
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -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
6
.vscode/tasks.json
vendored
@ -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"
|
||||
],
|
||||
|
18
Program.cs
18
Program.cs
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user