基于区块链的毕业设计Discord bot for ETH student “verification” – ETH学生“验证”的不和谐机器人

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Discord bot for ETH student “verification” – ETH学生“验证”的不和谐机器人 是一篇很好的国外资料

Discord bot for ETH student “verification”

Description

A discord bot to “verify” that a user joining the server is indeed an ETH student, by the following process:

  1. user tells bot their nethz
  2. bot sends an email to that nethz (domain “student”) with a token
  3. user reports token to bot, thus proving it has access to nethz inbox Remarks:
  • the token has an expiration date
  • the bot must have an outgoing email address not blacklisted by ETH’s mail server
  • upon completion of the process, a salted hash of the nethz used is stored in database, and marked as “already used for verification”; no nethz/Discord-User-ID association is stored

Setup

  • git clone this repo
  • yarn (or npm i)
  • cp config-dist.json config.json and fill the config file (cf section “Config”)
  • yarn start

Config

The fields of the config.json file to be used is described by the sample file config-dist.json

  • The transportOptions field is passed directly to nodemailer.createTransport, which is documented here: https://nodemailer.com/smtp/
  • The theGuildId field holds the ID of the (unique) discord server that should be using this bot. (Yes we support only serving one server, since that is exactly our goal.)
  • The tokenTTL field is in hours
  • The commonSalt field is used to “salt” the nethz before hashing them (otherwise we risk dictionary attack, since nethz’s are short). Note that we use a common salt for all nethz’s, contrary to what is usually meant by “salting” (typically for passwords), since we don’t have keys (typically username), just the hashed values.

Running on a VM

Use yarn startdist (resp. yarn stopdist) to start (resp. stop) the bot. (After starting the bot you can just walk away until you decide to stop it). The lines are from https://medium.com/google-cloud/skys-the-limit-google-cloud-platform-9dd7fa3354e4#ca49

Notes for devs

(This is, and will remain, a really small project, so we dump here whatever would normally be in a CONTRIBUTING file)

TODO

  • (optional) handle “The email address you entered couldn’t be found” emails with https://nodemailer.com/smtp/dsn/ and https://www.npmjs.com/package/imap
  • the !verify command is currently useless, since you can’t mention a user that’s not in the current channel in Discord…

Useful links

  • https://github.com/discordjs/guide/blob/master/code-samples/creating-your-bot/commands-with-user-input/11/index.js

Rk: that link is a strict subset of https://github.com/discordjs/guide/blob/master/code-samples/command-handling/adding-features/11/index.js (which is the code sample for a later step of the same tutorial), but since we only need to respond to very few commands, that link is actually more relevant

  • https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-guildMemberAdd
  • https://discordjs.guide/popular-topics/common-questions.html#how-do-i-add-a-role-to-a-guild-member
  • https://discordjs.guide/keyv/
  • https://nodemailer.com/about/
  • https://nodemailer.com/usage/using-gmail/
  • (2020-11) Concerning the “privileged intent” mess: https://github.com/discordjs/discord.js/issues/2917

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.


Discord bot for ETH student “verification”

Description

A discord bot to “verify” that a user joining the server is indeed an ETH student, by the following process:

  1. user tells bot their nethz
  2. bot sends an email to that nethz (domain “student”) with a token
  3. user reports token to bot, thus proving it has access to nethz inbox Remarks:
  • the token has an expiration date
  • the bot must have an outgoing email address not blacklisted by ETH’s mail server
  • upon completion of the process, a salted hash of the nethz used is stored in database, and marked as “already used for verification”; no nethz/Discord-User-ID association is stored

Setup

  • git clone this repo
  • yarn (or npm i)
  • cp config-dist.json config.json and fill the config file (cf section “Config”)
  • yarn start

Config

The fields of the config.json file to be used is described by the sample file config-dist.json

  • The transportOptions field is passed directly to nodemailer.createTransport, which is documented here: https://nodemailer.com/smtp/
  • The theGuildId field holds the ID of the (unique) discord server that should be using this bot. (Yes we support only serving one server, since that is exactly our goal.)
  • The tokenTTL field is in hours
  • The commonSalt field is used to “salt” the nethz before hashing them (otherwise we risk dictionary attack, since nethz’s are short). Note that we use a common salt for all nethz’s, contrary to what is usually meant by “salting” (typically for passwords), since we don’t have keys (typically username), just the hashed values.

Running on a VM

Use yarn startdist (resp. yarn stopdist) to start (resp. stop) the bot. (After starting the bot you can just walk away until you decide to stop it). The lines are from https://medium.com/google-cloud/skys-the-limit-google-cloud-platform-9dd7fa3354e4#ca49

Notes for devs

(This is, and will remain, a really small project, so we dump here whatever would normally be in a CONTRIBUTING file)

TODO

  • (optional) handle “The email address you entered couldn’t be found” emails with https://nodemailer.com/smtp/dsn/ and https://www.npmjs.com/package/imap
  • the !verify command is currently useless, since you can’t mention a user that’s not in the current channel in Discord…

Useful links

  • https://github.com/discordjs/guide/blob/master/code-samples/creating-your-bot/commands-with-user-input/11/index.js

Rk: that link is a strict subset of https://github.com/discordjs/guide/blob/master/code-samples/command-handling/adding-features/11/index.js (which is the code sample for a later step of the same tutorial), but since we only need to respond to very few commands, that link is actually more relevant

  • https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-guildMemberAdd
  • https://discordjs.guide/popular-topics/common-questions.html#how-do-i-add-a-role-to-a-guild-member
  • https://discordjs.guide/keyv/
  • https://nodemailer.com/about/
  • https://nodemailer.com/usage/using-gmail/
  • (2020-11) Concerning the “privileged intent” mess: https://github.com/discordjs/discord.js/issues/2917

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/18571.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Discord bot for ETH student “verification” – ETH学生“验证”的不和谐机器人

提供最优质的资源集合

立即查看 了解详情