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",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// 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": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
// 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",
|
"type": "process",
|
||||||
"args": [
|
"args": [
|
||||||
"build",
|
"build",
|
||||||
"${workspaceFolder}/twitcher.csproj",
|
"${workspaceFolder}/twitch-agent.csproj",
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary"
|
"/consoleloggerparameters:NoSummary"
|
||||||
],
|
],
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"type": "process",
|
"type": "process",
|
||||||
"args": [
|
"args": [
|
||||||
"publish",
|
"publish",
|
||||||
"${workspaceFolder}/twitcher.csproj",
|
"${workspaceFolder}/twitch-agent.csproj",
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary"
|
"/consoleloggerparameters:NoSummary"
|
||||||
],
|
],
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"watch",
|
"watch",
|
||||||
"run",
|
"run",
|
||||||
"${workspaceFolder}/twitcher.csproj",
|
"${workspaceFolder}/twitch-agent.csproj",
|
||||||
"/property:GenerateFullPaths=true",
|
"/property:GenerateFullPaths=true",
|
||||||
"/consoleloggerparameters:NoSummary"
|
"/consoleloggerparameters:NoSummary"
|
||||||
],
|
],
|
||||||
|
18
Program.cs
18
Program.cs
@ -1,5 +1,6 @@
|
|||||||
using franz;
|
using franz;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TwitchEventSub.Types.EventSubSubscription;
|
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()}});
|
//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);
|
httpd = new TwitchEventSub.Receiver(twitcherConf.port, twitcherConf.clientId, twitcherConf.clientSecret, twitcherConf.public_uri);
|
||||||
Task.WaitAll(
|
var theRunTask = httpd.go();
|
||||||
httpd.go(),
|
httpd.Subscribe(SubscribableTypes.channel_follow,
|
||||||
Task.Run(() => {httpd.Subscribe(SubscribableTypes.channel_follow,
|
new TwitchEventSub.Types.Conditions.ChannelFollow() { broadcaster_user_id = "12826" },
|
||||||
new TwitchEventSub.Types.Conditions.ChannelFollow() { broadcaster_user_id = "12826" },
|
(tg) => {
|
||||||
(tg) => {
|
Console.WriteLine("I'm the handler for a twitchogram!");
|
||||||
Console.WriteLine("I'm the handler for a twitchogram!");
|
Console.WriteLine(JsonConvert.SerializeObject(tg));
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(tg));
|
}
|
||||||
}
|
|
||||||
);})
|
|
||||||
);
|
);
|
||||||
|
Task.WaitAll(theRunTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,6 @@ namespace TwitchEventSub
|
|||||||
HttpListenerResponse response = context.Response;
|
HttpListenerResponse response = context.Response;
|
||||||
|
|
||||||
string page = context.Request.Url.LocalPath.Substring(1);
|
string page = context.Request.Url.LocalPath.Substring(1);
|
||||||
Console.WriteLine($"{DateTime.Now.ToShortTimeString()} page requested: {page}");
|
|
||||||
var resp = "no resource";
|
var resp = "no resource";
|
||||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
lock (psuedoResources)
|
lock (psuedoResources)
|
||||||
@ -213,8 +212,10 @@ namespace TwitchEventSub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(response.StatusCode != (int)HttpStatusCode.OK)
|
||||||
Console.WriteLine($"returning status code {response.StatusCode}");
|
{
|
||||||
|
Console.WriteLine($"returning status code {response.StatusCode}");
|
||||||
|
}
|
||||||
byte[] buffer = Encoding.UTF8.GetBytes(resp);
|
byte[] buffer = Encoding.UTF8.GetBytes(resp);
|
||||||
response.ContentLength64 = buffer.Length;
|
response.ContentLength64 = buffer.Length;
|
||||||
Stream st = response.OutputStream;
|
Stream st = response.OutputStream;
|
||||||
|
Loading…
Reference in New Issue
Block a user