Otu esi etinye Redbot Discord Bot na Ubuntu 20.04

Nsogbu bụ mmemme ịkparịta ụka n'ịntanetị nwere ọkwa kachasị elu, ọkachasị n'etiti obodo egwuregwu. Ihe na-ewu ewu na ọwa ndị a bụ ntinye nke bots ndị sitere na iwu imeru ihe n'ókè, bots egwu, bots trivia, nhazi ọkwa, na ọtụtụ ndị ọzọ. Ọtụtụ bots na-agba ọsọ na sava, ma ị nwere ike ịkpọ òkù, n'agbanyeghị ọtụtụ n'ime Bots ndị a chọrọ ego ego iji kpọghee atụmatụ ndị ọzọ, nke nwere ike bụrụ ihe na-adịghị agbanwe agbanwe na ihe ize ndụ nchekwa.

Yabụ, usoro na-eto eto n'oge na-adịbeghị anya bụ ịrị elu nke oghere mepere emepe, bots Discord efu na-akwado onwe ya, otu n'ime ụlọ ike zuru oke na mpaghara a ka a na-akpọ. Red Discord Bot. Redbot na-abịa na njirimara niile enwere ike ịgbanye ma ọ bụ nwee nkwarụ, yana nnukwu ibe ngwa mgbakwunye 3rdParty. oru ngo obodo.

Enwere ike itinye bot Discord na sistemụ arụmọrụ dị iche iche. Agbanyeghị, ị ga-amụta ka esi etinye Redbot na sava Ubuntu 20.04 LTS maka nkuzi, nhọrọ a ma ama n'etiti bots Discord.

Prerequisites

  • OS akwadoro: Ubuntu 20.04 - nhọrọ (Ubuntu 21.04)
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.
  • Ngwungwu achọrọ: wget

Melite Sistemụ Ọrụ

Melite gi Ubuntu 20.04 sistemụ arụmọrụ iji hụ na ngwugwu niile dị kwalitere ruo ugbu a:

sudo apt update && sudo apt upgrade

Ọzọ, ihe achọrọ bụ:

  • Python 3.8.1 ma ọ bụ karịa; A naghị akwado Python 3.9 ugbu a!
  • Pip 18.1 ma ọ bụ karịa
  • Git 2.11+
  • Java Runtime Environment 11 (maka nkwado ọdịyo)

Advertisement


Wụnye GIT: CORE PPA

Ị ga-achọ ịwụnye GIT: isi PPA, nke ndị mmepe git na-akwado. Ntuziaka anyị maka otu esi etinye PPA omenala nwere ike ịbụ chọtara ebe a.

sudo apt install software-properties-common && sudo add-apt-repository ppa:git-core/ppa -y

Wụnye ndabere - Python3, PIP, OpenJDK

Iji wụnye Python 3 na Pip3 na ngwugwu ndị ọzọ, Redbot chọrọ ịme iwu ndị a.

sudo apt install python3.8 python3.8-dev python3.8-venv python3-pip git openjdk-11-jre-headless build-essential nano -y

Advertisement


Mepụta gburugburu mebere

Achọrọ ka etinyere Redbot na ebe mebere ya. Ị nweghị ike ịgafe nzọụkwụ a.

Ị nwere ike ịmepụta gburugburu ebe obibi site na iji Python-venv gburugburu ebe obibi, nke bụ ụzọ dị mfe dị ka ndị a.

python3.8 -m venv ~/redenv

Mgbe ahụ rụọ ọrụ mebere gburugburu.

source ~/redenv/bin/activate

Na-esote, ị ga-anọ na mebere gburugburu shei, ị ga-achọpụta na prefix gị ga-enwe (rednv) dị ka nke a bụ aha ị kenyere mgbe ị na-eke gburugburu.

Ihe Nlereanya:

(redenv) joshua@ubuntu:~$

Wụnye Redbot Discord Bot

Ugbu a ịnọ na gburugburu mebere gị, ị nwere ike ịwụnye Redbot na ebe mebere ebe ị mebere wee gbaa ọsọ.

Nhọrọ nke mbụ, wụnye na-enweghị nkwado ndabere ndabere config:

python3 -m pip install -U pip setuptools wheel && python3 -m pip install -U Red-DiscordBot -y

Nhọrọ nke abụọ, iji wụnye na nkwado PostgreSQL:

python3 -m pip install -U pip setuptools wheel && python3 -m pip install -U "Red-DiscordBot[postgres]" -y

Advertisement


Nhazi Redbot Discord Bot

Ugbu a ị tinyela Redbot na ebe mebere gị. Ugbu a, anyị nwere ike ịtọ discord bot na sava gị.

Iji guzobe ihe atụ Discord bot, pịnye iwu a.

redbot-setup

Nke a ga-edobe ọnọdụ data, ndabere nchekwa gị, na aha ihe atụ (eji maka ịgba ọsọ bot).

Ozugbo emechara ịtọlite ​​​​atụ, gbaa iwu na-esonụ iji mee Red:

redbot 

Na-esote, ị ga-ahụ mmepụta na-esonụ. Ngosipụta onwe onye dị mfe dị ka ihe atụ n'okpuru.

Mbụ, ị ga-ahụ ka itinye aha ihe atụ. N'ihe atụ anyị, anyị ji Redbot.

~$ redbot-setup
 Hello! Before we begin, we need to gather some initial information for the new instance.
 Please enter a name for your instance, it will be used to run your bot from here on out.
 This name is case-sensitive and should only include characters A-z, numbers, underscores (_) and periods (.).
   redbot 

Dabere na nhọrọ wụnye ị họọrọ maka nkwado azụ azụ, họrọ ebe nchekwa azụ azụ.

We've attempted to figure out a sane default data location which is printed below. If you don't want to change this default please press [ENTER], otherwise input your desired data location.
 Default: /home/bytesboss/.local/share/Red-DiscordBot/data/redbot
   You have chosen /home/bytesboss/.local/share/Red-DiscordBot/data/redbot to be your data directory.
   Please confirm [Y/n]: y 
 Please choose your storage backend (if you're unsure, just choose 1).
 JSON (file storage, requires no database).
 PostgreSQL (Requires a database server) 
   1 

Ozugbo Redbot dechara ntọala, mmepụta ikpeazụ gị kwesịrị ịbụ nke a.

Your basic configuration has been saved. Please run redbot <name> to continue your setup process and to run the bot.
 First time? Read the quickstart guide:
 https://docs.discord.red/en/stable/getting_started.html

Mepụta ngwa Discord Bot

Ugbu a, ahaziela ihe niile na Redbot na ihe nkesa na-akwado onwe gị; mgbe ị na-agba ọsọ "redbot

Please enter a valid token.
 You can find out how to obtain a token with this guide:
 https://docs.discord.red/en/stable/bot_application_guide.html#creating-a-bot-account

Ị ga-achọ ịmepụta ngwa Discord Bot iji tinye akara ngosi akara ngosi. Ị nweta nke a na usoro ndị a n'okpuru.

Mepụta Ngwa

Jide n'aka na ị mepụtara akaụntụ discord nke ga-abụ onye nwe ya dịka usoro n'okpuru.

  1. Gbaa mbọ hụ na ịbanye na ya Weebụsaịtị Weebụ.
  2. Na-agagharị na peeji nke ngwa
  3. Pịa na bọtịnụ "ngwa ọhụrụ".
ubuntu 20.04 redbot discord bot ọhụrụ ngwa

Mgbe ịpịchara "ngwa ọhụrụ," nye ngwa Discord ọhụrụ gị aha wee pịa mepụta.

ubuntu 20.04 redbot discord bot mepụta ngwa

Gaa na taabụ “Bot” n'akụkụ aka ekpe nke ibe Discord onye nrụpụta gị, wee pịa tinye bot.

ubuntu 20.04 redbot discord bot wuo bot

Ka e were ya na ịchọrọ ka ndị ọzọ nwee ike ịkpọ bot gị ka ha tinye akara Ọha Bot. Idobe ya n'amaghị ama ga-egbochi ndị ọzọ ịjụ bot gị na sava ha, naanị gị ga-enwe ike itinye bot na sava (ọ bụrụhaala na ịchọrọ ikike na ihe nkesa ịchọrọ ịgbakwunye bot na).

ubuntu 20.04 redbot discord bot aha na ntọala bot ọhụrụ
Gbaa mbọ hụ Achọrọ Enyemaka koodu OAuth2 edebeghi.

Ugbu a, pịa bọtịnụ detuo ihe ngosi. Ị nwere ike tinye ugbu a na ọdụ Ubuntu gị maka akara ID. Ekekọrịtala akara ngosi a. Ọ bụ okwuntughe ma ekwesịrị ka e jiri nlezianya gwọọ ya, ma ọ bụghị ya, nsogbu nchekwa nwere ike ime.


Advertisement


Na-eme atụmatụ ndị anabatara

Discord API chọrọ ebumnuche niile, ma ọ bụ ihe atụ Redbot gị ga-enye gị nsonaazụ njehie a.

Red requires all Privileged Intents to be enabled.
 You can find out how to enable Privileged Intents with this guide:
 https://docs.discord.red/en/stable/bot_application_guide.html#enabling-privileged-intents

Iji mee ka ikike intent dị mkpa achọrọ, gaa na ngalaba Bot na ibe ndị nrụpụta Discord gị.

ubuntu 20.04 redbot discord bot nwere ihe ùgwù

Pịgharịa gaa na ngalaba "Njirimara Gateway Intent", mee ka ebumnuche abụọ ahụ nwee ihe ùgwù wee chekwaa mgbanwe gị.

ubuntu 20.04 redbot discord bot nwere ihe ùgwù ga-enu ụzọ

Na-esote, megharịa ihe atụ Redbot gị. Ị ga-ahụ ugbu a na njehie apụọla na a na-ahụ nhọrọ ntọala ọhụrụ.

Họrọ prefix maka Redbot gị ka ị gee ntị na ọwa Discord. Ndị ama ama bụ! na @.

Pick a prefix. A prefix is what you type before a command. Example:
 !help
 ^ The exclamation mark is the prefix in this case.
 The prefix can be multiple characters. You will be able to change it later and add more of them.
 Choose your prefix:
 Prefix> !

Ihe atụ Redbot na-agba ugbu a dị ka ọ dị n'okpuru.

ubuntu 20.04 redbot discord bot ikpeazụ anya na arụ ọrụ

Okwu na mmechi

Redbot bụ isi iyi mepere emepe nke mepere emepe nke nwere onwe ya nke ọma mara. Ọ bụrụ na nzuzo metụtara bots discord ọha, ị nwere ike na-arụ ọrụ nke ọma nke a ọbụna maka ndị enyi gị na nhazi VMware ma ọ bụ Docker nwere nnabata onwe gị. Ọbá akwụkwọ ngwa mgbakwunye buru ibu ma kpuchie ọtụtụ ihe bots Discord na-ewu ewu na-ekpuchi. Agbanyeghị, ọ bụrụ na ịchọrọ nke UI webụ, ị ga-achọ ngalaba na ụfọdụ ịma-usoro azụmaahịa maka ịme ihe atụ Discord bot gị karịa ihe ọjọọ ọ bụla. Ọzọkwa, Redbot nwere nchebe, na-enye gị udo nke uche.

Enwere ike ịchọta plugins obodo maka Redbot nke enyochagoro na ịpị ebe a.

Ahapụ a Comment