Code Monkey home page Code Monkey logo

impostor's Introduction

Impostor

Discord

This is the source code for the Discord bot and Among Us client that compromise Impostor. Note that Impostor is not intended for self-hosting (although it is theoretically possible), so if you want Impostor on your Discord server the easiest solution is to simply click here.

Demo

Demo Thumbnail

Components

This project consists of two components, creatively named bot and client. Bot is the Discord part written in TypeScript that handles all the logic around command handling, session management, member voice channel moving, etc. Client is a simple C# implementation of the Among Us networking protocol, just barely enough to connect to the lobby, fetch player data and emit events. Bot launches a client instance for every lobby, reading events from client through stdout.

Developing Bot

To get started with developing the bot, you'll need to install dependencies. First of all you need to have Node.js installed. After that, simply run npm/yarn install to get all the dependencies needed.

./node_modules/.bin/tsc -w will start a watching TypeScript compiler that will automatically compile the TypeScript source to JavaScript. After that, simply configure your .env by copying the template and filling in values, then run node dist/index.js to start the bot.

Note that you will also need a PostgreSQL database for running the bot.

Developing Client

For the client, be sure to clone the repository with submodules enabled, then simply open the solution in client/ to develop. You can also use the dotnet CLI to build the client, using dotnet build.

Step-by-Step Instructions for Self-Hosting Impostor

  1. Install Node.js + npm, .NET Core, PostgreSQL, and any others needed.
  2. Clone the repository recursively (git clone --recursive https://github.com/molenzwiebel/Impostor)
  3. Navigate to .env.template, duplicate the file, rename to .env, and fill in the blanks. The result will look something like this:
DISCORD_TOKEN=<your token here>
AU_CLIENT_DIR=../client/bin/Debug/netcoreapp3.1
DATABASE_URL=postgresql://postgres:<your password here>@localhost:5432/postgres
  1. Update the code associated with the emojis in bot/src/constants.ts (add the ID, name, etc)
  2. Navigate to /bot in your cmd/PowerShell/terminal
  3. Run npm install to install dependencies.
  4. Run ./node_modules/.bin/tsc to compile TypeScript to JavaScript.
  5. Run node dist/index.js (pm2 is recommended to keep it running for long periods)
  6. Change directory to /client
  7. Open cmd/PowerShell/terminal and run dotnet build

Note: When using Linux, I recommend setting up a .sh file to simplify the process when rebooting the bot, as some bugs in the code require a restart.

License

MIT

impostor's People

Contributors

darrenalex avatar molenzwiebel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

impostor's Issues

"Connection to matchmaker prematurely exited"

I see many people in #bug-reports under the Molen's Projects Discord having the same.

I'm using the Discord plugin and getting this after format: !amongus na ABCDEF (with my own code)

Error when building with dotnet build

When I run dotnet build in client, I get this error:

/usr/share/dotnet/sdk/5.0.102/NuGet.targets(285,5): error MSB3202: The project file "/home/<my user>/Impostor/Hazel-dotNETCore/Hazel-dotNETCore/Hazel-dotNETCore.csproj" was not found. [/home/<my user>/Impostor/client/client.sln]

Project name

There is already a project called "Impostor", which is a private server for Among Us. While these projects are different, having the same name may cause confusion. You can close this if it's not an issue with you.

Error when running postgres database on Heroku

When running node dist/index.js (using the Heroku CLI), I get this error:
(node:12) UnhandledPromiseRejectionWarning: DriverException: permission denied for database "postgres" at PostgreSqlExceptionConverter.convertException (/app/bot/node_modules/@mikro-orm/core/platforms/ExceptionConverter.js:8:16) at PostgreSqlExceptionConverter.convertException (/app/bot/node_modules/@mikro-orm/postgresql/PostgreSqlExceptionConverter.js:40:22) at PostgreSqlDriver.convertException (/app/bot/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:160:54) at /app/bot/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:164:24 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async PostgreSqlDriver.find (/app/bot/node_modules/@mikro-orm/knex/AbstractSqlDriver.js:42:24) at async SqlEntityManager.find (/app/bot/node_modules/@mikro-orm/core/EntityManager.js:75:25) at async Object.cleanUpOldSessions (/app/bot/dist/actions.js:80:22) at async /app/bot/dist/index.js:26:5
The database url in .env is correct though.

Add Ghost chat please

If it is possible, it would be nice to have all dead People be grouped toghether so they can talk.
Also the bot was a great executed idea, thanks for creating it.

Database error

So, I'm self-hosting the bot, with no code changes other then what are required and in discord the bot posts the first error which happens onnce and the second error, which happens everytime after that. It's caused by the database not initialising correctly when you click leave lobby and then get the bot to rejoin.

  1. sorry but something went wrong: NotNullConstraintViolationException: insert into "among_us_session" ("guild", "channel", "message", "user", "creator", "state", "region", "lobby_code", "group_impostors", "id") values ('770238738579062835', '770238739053543445', '770247203523919892', 'Lime', '371245917023502337', 'lobby', 'North America', 'JIXXXQ', false, NULL), ('770238738579062835', '770238739053543445', '770247111715323904', 'Lime', '371245917023502337', 'lobby', 'North America', 'JIXXXQ', false, 45) returning "id" - null value in column "id" of relation "among_us_session" violates not-null constraint

  2. sorry but something went wrong: ValidationError: You cannot call em.flush() from inside lifecycle hook handlers

Add Dockerfile / docker-compose stack

Hi. Great work on this! Would it be possible for you to add a Dockerfile with a few steps on how to run it or even better, a docker-compose file?

Thank you

Trying to understand where a user is being used up

Super interested in this project. I was wondering where exactly are we losing one player in the game?

I am trying to understand if its possible to just host the client code in the cloud as well and no one needs to run anything locally outside of the game?

not working

[+] Starting impostor...
[+] Connected to database!
[+] Connected to Discord as AmongUS - BOT
[+] Command: !amongus eu SPFMQQ
[+] Creating new AU session for SPFMQQ on Europe
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/ahmetozalp/Desktop/Impostor/client/bin/Debug/netcoreapp3.1/client ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /Users/ahmetozalp/Desktop/Impostor/client/bin/Debug/netcoreapp3.1/client',
  path: '/Users/ahmetozalp/Desktop/Impostor/client/bin/Debug/netcoreapp3.1/client',
  spawnargs: [ '172.105.251.170', 'SPFMQQ' ]

Make a self-hostable executable

I know the bot verification process is difficult, and it'd be great to have an easier to use self-hosted version of the bot. If this is possible it'd be a super welcome addition.

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.