Giter Site home page Giter Site logo

discord-bot's Introduction

discord-bot

A friendly bot to inject Discord data for community analysis.

Collects realtime data on a guild and its channels, roles, members, messages, and reactions.

  1. Fill out the .envsample with proper values, then save as .env
  2. Run "node index.js" to start the bot
  3. connect the bot to a discord server with the following link: https://discord.com/oauth2/authorize?client_id=895829003309568041&permissions=8&redirect_uri=http%3A%2F%2Flocalhost%3A53134&response_type=code&scope=guilds%20guilds.members.read%20bot%20messages.read%20applications.commands

A notable limitation of the discord API is that this bot will only receive events for entities created after the bot joined the server.

discord-bot's People

Contributors

clemp avatar

Stargazers

BAICE avatar

Watchers

 avatar  avatar Alexander Keating avatar

discord-bot's Issues

Discord data notes

Using this thread to post notes, observations, and questions about the Discord data after reviewing the sample in the /data folder.

Metrics for the MVP

  1. community tenure - for Discord this is the time difference between a member's Discord join date and current date
  2. discord roles - how many roles are assigned to each member, and which roles are assigned to each member?
  3. member growth - number of members each day since server inception?

Questions about the data

  1. What is the time frame that a single JSON blob represents? Do we see a history of transactions or only the latest state of the server in a single JSON blob that's returned?
  2. How can we get text for some of the fields that only have an id? For example:
"roles": [
		"896568153914605618",
		"909603362952069170"
	]

We need to have text that describes what 896568153914605618 or 909603362952069170 refer to.

  1. What is the difference between joinedTimestamp and createdTimestamp ?

CI / CD and more robust deployment on the server

Right now the bot runs once and loads data, then doesn't run once we log off of the server. Process is currently totally manual. Want to enhance the deployment / ongoing running of the bot to continually collect data.

Kicked from server bug

Kicking the bot from a server currently crashes the program with the following error:

if (typeof this.banner === ‘undefined’) throw new Error(‘USER_BANNER_NOT_FETCHED’); Error [USER_BANNER_NOT_FETCHED]: You must fetch this user’s banner before trying to generate its URL!

This should be resolved.

Update paths so that this function writes to S3 instead of local folders

Once this solution is deployed on EC2, we need to ensure that the files write to S3 buckets instead of local folders.

Various places in the code current hard code local paths.

// Function to write data to file named after a given attribute
const writeData = async (data, path, uidAttribute = 'id') => {
await fs.writeFile(
`${path}/${data[uidAttribute]}.json`,
JSON.stringify(data, (key, value) => typeof value === 'bigint' ? value.toString() : value),
err => err != null ? console.log(err) : err // => null
);
console.log(`Data written to ${path}/${data[uidAttribute]}.json`);
};

Determine Necessary Intents

The Chainverse Bot should have access to only as many intents as is necessary.

In order to access certain privileged data, such as user bios, from the discord api, special intents are necessary. These may require the Chainverse Bot to go through a discord authorization process.

Need to design S3 folder structure and update code to match

During development the folder structure was designed for local folders. Need to confirm that this folder structure will work with S3.

Top level S3 buckets are:

  • chainverse\discord\guilds\
  • chainverse\discord\users\

Need to confirm that new information generated by the bot will fit into this design.

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.