Git Product home page Git Product logo

phoquingbot's Introduction

phoquingbot

A simple Discord bot for adding to a Squad server whitelist via Google Sheets.

Install

Dependencies

Node.js: https://nodejs.org/en/download/

Yarn as a package manager is prefered, but not necessary: https://yarnpkg.com/en/docs/install

Google Sheets

Navigate here: https://developers.google.com/sheets/api/quickstart/nodejs

Click "Enable The API" button, name the project and click "Next".

Click the "Download Client Configuration" button, it will download a file called credentials.json. Paste that file into this directory.

Now paste the ID of the Google Sheet into sheet.json. This ID is the random string of characters in the Sheet's URL.

i.e. the 13NOITWHDeWcfLpi4n6ef8lkDR3utpwmHiRv4GeUEfE8 in https://docs.google.com/spreadsheets/d/13NOITWHDeWcfLpi4n6ef8lkDR3utpwmHiRv4GeUEfE8/edit

Discord

Navigate here: https://discordapp.com/developers/applications/

Click "Create an application", rename the application, then the "Bot" tab on the left. And then create one.

On the bot's page click the "Copy" button under the "Token". Paste that token into discordAuth.json

Back on the "General Information" tab on the left, there is a, 18 digit number called "Client ID".

Copy it into this URL: https://discordapp.com/oauth2/authorize?&client_id=CLIENT-ID-HERE&scope=bot&permissions=0 replacing CLIENT-ID-HERE.

This will allow you to invite the bot to any Discord server you have admin access to as a user with no perms.

Start

Type yarn start to start ther server. If you didn't install Yarn, use npm run start.

The first time the bot attempts to access your Google sheet, it will need to obtain authorization. Do a dry run command to the bot in your Discord: !whitelist "Uncle Phoquer" 76561198029451156

The Bot will prompt you with Authorize this app by visiting this url: in the terminal, followed by a long Google OAuth URL. Copy that URL into your browser, authenticate as the Google user with access to the Google Sheet you want the Bot to edit, allow access to the app asking for it, and then copy the code Google will read back to you, and paste it into the terminal.

Run !whitelist "Uncle Phoquer" 76561198029451156 again and confirm that your Sheet is now being edited by the Bot!

phoquingbot's People

Contributors

juiposa avatar

Watchers

James Cloos avatar  avatar

phoquingbot's Issues

Sanity check the Steam64s

The Steam64s passed in aren't validated in any way. Someone could pass us a junk ID and we'd never be the wiser until someone manually reviewed the whitelist doc.

Steam64 IDs should be validated and rejected with an appropriate error message if invalid.

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.