TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How would you design a scalable chat bot for something like Discord?

12 点作者 iDemonix大约 5 年前
I have 2 months of furlough, and I&#x27;d like to improve my Python (and other) skills and, for once, start and finish a project. For once I&#x27;ve decided to pick a project which will actually both interest and benefit myself.<p>I wrote a simple chat bot to manage xp&#x2F;levels&#x2F;roles, amongst various other things, in a Discord server for a popular community. I&#x27;ve since used the same bot in other communities, but it just runs as a clone of a Python repo for each bot, using supervisord on a Digital Ocean VPS. Each bot also has its own developer &#x27;app&#x27; within the Discord environment and associated tokens, which is getting cumbersome to manage.<p>As I&#x27;ve got time to focus on it, I&#x27;d like to create a singular bot, with a web UI to manage it, with a very long term end goal of maybe competing with other services like Mee6, but a shorter term goal of making it easy for me to easily add the bot to new communities and configure it - without config + manual steps over SSH.<p>It&#x27;s quite niche, but if anyone has any similar experience, I&#x27;d be eager to hear any opinions. For example: My first instinct based upon my work experience was a Docker container per bot, but from testing, as far as I can see I need a single instance which handles all servers if I want to use one developer &#x27;app&#x27; like Mee6 or Dyno.<p>Any hints&#x2F;links or similar welcome.

6 条评论

caryd大约 5 年前
Docker alone would not add automatic scalability. You&#x27;d need to add an orchestration layer.<p>Seems like your current bot would be fine in multiple servers if you added an additional server argument to each of the i&#x2F;o&#x27;s.<p>Don&#x27;t overthink it.
评论 #22851970 未加载
curryst大约 5 年前
You can certainly run more than one Discord server on a single running instance of the bot. That&#x27;s probably more code, but you could run the web server as part of the same process. I would generally discourage that though, because then you can have your bots DDoSed by just DDoSing your web server.<p>The easier incarnation is to store the Discord connection configs in a database. Make a web server and UI to manage the database (the Django admin panel is probably enough, which would make it low code). Then have the web server manage an orchestration layer by pulling configs from the database. The easy solution is probably to have your web server write out supervisord config files templated from the data in the database, and then send reload signals to supervisord. The more difficult option there would be to write your own process management layer (probably not worth it, you&#x27;re just rewriting supervisord at that point). Or you could maybe just pull in supervisord as a library and use it.<p>That solution is less resource efficient, but not at a &quot;break the bank&quot; level.
评论 #22877452 未加载
drzel大约 5 年前
I have a discord bot running in our FortressOne discord. It keeps track of who is in what server and spams the channel with that information. It requires some short term persistence so it runs across two containers, one with the application code and the other with redis. It takes hundreds of requests daily and sends many millions, seems to be very stable. <a href="https:&#x2F;&#x2F;github.com&#x2F;FortressOne&#x2F;qwtf-discord-bot" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;FortressOne&#x2F;qwtf-discord-bot</a>
based2大约 5 年前
<a href="https:&#x2F;&#x2F;docs.mattermost.com&#x2F;overview&#x2F;product.html#about-the-mattermost-open-source-project" rel="nofollow">https:&#x2F;&#x2F;docs.mattermost.com&#x2F;overview&#x2F;product.html#about-the-...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;42wim&#x2F;matterbridge" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;42wim&#x2F;matterbridge</a><p><a href="https:&#x2F;&#x2F;git.koesters.xyz&#x2F;timo&#x2F;conduit" rel="nofollow">https:&#x2F;&#x2F;git.koesters.xyz&#x2F;timo&#x2F;conduit</a><p><a href="https:&#x2F;&#x2F;matrix.org&#x2F;docs&#x2F;guides&#x2F;introduction" rel="nofollow">https:&#x2F;&#x2F;matrix.org&#x2F;docs&#x2F;guides&#x2F;introduction</a>
Axsuul大约 5 年前
Why did you clone in the beginning? Why couldn&#x27;t you have just on developer app send requests from multiple communities to one endpoint for your app?
评论 #22855270 未加载
babuloseo大约 5 年前
In the discussion of Discord Bots, be aware of Discord Bots that share your private group channel data online.