Skip to content

Instantly share code, notes, and snippets.

@0x00000FF
Created July 3, 2018 09:12
Show Gist options
  • Save 0x00000FF/ab9c10099424e8fef1148e2e09d907ac to your computer and use it in GitHub Desktop.
Save 0x00000FF/ab9c10099424e8fef1148e2e09d907ac to your computer and use it in GitHub Desktop.
using System;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace TrafficLight
{
public partial class TrafficLight : Form
{
int _status = 0;
const string token = "Your Discord Token Here";
enum status
{
dnd = 0, idle = 1, online = 2
}
public TrafficLight()
{
InitializeComponent();
}
private void traffic_Tick(object sender, EventArgs e)
{
if (_status == 3) _status = 0;
var req = (HttpWebRequest)WebRequest.Create("https://discordapp.com/api/v6/users/@me/settings");
SetPacket(req);
req.GetResponse().Close();
_status++;
}
private void SetPacket(HttpWebRequest req)
{
req.Method = "PATCH";
req.Accept = "*/*";
req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.301 Chrome/56.0.2924.87 Discord/1.6.15 Safari/537.36";
req.ContentType = "application/json";
req.Headers.Add("Authorization", token);
req.KeepAlive = true;
var str = "{\"status\":\"" + (status)_status + "\"}";
var data = Encoding.UTF8.GetBytes(str);
req.ContentLength = data.Length;
var writer = req.GetRequestStream();
writer.Write(data, 0, data.Length);
writer.Close();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment