mirror of
https://github.com/ION606/Discord-Client.git
synced 2026-05-15 05:16:55 +00:00
System message fix
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Discord_Client_Custom.Channels
|
||||
discriminator = inp["discriminator"].ToString();
|
||||
|
||||
//Check for deleted user
|
||||
if ((string)inp["avatar"] != "")
|
||||
if ((string)inp["avatar"] != null)
|
||||
{
|
||||
avatar = inp["avatar"].ToString();
|
||||
}
|
||||
|
||||
+17
-3
@@ -2,6 +2,7 @@
|
||||
using Discord_Client_Custom.Connections;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json.Nodes;
|
||||
@@ -147,16 +148,29 @@ namespace Discord_Client_Custom.Channels
|
||||
|
||||
if ((string)arr[startInd]["author"]["id"] == uMainId)
|
||||
{
|
||||
groupedMsgs[groupedMsgs.Count - 1] = new ChannelMsgGroup(msgObjTemp, dmFlowContent, uMainIcon, i);
|
||||
new ChannelMsgGroup(msgObjTemp, dmFlowContent, uMainIcon, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupedMsgs[groupedMsgs.Count - 1] = new ChannelMsgGroup(msgObjTemp, dmFlowContent, uicon, i);
|
||||
new ChannelMsgGroup(msgObjTemp, dmFlowContent, uicon, i);
|
||||
}
|
||||
}
|
||||
|
||||
lastSent = id_current;
|
||||
|
||||
//Check if this is a system DM
|
||||
if (arr[0]["author"]["system"] != null)
|
||||
{
|
||||
var cantSendLabel = new Label();
|
||||
cantSendLabel.Text = "This is a system channel, so you can't send any messages!";
|
||||
|
||||
dmFlowContent.Controls.Add(cantSendLabel, 0, i + 1);
|
||||
dmFlowContent.SetColumnSpan(cantSendLabel, 2);
|
||||
dmFlowContent.ScrollControlIntoView(cantSendLabel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Add the text box
|
||||
var txtbx = new RichTextBox();
|
||||
txtbx.AutoWordSelection = true;
|
||||
@@ -248,7 +262,7 @@ namespace Discord_Client_Custom.Channels
|
||||
|
||||
var imgRaw = await getIconStream(iconUrl);
|
||||
imgRaw.Tag = iconUrl;
|
||||
return imgRaw;
|
||||
return (Image)(new Bitmap(imgRaw, new Size(32, 32))); ;
|
||||
|
||||
//string rootPath = @"C:\DownloadedImageFromUrl";
|
||||
//string fileName = System.IO.Path.Combine(rootPath, "test.gif");
|
||||
|
||||
@@ -46,7 +46,13 @@ namespace Discord_Client_Custom
|
||||
|
||||
private async void mainPage_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Console.WriteLine("ok");
|
||||
/*if (Environment.GetEnvironmentVariable("userToken") == null)
|
||||
{
|
||||
string promptValue = Prompt.ShowDialog("Please enter token", "prompt");
|
||||
|
||||
Environment.SetEnvironmentVariable("userToken", promptValue);
|
||||
}*/
|
||||
|
||||
var c = new Connection();
|
||||
var uInfoRaw = await c.connect(dmFlowPannel);
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord_Client_Custom.client_internals
|
||||
{
|
||||
internal static class Prompt
|
||||
{
|
||||
public static string ShowDialog(string text, string caption)
|
||||
{
|
||||
Form prompt = new Form()
|
||||
{
|
||||
Width = 500,
|
||||
Height = 150,
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||
Text = caption,
|
||||
StartPosition = FormStartPosition.CenterScreen
|
||||
};
|
||||
Label textLabel = new Label() { Left = 50, Top = 20, Text = text };
|
||||
TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 };
|
||||
|
||||
Label l2 = new Label();
|
||||
l2.Text = "https://discord.com/api/oauth2/authorize?client_id=1084141041403310130&redirect_uri=https%3A%2F%2Flocalhost%3A8690%2F&response_type=code&scope=identify";
|
||||
l2.Click += (object o, EventArgs a) =>
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = l2.Text,
|
||||
UseShellExecute = true
|
||||
});
|
||||
};
|
||||
|
||||
Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 90, DialogResult = DialogResult.OK };
|
||||
confirmation.Click += (sender, e) => { prompt.Close(); };
|
||||
prompt.Controls.Add(textBox);
|
||||
prompt.Controls.Add(l2);
|
||||
prompt.Controls.Add(confirmation);
|
||||
prompt.Controls.Add(textLabel);
|
||||
prompt.AcceptButton = confirmation;
|
||||
|
||||
string path = @"C:\path-to-file"; // CHANGE THIS
|
||||
using (FileStream fs = File.Create(path))
|
||||
{
|
||||
// writing data in string
|
||||
string dataasstring = "data"; //your data
|
||||
byte[] info = new UTF8Encoding(true).GetBytes(dataasstring);
|
||||
fs.Write(info, 0, info.Length);
|
||||
|
||||
// writing data in bytes already
|
||||
byte[] data = new byte[] { 0x0 };
|
||||
fs.Write(data, 0, data.Length);
|
||||
}
|
||||
|
||||
return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user