gamer50082
gamer50082
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by gamer50082 on 8/15/2023 in #djs-questions
BitFieldInvalid
const { Client, GatewayIntentBits, MessageEmbed } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.MessageCreate,
],
});

const token = 'YOUR_BOT_TOKEN'; // Replace with your bot token

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.on('messageCreate', async message => {
if (message.content === '/ping') {
const botLatency = Date.now() - message.createdTimestamp;
const embed = new MessageEmbed()
.setTitle('/ping')
.setDescription(`Bot Latency: ${botLatency}ms\nWebSocket latency: ${client.ws.ping}ms`)
.setFooter(`${client.user.username}`, client.user.avatarURL());

try {
await message.channel.send({ embeds: [embed] });
} catch (error) {
console.error(error);
}
}
});

client.login(token);
const { Client, GatewayIntentBits, MessageEmbed } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.MessageCreate,
],
});

const token = 'YOUR_BOT_TOKEN'; // Replace with your bot token

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.on('messageCreate', async message => {
if (message.content === '/ping') {
const botLatency = Date.now() - message.createdTimestamp;
const embed = new MessageEmbed()
.setTitle('/ping')
.setDescription(`Bot Latency: ${botLatency}ms\nWebSocket latency: ${client.ws.ping}ms`)
.setFooter(`${client.user.username}`, client.user.avatarURL());

try {
await message.channel.send({ embeds: [embed] });
} catch (error) {
console.error(error);
}
}
});

client.login(token);
100 replies
DIAdiscord.js - Imagine an app
Created by gamer50082 on 8/15/2023 in #djs-questions
Type error: cannot read properties of undefined
const { Client, Intents, MessageEmbed } = require('discord.js');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { SlashCommandBuilder } = require('@discordjs/builders');

const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
// Add the necessary intent for GUILD_COMMANDS
Intents.FLAGS.GUILD_MESSAGE_CONTENT,
],
});

const token = 'YOUR_BOT_TOKEN'; // Replace with your bot token
const clientId = 'YOUR_CLIENT_ID'; // Replace with your bot's client ID

const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with latency information'),
].map(command => command.toJSON());

const rest = new REST({ version: '9' }).setToken(token);

client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);

try {
console.log('Started refreshing global (/) commands.');

await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);

console.log('Successfully reloaded global (/) commands.');
} catch (error) {
console.error(error);
}
});

client.on('messageCreate', async message => {
if (message.content === '/ping') {
const botLatency = Date.now() - message.createdTimestamp;
const embed = new MessageEmbed()
.setTitle('/ping')
.setDescription(`Bot Latency: ${botLatency}ms\nWebSocket latency: ${client.ws.ping}ms`)
.setFooter(`${client.user.username}`, client.user.avatarURL());

try {
await message.channel.send({ embeds: [embed] });
} catch (error) {
console.error(error);
}
}
});

client.login(token);
const { Client, Intents, MessageEmbed } = require('discord.js');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { SlashCommandBuilder } = require('@discordjs/builders');

const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
// Add the necessary intent for GUILD_COMMANDS
Intents.FLAGS.GUILD_MESSAGE_CONTENT,
],
});

const token = 'YOUR_BOT_TOKEN'; // Replace with your bot token
const clientId = 'YOUR_CLIENT_ID'; // Replace with your bot's client ID

const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with latency information'),
].map(command => command.toJSON());

const rest = new REST({ version: '9' }).setToken(token);

client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);

try {
console.log('Started refreshing global (/) commands.');

await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);

console.log('Successfully reloaded global (/) commands.');
} catch (error) {
console.error(error);
}
});

client.on('messageCreate', async message => {
if (message.content === '/ping') {
const botLatency = Date.now() - message.createdTimestamp;
const embed = new MessageEmbed()
.setTitle('/ping')
.setDescription(`Bot Latency: ${botLatency}ms\nWebSocket latency: ${client.ws.ping}ms`)
.setFooter(`${client.user.username}`, client.user.avatarURL());

try {
await message.channel.send({ embeds: [embed] });
} catch (error) {
console.error(error);
}
}
});

client.login(token);
4 replies
DIAdiscord.js - Imagine an app
Created by gamer50082 on 8/14/2023 in #djs-questions
How to make it auto stop
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
],
});

const BOT_TOKEN = 'almostleakedthetoken’;

const commands = [
{
name: 'review',
description: 'Fetch review information',
options: [
{
name: 'reviewid',
description: 'ID of the review to fetch',
type: 3,
required: true,
},
],
},
{
name: 'userinfo',
description: 'Fetch user information',
options: [
{
name: 'userid',
description: 'ID of the user to fetch',
type: 3,
required: true,
},
],
},
];

(async () => {
await client.login(BOT_TOKEN);

const application = await client.application.fetch();
await application.commands.set(commands);

console.log('Slash commands deployed successfully.');
})();
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
],
});

const BOT_TOKEN = 'almostleakedthetoken’;

const commands = [
{
name: 'review',
description: 'Fetch review information',
options: [
{
name: 'reviewid',
description: 'ID of the review to fetch',
type: 3,
required: true,
},
],
},
{
name: 'userinfo',
description: 'Fetch user information',
options: [
{
name: 'userid',
description: 'ID of the user to fetch',
type: 3,
required: true,
},
],
},
];

(async () => {
await client.login(BOT_TOKEN);

const application = await client.application.fetch();
await application.commands.set(commands);

console.log('Slash commands deployed successfully.');
})();
23 replies
DIAdiscord.js - Imagine an app
Created by gamer50082 on 8/14/2023 in #djs-questions
Some issue with the code that doesn't allow the creation of slash command error code 400
discord.js slash command
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
],
});

const BOT_TOKEN = 'YOUR_BOT_TOKEN';

const commands = [
{
name: 'ping',
description: 'Ping pong!',
options: [
{
name: 'secret',
description: 'Secret code',
type: 'STRING',
required: true,
},
],
},
];

client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}!`);

// Register slash commands globally
const application = await client.application.fetch();
await application.commands.set(commands);
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;

const { commandName, options } = interaction;

if (commandName === 'ping') {
const secretOption = options.getString('secret');

if (secretOption === 'secretcode') {
await interaction.reply('Pong!');
} else {
await interaction.reply('Bong!');
}
}
});

client.login(BOT_TOKEN);
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
],
});

const BOT_TOKEN = 'YOUR_BOT_TOKEN';

const commands = [
{
name: 'ping',
description: 'Ping pong!',
options: [
{
name: 'secret',
description: 'Secret code',
type: 'STRING',
required: true,
},
],
},
];

client.once('ready', async () => {
console.log(`Logged in as ${client.user.tag}!`);

// Register slash commands globally
const application = await client.application.fetch();
await application.commands.set(commands);
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;

const { commandName, options } = interaction;

if (commandName === 'ping') {
const secretOption = options.getString('secret');

if (secretOption === 'secretcode') {
await interaction.reply('Pong!');
} else {
await interaction.reply('Bong!');
}
}
});

client.login(BOT_TOKEN);
58 replies
CC#
Created by gamer50082 on 5/5/2023 in #help
❔ the feature your trying to use is on a network resource that is unavailable
4 replies
CC#
Created by gamer50082 on 4/23/2023 in #help
✅ how to get this dependencies
Form1.Designer.cs(72,30,72,41): error CS0246: The type or namespace name 'MongoClient' could not be found (are you missing a using directive or an assembly reference?) Form1.Designer.cs(74,53,74,65): error CS0246: The type or namespace name 'BsonDocument' could not be found (are you missing a using directive or an assembly reference?) Form1.Designer.cs(77,35,77,47): error CS0246: The type or namespace name 'BsonDocument' could not be found (are you missing a using directive or an assembly reference?) Form1.Designer.cs(77,26,77,48): error CS0103: The name 'Builders' does not exist in the current context how to get those dependency
16 replies
CC#
Created by gamer50082 on 4/23/2023 in #help
✅ login registration form not working
3 forms mainform.cs shows 2 buttons register login register.cs contain 3 textbox [username] [password] [confirmpassword] 1 button to send [username] and [password] to /api/register. if credentials is correct it should receive (token) and (accountType {Basic, Premium}) login.cs contain 2 textbox [username] [password] to /api/login. if credentials is correct it should receive (token) and (accountType {Basic, Premium})
6 replies
CC#
Created by gamer50082 on 4/23/2023 in #help
✅ my ui and backend not working together
private const string ServerUrl = "http://144.24.154.156:5445/api/login"; // replace with your Node.js server URL

public Form3()
{
InitializeComponent();
}

private async void button1_Click(object sender, EventArgs e)
{
var username = textBox1.Text;
var password = textBox2.Text;

var client = new HttpClient();

var requestData = new Dictionary<string, string>
{
{"username", username},
{"password", password}
};
var requestContent = new FormUrlEncodedContent(requestData);

var response = await client.PostAsync(ServerUrl, requestContent);

var responseContent = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
MessageBox.Show("Login failed. Please check your username and password.");
return;
}

var responseData = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseContent);

var token = responseData["token"];
var accountType = responseData["accountType"];

if (accountType == "basic")
{
var form1 = new Form1(token);
form1.Show();
}
else if (accountType == "premium")
{
var form2 = new Form2(token);
form2.Show();
}

this.Hide();
}

private void button2_Click(object sender, EventArgs e)
{
var registerForm = new RegisterForm();
registerForm.Show();
this.Hide();
}
private const string ServerUrl = "http://144.24.154.156:5445/api/login"; // replace with your Node.js server URL

public Form3()
{
InitializeComponent();
}

private async void button1_Click(object sender, EventArgs e)
{
var username = textBox1.Text;
var password = textBox2.Text;

var client = new HttpClient();

var requestData = new Dictionary<string, string>
{
{"username", username},
{"password", password}
};
var requestContent = new FormUrlEncodedContent(requestData);

var response = await client.PostAsync(ServerUrl, requestContent);

var responseContent = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
MessageBox.Show("Login failed. Please check your username and password.");
return;
}

var responseData = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseContent);

var token = responseData["token"];
var accountType = responseData["accountType"];

if (accountType == "basic")
{
var form1 = new Form1(token);
form1.Show();
}
else if (accountType == "premium")
{
var form2 = new Form2(token);
form2.Show();
}

this.Hide();
}

private void button2_Click(object sender, EventArgs e)
{
var registerForm = new RegisterForm();
registerForm.Show();
this.Hide();
}
35 replies
CC#
Created by gamer50082 on 4/22/2023 in #help
✅ need someone to fix a html for me
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form action="http://144.24.154.156:5445/login" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>

<h1>Register</h1>
<form action="http://144.24.154.156:5445/register" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" name="confirm-password" required><br><br>
<button type="submit">Register</button>
</form>

<script>
// Parse the query string to get the token parameter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const token = urlParams.get('token');

// If a token was received, display it
if (token) {
const tokenElement = document.createElement('p');
tokenElement.textContent = `Your token is: ${token}`;
document.body.appendChild(tokenElement);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form action="http://144.24.154.156:5445/login" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>

<h1>Register</h1>
<form action="http://144.24.154.156:5445/register" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" name="confirm-password" required><br><br>
<button type="submit">Register</button>
</form>

<script>
// Parse the query string to get the token parameter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const token = urlParams.get('token');

// If a token was received, display it
if (token) {
const tokenElement = document.createElement('p');
tokenElement.textContent = `Your token is: ${token}`;
document.body.appendChild(tokenElement);
}
</script>
</body>
</html>
27 replies
CC#
Created by gamer50082 on 4/22/2023 in #help
✅ winform not working
not working at all only can open
27 replies
CC#
Created by gamer50082 on 4/21/2023 in #help
✅ making a winform that downloads files from github
need help making the system
54 replies
CC#
Created by gamer50082 on 4/20/2023 in #help
✅ Make an exe
an exe that isnt a token graber stop saying it is
95 replies