Moebytes
Moebytes
Explore posts from servers
CC#
Created by Moebytes on 2/27/2025 in #help
class constructor in c#
My editor wants to convert the following code
public class Ping : ICommand {
private readonly DiscordClient discord;
private readonly SocketUserMessage message;

public Ping(DiscordClient discord, SocketUserMessage message) {
this.discord = discord;
this.message = message;
}
}
public class Ping : ICommand {
private readonly DiscordClient discord;
private readonly SocketUserMessage message;

public Ping(DiscordClient discord, SocketUserMessage message) {
this.discord = discord;
this.message = message;
}
}
to this
public class Ping(DiscordClient discord, SocketUserMessage message) : ICommand {
private readonly DiscordClient discord = discord;
private readonly SocketUserMessage message = message;
}
public class Ping(DiscordClient discord, SocketUserMessage message) : ICommand {
private readonly DiscordClient discord = discord;
private readonly SocketUserMessage message = message;
}
is this the recommended way to write the constructor in c#? And do I still need the private readonly DiscordClient discord = discord; part or does that get automatically assigned.
27 replies
DIAdiscord.js - Imagine an app
Created by Moebytes on 8/22/2024 in #djs-voice
Seek option removed
In discord.js v12 there was an option to seek the audio stream while playing it like this:
connection.play(stream, {seek: start})
connection.play(stream, {seek: start})
But it seems to be removed, and now there isn't a way to play a stream from a different position.
player.play(resource)
player.play(resource)
I found an old issue that has some workaround code but its a bit annoying to use, when I think it should just be an option. https://github.com/discordjs/discord.js/issues/9208 Is there any plans to add this option?
7 replies