/superfluid-stream-gated-discord-server

Gating Discord channels with Superfluid streams as a subscription

Primary LanguageJavaScriptMIT LicenseMIT

Superfluid Stream Gated Discord Server

This project aims to gate a Discord server/channels with Superfluid streams. Exclusive channel content and perks can be accessed by users who are streaming super tokens to the server admin account through the Superfluid protocol. This project also includes periodic checks to ensure that all users with the streamer role are actively streaming to our server admin. If a user's stream is terminated or their flow rate is reduced, The bot will automatically remove the streamer role from their account to prevent them from accessing our exclusive channels and perks until they start streaming again.

Prerequisites

  1. A Discord account
  2. Understanding of the Superfluid protocol and how to stream tokens
  3. An Ethereum wallet with some tokens to stream. You can get some test tokens from the Superfluid faucet.
  4. Stream a minimum of 0.5DAIx/month to the server admin account 0x7348943c8d263ea253c0541656c36b88becd77b9 on goerli testnet. You can use the Superfluid app to do this.

Steps:

  1. Join the TechNow Discord Server: https://discord.gg/JEMFf5ux5M

  2. Make sure you are streaming a minimum of 0.5 DAIx/month to 0x7348943c8d263ea253c0541656c36b88becd77b9 on goerli if you wanted to access exclusive stream gated channels.

  3. Open the #⁠start-here channel on discord server.

  4. Type the command /verify in the channel.

  5. Our bot will send you a link to connect your wallet and sign a message.

  6. After you sign the message, the bot will verify if a minimum of 0.5 DAIx/month stream is present between your wallet address and the server admin address.

  7. If the stream is present, you will be assigned the streamer role and gain access to the exclusive channels and perks on the server. If the stream is not present, you will still be assigned the member role, which will allow you access to the general channels on the server.

Demo

sf-discord-demo-final.mp4

Getting Started (as Developer)

Prerequisites

  1. A Discord account
  2. A Discord server where you have permissions to manage roles and channels and add bots.
  3. An Ethereum wallet with some tokens to stream. You can get some test tokens from the Superfluid faucet.

Steps:

  1. Create a new Discord server and create the necessary channels(#start-here, #superfluid-exclusive, #general) and roles(streamer, member). #start-here channel should be the first channel in the server. #superfluid-exclusive is the channel that we wanted to gate with stream. so make sure in the channel settings > permisions, the @everyone role does not have access to the channel. only the streamer role should have access to the channel. Also, Upon verifying with the wallet, regardless of whether a stream is present or not, a member role will be added to the user. This member role will allow them access to the general channels in the server. So make sure in #general channel settings > permisions, the @everyone role doesn't have access to the channel. only the streamer and member roles should have access to the channel.

sf-exclusive-permissions

  1. Create a new Discord bot at Discord Developer Portal with necessary permissions and invite it to the server.

sf-bot-intents

sf-bot-permissions

  1. Replace .env.example with .env and fill in the environment variables.

  2. Install dependencies by running npm install in the root directory

  3. Sync the local schema to database by running npx prisma db push in the root directory

  4. Deploy slash commands by running npm run commands:deploy in the root directory

  5. Start the bot by running npm start in the root directory

  6. Test the bot by typing /verify in the #start-here channel.

  7. If the bot is working correctly, you should see the streamer role being assigned to users(ofcourse only if they stream required amount) upon verifying wallet and the #superfluid-exclusive channel being unlocked.

Troubleshooting

If you encounter any issues with the bot, please do the following:

  1. Check that the bot has the necessary permissions in the server (Manage Roles, Manage Channels, Manage Messages)
  2. Check that the environment variables have been set up correctly in the .env file
  3. Check the logs for any error messages

Built With

  • Superfluid - A revolutionary asset streaming protocol that brings subscriptions, salaries, vesting, and rewards to DAOs and crypto-native businesses worldwide.
  • Discord - A free communications app that lets you share voice, video, and text chat with friends, game communities, and developers.
  • Discord.js - A powerful Node.js module that allows you to interact with the Discord API very easily.

Credits & Resources:

Safety

This is experimental software and subject to change over time.

This is a proof of concept and is not ready for production use. It is not audited and has not been tested for security. Use at your own risk. I do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

License

This project is licensed under the MIT License - see the LICENSE file for details