zita epsilon
zita epsilon
CC#
Created by zita epsilon on 4/23/2023 in #help
❔ Bot is stops running when i close replit tab
So i clicked "run" and started bot but when i close replit tab the bot is stopped. My friends used python and they say "we have keep_alive.py but i don't know how to do in C#". So, how can I host my bot 24/7 using replit, if I can't do you guys know any free vps or something else to do?
9 replies
CC#
Created by zita epsilon on 4/19/2023 in #help
❔ I can't create migration
13 replies
CC#
Created by zita epsilon on 4/17/2023 in #help
❔ Why it's not joining?
Settings on Discord Developer Portal is okay, but when i use !join command it's don't join to voice channel. Why?
[Command("join")]
public async Task Join(CommandContext ctx)
{
var user = ctx.Member;
var voiceChannel = user?.VoiceState?.Channel;

if (voiceChannel == null || voiceChannel.Type != ChannelType.Voice)
{
await ctx.RespondAsync("You must be in a voice channel to use this command.");

}
else
{
var voiceNext = ctx.Client.GetVoiceNext();
await voiceNext.ConnectAsync(voiceChannel);

await ctx.RespondAsync($"Connected to {voiceChannel.Name}");
}

}
[Command("join")]
public async Task Join(CommandContext ctx)
{
var user = ctx.Member;
var voiceChannel = user?.VoiceState?.Channel;

if (voiceChannel == null || voiceChannel.Type != ChannelType.Voice)
{
await ctx.RespondAsync("You must be in a voice channel to use this command.");

}
else
{
var voiceNext = ctx.Client.GetVoiceNext();
await voiceNext.ConnectAsync(voiceChannel);

await ctx.RespondAsync($"Connected to {voiceChannel.Name}");
}

}
10 replies
CC#
Created by zita epsilon on 4/17/2023 in #help
❔ Why, I already imported it
The bug is
Severity Code Description Project File Line Suppression State
Error CS1061 'CommandsNextExtension' does not contain a definition for 'SetPrefix' and no accessible extension method 'SetPrefix' accepting a first argument of type 'CommandsNextExtension' could be found (are you missing a using directive or an assembly reference?) DSharp C:\Users\Can\Desktop\DSharp\DSharp\Program.cs 40 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'CommandsNextExtension' does not contain a definition for 'SetPrefix' and no accessible extension method 'SetPrefix' accepting a first argument of type 'CommandsNextExtension' could be found (are you missing a using directive or an assembly reference?) DSharp C:\Users\Can\Desktop\DSharp\DSharp\Program.cs 40 Active
and the code I wrote
10 replies
CC#
Created by zita epsilon on 4/16/2023 in #help
❔ I wrote a discord bot but it's not answering me ?
using DSharpPlus;
using DSharpPlus.EventArgs;
using System.Threading.Tasks;

class Program
{
static DiscordClient discord;

static void Main(string[] args)
{
MainAsync().ConfigureAwait(false).GetAwaiter().GetResult();
}

static async Task MainAsync()
{
discord = new DiscordClient(new DiscordConfiguration
{
Token = "MTA5NzI0MDEyODA4MDA3Mjc3NQ.GJawtS.2odUYCCE4EGZwvHWso6G9mmyrGk9LqUB07HeVc",
TokenType = TokenType.Bot,
Intents = DiscordIntents.AllUnprivileged
});

discord.MessageCreated += async (s, e) =>
{
if (e.Message.Content.ToLower().StartsWith("!ping"))
{
await e.Message.RespondAsync("@here");
}
};

await discord.ConnectAsync();
await Task.Delay(-1);
}
}
using DSharpPlus;
using DSharpPlus.EventArgs;
using System.Threading.Tasks;

class Program
{
static DiscordClient discord;

static void Main(string[] args)
{
MainAsync().ConfigureAwait(false).GetAwaiter().GetResult();
}

static async Task MainAsync()
{
discord = new DiscordClient(new DiscordConfiguration
{
Token = "MTA5NzI0MDEyODA4MDA3Mjc3NQ.GJawtS.2odUYCCE4EGZwvHWso6G9mmyrGk9LqUB07HeVc",
TokenType = TokenType.Bot,
Intents = DiscordIntents.AllUnprivileged
});

discord.MessageCreated += async (s, e) =>
{
if (e.Message.Content.ToLower().StartsWith("!ping"))
{
await e.Message.RespondAsync("@here");
}
};

await discord.ConnectAsync();
await Task.Delay(-1);
}
}
Is there any wrong code or something else? And if there's no bug's in code maybe I couldn't authorize my bot to server. Do you guys know any tutorial for this or can you guys teach me how to add?
6 replies
CC#
Created by zita epsilon on 4/11/2023 in #help
❔ Can i develop a discord music bot or admin bot using C#?
If i can, how? Any idea?
11 replies
CC#
Created by zita epsilon on 4/10/2023 in #help
❔ This code is bugged how can i solve it?
LogiwaEntities1 db = new LogiwaEntities1();
ProductData productData = new ProductData();
productData.ProductName = txtProductName.Text;
string productName = productData.ProductName;
var x = db.tblProduct.Where(p => p.PRODUCTNAME == productName)
.Select(p => p.PRODUCTID)
.FirstOrDefault();
label3.Text = Convert.ToString(x);
db.tblProduct.Remove(x);
LogiwaEntities1 db = new LogiwaEntities1();
ProductData productData = new ProductData();
productData.ProductName = txtProductName.Text;
string productName = productData.ProductName;
var x = db.tblProduct.Where(p => p.PRODUCTNAME == productName)
.Select(p => p.PRODUCTID)
.FirstOrDefault();
label3.Text = Convert.ToString(x);
db.tblProduct.Remove(x);
39 replies