transitive-bullshit / chatgpt-twitter-bot

Twitter bot powered by OpenAI's ChatGPT API. It's aliveeeee 🤖
https://twitter.com/ChatGPTBot
MIT License
735 stars 98 forks source link

Unable to get the bot to work with changed config.ts settings #15

Open d3287t328 opened 1 year ago

d3287t328 commented 1 year ago

I am trying to deploy the bot via replit. They don't allow .env files so I replaced the secrets look up with os.env and updated a the settings and despire my API keys all looking correct (I get no error messages on the console). Is there anything else in the app I will need to change for this to work?

import path from 'node:path'
import os from 'node:os'

import Conf from 'conf'
import dotenv from 'dotenv-safe'

import * as types from './types'

dotenv.config()

export const twitterBotHandle = '@LatinaLinguaBOT'
export const twitterBotHandleL = twitterBotHandle.toLowerCase()
export const twitterBotUserId = '1667706052433829889'

export const cacheDir = 'out'
export const getTwitterUserMentionsCachePathForUserById = ({
  userId
}: {
  userId: string
}) => path.join(cacheDir, `twitter-mentions-${userId}.json`)

export const defaultMaxNumMentionsToProcessPerBatch = 10

// tweets that try to break the bot...
export const tweetIgnoreList = new Set([
  '1599344387401863174',
  '1604326985416613888',
  '1643945307095420930',
  '1645615915088896000'
])

// ignore known bots; we don't want them endlessly replying to each other
export const twitterUsersIgnoreList = new Set([
  '1506967793409065000', // ReplyGPT
  '1598922281434103808', // source github bot
  '1607692579243687936' // ChatSonicAI
])

// Used by the author(s) for faster testing and feedback
export const priorityUsersList = new Set([
  '327034465' // llm_bot

])

// Optional redis instance for persisting responses
export const enableRedis = false
export const redisHost = process.env.REDIS_HOST || 'localhost'
export const redisPassword = process.env.REDIS_PASSWORD || ''
export const redisUser = process.env.REDIS_USER || 'default'
export const redisNamespace = process.env.REDIS_NAMESPACE || 'chatgpt'
export const redisNamespaceDMs =
  process.env.REDIS_NAMESPACE_DMS || 'chatgpt-dms'
export const redisNamespaceMessages =
  process.env.REDIS_NAMESPACE_MESSAGES || 'chatgpt-messages'
export const redisUrl =
  process.env.REDIS_URL || `redis://${redisUser}:${redisPassword}@${redisHost}`

export default new Conf<types.Config>({
  defaults: {
    refreshToken: os.env.TWITTER_OAUTH_REFRESH_TOKEN,
    accessToken: os.env.TWITTER_OAUTH_ACCESS_TOKEN
  }
})
Glavin001 commented 8 months ago

@d3287t328 did you get this to work?