I’ve been trying to create an !info command that changes the output based on whatever game is currently streaming on Twitch. As the command is longer than 400 character, I was suggested to try Lambda. As of now, it outputs Error 502 if I remove ?game=$(twitch TwitchUsernameHere "{{game}}")
Adding it back just outputs the command itself.
Currently, this is what I’m using as the command.
$(urlfetch json myurlgoeshere?game=$(twitch TwitchUsernameHere "{{game}}")
This is the JSON itself in Lamdba.
console.log('Loading function');
const doc = require('dynamodb-doc');
const dynamo = new doc.DynamoDB();
exports.handler = (event, context, callback) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
const done = (err, res) => callback(null, {
statusCode: err ? '400' : '200',
body: err ? err.message : JSON.stringify(res),
headers: {
'Content-Type': 'application/json',
},
});
var game = event.multiValueQueryStringParameters.game;
if (event.httpMethod === "GET") {
if (game === "The Elder Scrolls V: Skyrim")
return done(null, { response: "@$(user) > Difficulty: Legendary (1x vs 4.5x) | Race: Bosmer | Class: Thief | Mods, rules, and tweaks: URL here" });
else if (game === "S.T.A.L.K.E.R.: Call of Pripyat")
return done(null, { response: "@$(user) > Mod: Anomaly 1.5.0 [BETA 3.0] | Faction: Loner | Difficulty: Hard/Survivalist | Modifiers: Agony Mode, Campfire Saves, Dynamic Anomalies, Dynamic Faction Relations, Hardcore AI aim" });
else if (game === "Tom Clancy\'s Splinter Cell: Chaos Theory")
return done(null, { response: "@$(user) > Multiple POVs: URL here | Difficulty: Normal Mode, Expert Difficulty | Mods: SCFix, Thirteenag Widescreen Fix" });
else if (game === "Music & Performing Arts")
return done(null, { response: "@$(user) > DAW: Presonus Studio One 4 | Controller: Alesis V61 | Guitar: Squier Stratocaster Affinity (Modded) | Extra: URL HERE" });
else if (game === "Grand Theft Auto: San Andreas")
return done(null, { response: "@$(user) > Platform: PC [US 1.0] | Mods: CLEO, Crashes, EAX, ENB, GInput, Limit.cs, Movement.cs, Strafefix.cs, SALodLights, SilentPatch, SkyGFX, Various modloader fixes" });
else if (game === "The Legend of Zelda: Breath of the Wild")
return done(null, { response: "@$(user) > Platform: CEMU/Wii U [1080p/60fps tweak] | Version 1.5.0, DLC Ver.3.0" });
}
};