mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 12:19:10 +00:00
add bot name modularity
This commit is contained in:
parent
a4c15f2d78
commit
f4b4b63faa
3 changed files with 20 additions and 2 deletions
|
@ -109,7 +109,9 @@ class Roleypoly {
|
|||
this.ctx.sql = sequelize
|
||||
this.M = fetchModels(sequelize)
|
||||
this.ctx.M = this.M
|
||||
if (!process.env.DB_NO_SYNC) {
|
||||
await sequelize.sync()
|
||||
}
|
||||
|
||||
this.ctx.server = new ServerService(this.ctx)
|
||||
this.ctx.discord = new DiscordService(this.ctx)
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import 'dotenv/config'
|
||||
module.exports = {
|
||||
publicRuntimeConfig: {
|
||||
BOT_HANDLE: process.env.BOT_HANDLE
|
||||
},
|
||||
webpack: config => {
|
||||
// Fixes npm packages that depend on `fs` module
|
||||
config.node = {
|
||||
|
|
|
@ -7,6 +7,8 @@ import RPC from '../../config/rpc'
|
|||
import redirect from '../../lib/redirect'
|
||||
import dynamic from 'next/dynamic'
|
||||
import type { PageProps, ServerSlug } from '../../types'
|
||||
import getConfig from 'next/config'
|
||||
const { publicRuntimeConfig: { BOT_HANDLE } } = getConfig()
|
||||
|
||||
type AuthLoginState = {
|
||||
humanCode: string,
|
||||
|
@ -160,6 +162,16 @@ export default class AuthLogin extends React.Component<AuthLoginProps, AuthLogin
|
|||
}
|
||||
}
|
||||
|
||||
get dm () {
|
||||
console.log({ e: process.env })
|
||||
if (BOT_HANDLE) {
|
||||
const [username, discrim] = BOT_HANDLE.split('#')
|
||||
return <><b>{ username }</b>#{discrim}</>
|
||||
}
|
||||
|
||||
return <><b>roleypoly</b>#3712</>
|
||||
}
|
||||
|
||||
render () {
|
||||
return <Wrapper>
|
||||
<div>
|
||||
|
@ -167,7 +179,7 @@ export default class AuthLogin extends React.Component<AuthLoginProps, AuthLogin
|
|||
<DiscordButton href={`/api/auth/redirect?r=${this.props.redirect || '/'}`}>Sign in with Discord</DiscordButton>
|
||||
<Line />
|
||||
<div>
|
||||
<i>Or, send a DM to <b>roleypoly</b>#3712 saying: login</i>
|
||||
<i>Or, send a DM to {this.dm} saying: login</i>
|
||||
</div>
|
||||
<div>
|
||||
<SecretCode placeholder='click to enter super secret code' onChange={this.onChange} value={this.state.humanCode} />
|
||||
|
|
Loading…
Add table
Reference in a new issue