NP
NP
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by NP on 8/6/2023 in #djs-questions
application did not reply
Hi, I seem to be getting this error about the application not replying, but it replys in a seperate message. https://media.discordapp.net/attachments/1090613260195217519/1137334679020781618/image.png?width=223&height=129
4 replies
DIAdiscord.js - Imagine an app
Created by NP on 5/6/2023 in #djs-questions
Time not processing
Hi, can someone help me with a bug in the code? If I put 2m or 2d or 2w the bot takes all of them as 2s.
13 replies
DIAdiscord.js - Imagine an app
Created by NP on 5/2/2023 in #djs-questions
file being sent with content object object
Hi, the transcript file from here is being sent to GitHub with the contents of the file as [object Object] GitHub Integration:
import { Octokit } from "@octokit/rest";
import fs from "fs";

const octokit = new Octokit({ auth: "go3df8KI2dcd89" });

const owner = "repo";
const repo = "transcripts";
const branch = "main";

const createFileInRepo = async (
filePath: string,
content: string,
commitMessage: string,
) => {
try {
// Get the SHA of the latest commit
const { data: refData } = await octokit.git.getRef({
owner,
repo,
ref: `heads/${branch}`,
});
const sha = refData.object.sha;

// Get the latest commit
const { data: commitData } = await octokit.git.getCommit({
owner,
repo,
commit_sha: sha,
});

// Create a new tree with the new file
const { data: treeData } = await octokit.git.createTree({
owner,
repo,
base_tree: commitData.tree.sha,
tree: [
{
path: filePath,
mode: "100644",
content: content,
},
],
});

// Create a new commit with the new tree
const { data: commit } = await octokit.git.createCommit({
owner,
repo,
message: commitMessage,
tree: treeData.sha,
parents: [sha],
});

// Update the branch reference to point to the new commit
await octokit.git.updateRef({
owner,
repo,
ref: `heads/${branch}`,
sha: commit.sha,
});

console.log(`File ${filePath} created in repository ${owner}/${repo}`);
} catch (error) {
console.error(`Error creating file in repository: ${error}`);
}
};

export default createFileInRepo;
import { Octokit } from "@octokit/rest";
import fs from "fs";

const octokit = new Octokit({ auth: "go3df8KI2dcd89" });

const owner = "repo";
const repo = "transcripts";
const branch = "main";

const createFileInRepo = async (
filePath: string,
content: string,
commitMessage: string,
) => {
try {
// Get the SHA of the latest commit
const { data: refData } = await octokit.git.getRef({
owner,
repo,
ref: `heads/${branch}`,
});
const sha = refData.object.sha;

// Get the latest commit
const { data: commitData } = await octokit.git.getCommit({
owner,
repo,
commit_sha: sha,
});

// Create a new tree with the new file
const { data: treeData } = await octokit.git.createTree({
owner,
repo,
base_tree: commitData.tree.sha,
tree: [
{
path: filePath,
mode: "100644",
content: content,
},
],
});

// Create a new commit with the new tree
const { data: commit } = await octokit.git.createCommit({
owner,
repo,
message: commitMessage,
tree: treeData.sha,
parents: [sha],
});

// Update the branch reference to point to the new commit
await octokit.git.updateRef({
owner,
repo,
ref: `heads/${branch}`,
sha: commit.sha,
});

console.log(`File ${filePath} created in repository ${owner}/${repo}`);
} catch (error) {
console.error(`Error creating file in repository: ${error}`);
}
};

export default createFileInRepo;
11 replies
DIAdiscord.js - Imagine an app
Created by NP on 5/1/2023 in #djs-questions
Attachment sending in wrong channel.
Hi, the attachment is sending in the interaction channel and not logging channel. Anyone know why?
14 replies
DIAdiscord.js - Imagine an app
Created by NP on 5/1/2023 in #djs-questions
Help with file/send
Hi, I require some help as this code doesn't work.
10 replies
DIAdiscord.js - Imagine an app
Created by NP on 10/29/2022 in #djs-questions
How do I fix this issue?
26 replies
DIAdiscord.js - Imagine an app
Created by NP on 10/5/2022 in #djs-questions
modal error
46 replies
DIAdiscord.js - Imagine an app
Created by NP on 9/25/2022 in #djs-questions
Error when launching bot
3 replies
DIAdiscord.js - Imagine an app
Created by NP on 9/25/2022 in #djs-questions
Merging two bots together
I am a beginner developer and I am currently using github bots to help me learn to code. I have 2 bots which work great individually, but I would like them in the same bot - Can someone please help me to do this?
3 replies
DIAdiscord.js - Imagine an app
Created by NP on 9/25/2022 in #djs-questions
Add custom emoji to button
13 replies
DIAdiscord.js - Imagine an app
Created by NP on 9/22/2022 in #djs-questions
Error when sending bot to host
5 replies