There is a typo error and I can't figure it out

help
No description
12 Replies
Salman
Salman3mo ago
pls past the complete code here not a blurry screenshot $code
MODiX
MODiX3mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
⃟⃟⃟⃟⃟
⃟⃟⃟⃟⃟OP3mo ago
oky Can you wait a bit? I'm not available right now.
Salman
Salman3mo ago
feel free to share whenever you're availalbe. Many people here to help
Angius
Angius3mo ago
I can see something through the bluriness, so, uh, does Api class have a data1 property?
⃟⃟⃟⃟⃟
⃟⃟⃟⃟⃟OP3mo ago
using RestSharp; using Discord.WebSocket; using System.Threading.Tasks; using Bot.Commands; using Discord; using Newtonsoft.Json; namespace Bot.Command { public class Translations { public string translatedText { get; set; } } public class Data { Translations translations { get; set; } } public class Api { Data data { get; set; } } public class ÇeviriCommmand : ICommand { public string CommandName => "!çeviri"; public async Task ExecuteAsync(SocketMessage message) { string yazı = message.Content; if (string.IsNullOrEmpty(yazı)) { await (message as IUserMessage).ReplyAsync("Lütfen Bir Metin Girin"); } var client = new RestClient("https://deep-translate1.p.rapidapi.com/language/translate/v2"); var request = new RestRequest("posts", Method.Post); request.AddJsonBody(new { q = yazı, source = "tr", target = "en" }); request.AddHeader("x-rapidapi-host", "deep-translate1.p.rapidapi.com"); request.AddHeader("Content-Type", "application/json"); RestResponse response = client.Execute(request); Api sonuc = JsonConvert.DeserializeObject<Api>(response.Content); var embed = new EmbedBuilder() .WithDescription($"
{sonuc.data.translations.translatedText}
{sonuc.data.translations.translatedText}
") .Build(); await message.Channel.SendMessageAsync(embed: embed); } } } @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius3mo ago
$code
MODiX
MODiX3mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Angius
Angius3mo ago
And my previous comment stands, assuming the errors are still the same Does Api have a data property?
Anton
Anton3mo ago
read about access modifiers
⃟⃟⃟⃟⃟
⃟⃟⃟⃟⃟OP3mo ago
sorru sorry* yes and for some reason it doesn't send the embed message
Angius
Angius3mo ago
Any other errors?
Want results from more Discord servers?
Add your server