Giter Site home page Giter Site logo

larssieboy18 / discord-uno Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.33 MB

An UNO Discord bot hosted on Autocode

Home Page: https://autocode.com/mp/?fork=github%3Alarssieboy18%2Fdiscord-uno

License: MIT License

JavaScript 100.00%
bot discord javascript minigame uno

discord-uno's Introduction

Lars' GitHub stats

discord-uno's People

Contributors

allcontributors[bot] avatar datreeio[bot] avatar dependabot[bot] avatar github-actions[bot] avatar imgbotapp avatar larssieboy18 avatar mt-gitlocalize avatar renovate[bot] avatar restyled-commits avatar restyled-io[bot] avatar todo-actions[bot] avatar

Stargazers

 avatar

discord-uno's Issues

Special card handling on first turn

lines: 64,68
assignees: larssieboy18
labels: enhancement
If a special card is dealt at the first turn, the game should apply that effect to the first player (e.g. skip the player on a skip card, give 2 extra card on a +2 card, etc.)

Line: 28

playerHands[i] = startingDeck.slice(0, 7);
}
// TODO Special card handling on first turn
// lines: 64,68
// assignees: larssieboy18
// labels: enhancement
// If a special card is dealt at the first turn, the game should apply that effect to the first player (e.g. skip the player on a skip card, give 2 extra card on a +2 card, etc.)
// create discard pile
let discardPile = [];

cancel button for the game creator

assignees: larssieboy18
lines: 204, 205
labels: enhancement
Add a button to the embed that allows the user to cancel the game.

Line: 228

}
];
// TODO cancel button for the game creator
// assignees: larssieboy18
// lines: 204, 205
// labels: enhancement
// Add a button to the embed that allows the user to cancel the game.
/* Sending a message to the channel where the command was used. */
await responses.update(token, '', embed, [], 'CHANNEL_MESSAGE_WITH_SOURCE');

allAccepted initial message

labels: enhancement
assignees: larssieboy18
lines: 123,132
if everyone has accepted the game, the initial message should be edited to something like: "everyone has accepted the game. It has started in <#channel>"

Line: 117

it will send a message to the user who accepted the game saying that they will be notified when the
game starts. */
// TODO allAccepted initial message
// labels: enhancement
// assignees: larssieboy18
// lines: 123,132
// if everyone has accepted the game, the initial message should be edited to something like: "everyone has accepted the game. It has started in <#channel>"
let allAccepted
for (let i = 0; i < fields.length; i++) {

check if selected channel is a text channel

sometimes people can select a voice channel or category, either on purpose or by accident. This should cause the command to fail.
lines: 16, 20
assignees: larssieboy18
labels: enhancement

Line: 23

/* Getting the channel from the options. */
let channel = (data.options.find((option) => option.name == `channel`)).value;
// TODO check if selected channel is a text channel
// sometimes people can select a voice channel or category, either on purpose or by accident. This should cause the command to fail.
// lines: 16, 20
// assignees: larssieboy18
// labels: enhancement
// // check if there already is a game in progress inside the same channel
// let gameInProgress = await kv.get(`unoGame-${guild_id}-${channel}`, false);

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • Update dependency js-base64 to v3.7.3
  • Update actions/dependency-review-action action to v3

Detected dependencies

github-actions
.github/workflows/PR-labeler.yml
  • actions/labeler v4
.github/workflows/auto-assign.yml
  • technote-space/assign-author v1
.github/workflows/automatic-translation.yml
  • tomsun28/issues-translate-action v2.7
.github/workflows/automerge.yml
  • pascalgn/automerge-action v0.15.5
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/dependency-review.yml
  • actions/checkout v3
  • actions/dependency-review-action v2
.github/workflows/issue-labeler.yml
  • github/issue-labeler v2.5
.github/workflows/pr-checkboxes.yml
  • loxygenK/taskonfirm v1.0.0
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v5
.github/workflows/semgrep.yml
  • actions/checkout v3
.github/workflows/stale.yml
  • actions/stale v6
.github/workflows/todo.yml
npm
package.json
  • js-base64 3.7.2

  • Check this box to trigger a request for Renovate to run again on this repository

cancel button for the game creator

assignees: larssieboy18
lines: 204, 205
labels: enhancement
Add a button to the embed that allows the user to cancel the game.

Line: 228

}
];
// TODO cancel button for the game creator
// assignees: larssieboy18
// lines: 204, 205
// labels: enhancement
// Add a button to the embed that allows the user to cancel the game.
/* Sending a message to the channel where the command was used. */
await responses.update(token, '', embed, [], 'CHANNEL_MESSAGE_WITH_SOURCE');

Remove test data from `all.js`

Remove all test data, i.e. the one listed in the first 112 lines of this file, from all.js.
e.g. replace hello with event and remove the hello variable.
replace eventt with event and remove the eventt variable.

Line: 117

let hello = {
event: {
"version": 1,
"user": {
"username": "aCoolguy63",
"public_flags": 0,
"id": "793188304764928023",
"discriminator": "8503",
"avatar_decoration": null,
"avatar": "068c83a0ed3de3c445cc69bb5b1c6a5b"
},
"type": 3,
"token": "aW50ZXJhY3Rpb246MTAyMjU3NjMwNzcwOTY3NzcxMDpUNDFLbnk4ODJqN3ZkS2xpRWdjeld5WG1ocjdpMEJrUFZXRlQ5eEt2N0J1eFdsSG4xVldGUDhRb1J4UXNRcjlKajNFSDZ4N0xxYnZTYU8xbUZwSVc0MWE3a2JZOVVKb1hHUlh1NmtDd2xMR1hkMm1QcW41cHdiekF5RjBGZlZNeA",
"message": {
"type": 0,
"tts": false,
"timestamp": "2022-09-22T18:33:03.071000+00:00",
"pinned": false,
"mentions": [],
"mention_roles": [],
"mention_everyone": false,
"id": "1022576277359693965",
"flags": 0,
"embeds": [
{
"type": "rich",
"title": "UNO",
"fields": [
{
"value": "<@119473151913623552>",
"name": "Invited by",
"inline": true
},
{
"value": "<t:1663871577:f>",
"name": "Invited at",
"inline": true
},
{
"value": "**UNO BLUE & GREEN + CONFIG** (*ID*: `975789410186567730`)",
"name": "Server",
"inline": true
},
{
"value": "[Click here](https://discordapp.com/channels/975789410186567730/976400262677803018/1022576261450702918)",
"name": "Invite message",
"inline": true
},
{
"value": "โŒ",
"name": "Accepted by you?",
"inline": true
}
],
"description": "Hello <@793188304764928023>! You have been invited to play UNO.\nDo you accept?",
"color": 3092790
}
],
"edited_timestamp": null,
"content": "",
"components": [
{
"type": 1,
"components": [
{
"type": 2,
"style": 3,
"label": "Accept",
"emoji": {
"name": "acheck",
"id": "984488658658807818",
"animated": true
},
"custom_id": "accept-uno-invite"
},
{
"type": 2,
"style": 4,
"label": "Deny",
"emoji": {
"name": "across",
"id": "984488679173140520",
"animated": true
},
"custom_id": "deny-uno-invite"
}
]
}
],
"channel_id": "984497481821847602",
"author": {
"username": "UNO test bot",
"public_flags": 0,
"id": "976400332299063366",
"discriminator": "0545",
"bot": true,
"avatar_decoration": null,
"avatar": null
},
"attachments": []
},
"locale": "en-GB",
"id": "1022576307709677710",
"data": {
"custom_id": "deny-uno-invite",
"component_type": 2
},
"channel_id": "984497481821847602",
"application_id": "976400332299063366",
"received_at": "2022-09-22T18:33:10.391Z"
}
}
// // get event info
// let { event } = context.params
// TODO Remove test data from `all.js`

Game turn

  • Notify everyone that new turn has started
  • Get data from previous turn
  • Check if correct player played a card
  • Check if card is valid
  • Check if player has UNO
  • Check if player called UNO
  • Save turn info to kv
  • Notify everyone that card has been played
  • Check if someone calls the fact that player failed to call UNO

check if selected channel is a text channel

sometimes people can select a voice channel or category, either on purpose or by accident. This should cause the command to fail.

let channel = (data.options.find((option) => option.name == `channel`)).value;

let { event } = context.params,
  { member, data, token, guild_id, received_at } = event;

/* Getting the channel from the options. */
let channel = (data.options.find((option) => option.name == `channel`)).value;

remove the double message

labels: bug
assignees: larssieboy18
lines: 214
Decide where the message should be sent and remove the other message.
Sending a message to the channel where the game will be played. */

Line: 237

/* Sending a message to the channel where the command was used. */
await responses.update(token, '', embed, [], 'CHANNEL_MESSAGE_WITH_SOURCE');
// TODO remove the double message
// labels: bug
// assignees: larssieboy18
// lines: 214
// Decide where the message should be sent and remove the other message.
/* Sending a message to the channel where the game will be played. */
await messages.create(channel, '', embed, []);

allAccepted initial message

labels: enhancement
assignees: larssieboy18
lines: 123,132
if everyone has accepted the game, the initial message should be edited to something like: "everyone has accepted the game. It has started in <#channel>"

Line: 117

it will send a message to the user who accepted the game saying that they will be notified when the
game starts. */
// TODO allAccepted initial message
// labels: enhancement
// assignees: larssieboy18
// lines: 123,132
// if everyone has accepted the game, the initial message should be edited to something like: "everyone has accepted the game. It has started in <#channel>"
let allAccepted
for (let i = 0; i < fields.length; i++) {

Change description of embed when it is not the start of the game anymore

lines: 120
labels: development
assignees: larssieboy18
Currently, the message shows a message saying that the player that starts the game starts the game. For consequent turns, it should be altered to show that it is someones turn instead of the person starting a game.

Line: 131

},
], []);
// TODO Change description of embed when it is not the start of the game anymore
// lines: 120
// labels: development
// assignees: larssieboy18
// Currently, the message shows a message saying that the player that starts the game starts the game. For consequent turns, it should be altered to show that it is someones turn instead of the person starting a game.
// did an error occur?
return false

Change description of embed when it is not the start of the game anymore

lines: 120
labels: development
assignees: larssieboy18
Currently, the message shows a message saying that the player that starts the game starts the game. For consequent turns, it should be altered to show that it is someones turn instead of the person starting a game.

Line: 131

},
], []);
// TODO Change description of embed when it is not the start of the game anymore
// lines: 120
// labels: development
// assignees: larssieboy18
// Currently, the message shows a message saying that the player that starts the game starts the game. For consequent turns, it should be altered to show that it is someones turn instead of the person starting a game.
// did an error occur?
return false

check if selected channel is a text channel

sometimes people can select a voice channel or category, either on purpose or by accident. This should cause the command to fail.
lines: 16, 20
assignees: larssieboy18
labels: enhancement

Line: 23

/* Getting the channel from the options. */
let channel = (data.options.find((option) => option.name == `channel`)).value;
// TODO check if selected channel is a text channel
// sometimes people can select a voice channel or category, either on purpose or by accident. This should cause the command to fail.
// lines: 16, 20
// assignees: larssieboy18
// labels: enhancement
// // check if there already is a game in progress inside the same channel
// let gameInProgress = await kv.get(`unoGame-${guild_id}-${channel}`, false);

Special card handling on first turn

lines: 64,68
assignees: larssieboy18
labels: enhancement
If a special card is dealt at the first turn, the game should apply that effect to the first player (e.g. skip the player on a skip card, give 2 extra card on a +2 card, etc.)

Line: 28

playerHands[i] = startingDeck.slice(0, 7);
}
// TODO Special card handling on first turn
// lines: 64,68
// assignees: larssieboy18
// labels: enhancement
// If a special card is dealt at the first turn, the game should apply that effect to the first player (e.g. skip the player on a skip card, give 2 extra card on a +2 card, etc.)
// create discard pile
let discardPile = [];

add buttons to starting message

labels: enhancement
assignees: larssieboy18
lines: 86,105

Line: 74

// save game to kv
await kv.set(`UNO-${guild_id}-${gameChannel}`, game, 604800 /* a week */);
// TODO add buttons to starting message
// labels: enhancement
// assignees: larssieboy18
// lines: 86,105
// send starting message to game channel
await messages.create(gameChannel, '', [
{

add buttons to starting message

Add buttons to starting message

// send starting message to game channel

 // send starting message to game channel
 let startingMessage = await messages.create(gameChannel, '', [
   {
     title: "UNO",
     description: `**<@${startingPlayer.id}>** starts the game!`,
     color: 0x00ff00,
     fields: [
       {
         name: "Current Card",
         value: `${discardPile[0]}`,
         inline: true,
       },
       {
         name: "Current Player",
         value: `${startingPlayer.name}`,
         inline: true,
       },
     ],
   }
 ], []);

add buttons to starting message

labels: enhancement
assignees: larssieboy18
lines: 86,105

Line: 74

// save game to kv
await kv.set(`UNO-${guild_id}-${gameChannel}`, game, 604800 /* a week */);
// TODO add buttons to starting message
// labels: enhancement
// assignees: larssieboy18
// lines: 86,105
// send starting message to game channel
await messages.create(gameChannel, '', [
{

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.