Skip to content

Commit

Permalink
Add info on making screenshots (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: Kaz Yoshihara <[email protected]>
  • Loading branch information
hobovsky and kazk authored Jun 28, 2023
1 parent 468d43e commit 478f8f4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/commands/howto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const commands: HowtoCommand[] = [
{ emoji: "🧵", command: "create_thread" },
{ emoji: "🔗", command: "post_link" },
{ emoji: "#️⃣", command: "format_code" },
{ emoji: "📸", command: "screenshot" }
],
},
{
Expand All @@ -37,6 +38,11 @@ const commands: HowtoCommand[] = [
description: "How to post links to kata",
reactions: [],
},
{
name: "screenshot",
description: "How to post screenshots",
reactions: [],
},
];

const howtoTexts: Map<string, string> = getTexts(
Expand Down Expand Up @@ -91,8 +97,10 @@ export const call = async (interaction: ChatInputCommandInteraction) => {

if (dmReply) {
try {
await postHowtoDm(dmReply, targetUser);
await interactionReply(`${userMention(targetUser.id)} please check your DMs`, selfTarget);
await Promise.all([
postHowtoDm(dmReply, targetUser),
interactionReply(`${userMention(targetUser.id)} please check your DMs`, selfTarget)
]);
} catch (reason) {
let url = `https://github.com/codewars/discord-bot/blob/main/text/howto/${subCommand}.md`;
await interactionReply(
Expand All @@ -119,8 +127,9 @@ const postHowtoDm = async (command: HowtoCommand, targetUser: User) => {
return;
}
let message = await targetUser.send(body);
await Promise.all(command.reactions.map(r => message.react(r.emoji)));

await Promise.all(command.reactions.map(r => message.react(r.emoji)));

// Do not set up a collector if there are no reactions
if (!command.reactions.length) return;

Expand Down
4 changes: 4 additions & 0 deletions src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const LINKS: { [k: string]: { description: string; url: string } } = {
description: "Editors | The Codewars Docs",
url: "https://docs.codewars.com/references/kata-trainer/#editors",
},
screenshot: {
description: "Screenshot Help",
"url": "https://screenshot.help/"
}
};

// link
Expand Down
3 changes: 2 additions & 1 deletion text/howto/ask_for_help.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
- Create a thread to keep the discussion focused on your topic (react with :thread: `:thread:` or use `/howto create_thread` for more info).
- Explain what kata you are trying to solve. Post its title, and a link to its description (react with :link: `:link:` or use `/howto kata_link` for more info).
- Explain what your problem is. Tests do not accept your answers? Solution is timing out? Is there some other problem?
- Post **properly formatted** code of your solution (react with :hash: `:hash:` or use `/howto format_code` for more info).
- Post **properly formatted** code of your solution. (react with :hash: `:hash:` or use `/howto format_code` for more info).
- Please recognize good practices and common etiquette when posting screenshots (react with :camera_with_flash: `:camera_with_flash:` or use `/howto screenshot` for more info).
- If the code you posted contains spoilers for the discussed kata, please delete it after discussing your matter and getting all necessary help.
6 changes: 6 additions & 0 deletions text/howto/screenshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# How to post screenshots

- Please visit [Screenshot Help](https://screenshot.help) for info how to make screenshots on different platforms, devices, and OSes.
- Please do not post screenshots of code: code snippets shared by you should be easy to copy from Discord, paste into Codewars trainer or local IDE, and run.
- It's OK to post screenshots to show output of tests, problems with editor, etc.
- It's absolutely not OK to post photos of your screen made with your phone instead of screenshots.

0 comments on commit 478f8f4

Please sign in to comment.