Code Monkey home page Code Monkey logo

bot-discord.js's Introduction

Tạo bot 🤖 discord với discord.js và erela.js

Bạn đã quá chán nản 💢 với việc nghe nhạc trên youtube mà lại bị gián đoạn bởi một đoạn quảng cáo nào đó 😞, hay khi nghe nhạc ️🎶 trên mobile phải luôn mở youtube mà không làm được việc khác trên điện thoại, bạn muốn tắt máy mà vẫn nghe được nhạc📱.

Ngoài việc cài đặt extension cho trình duyệt hay lên premium thì việc tạo một con bot 🤖 discord cũng khá là thú vị ák😒 (đặc biệt khi ở mobile thì không dùng extension như desktop được 😞).

Bài viết này sẽ nêu các chức năng cũng như cách cài đặt và sử dụng bot discord bằng thư viện discord.js.

Acknowledgments

Tech Stack

Code: Node, nodemon, fetchAPI, discord.js, dotenv, erela.js, js

Discord: set up develop bot discord.

Authors

Installation | How to use the Bot

1. Install node.js v16.14+ or higher

2. Download this repo and unzip it | or git clone https://github.com/nxhawk/bot-discord.js.git

3. Install all of the packages with npm install | the important packages are npm install discord.js@latest erela.js

4. Need to add the following environment variables to your .env file (see .env.example file).

5. start the bot with npm start / node . / npm run dev

NOTE:

If you are having errors/problems with starting delete the package.json file and do, before you install the packages npm init


Free Lavalink hosting

image

You can see more lavalink hosting.

Bot's execution commands

1. Message

1. !cat bot will reply with a cat photo

2. !dog bot will reply with a dog photo

3. !dark bot will reply to a meme image, but it's a bit dark (-)(-)

4. !quote returns a sentence of a certain famous person in English

5. load [url playlist youtube] bot will add the songs in this playlist to the queue (correct order). If no song is playing, bot will play the first song in the playlist
6. !top [url] add song on top quêu

7. !infor @<ID> get information userID

8. !help show help message

9. !bot call bot, If you want to play music call /clear before

10. !girl Show random beautiful girl image in Instagram

2. Interaction

1. /ping test interaction, bot will respond Pong pong pong

2. /order food: drink: order food and drink, bot only responds to the item you selected

3. /play song_name (url): will find and play the first song it finds with song_name(or url) on youtube. If there is a song playing bot will add it to the end of the queue music

4. /search song_name: will search and return information 10 results found on youtube with keyword song_name. After having this information, users can choose a song to play or add to the queue by entering the song's number in the search results.

5. /pause Pause the currently playing song

6. /unpause Resume playing paused song

7. /replay playback from the beginning of the currently playing song

8. /skip play the next song in the queue song

9. /infor return basic information of the currently playing song

10. /list Returns information about all songs in the song queue

11. /mix shuffle the song currently in the song queue

12. /clear Clear all queue music

13. /server get information of server

14. /getvolume get volume music now

15. /setvolume set volume music to x%

Development

  • Người dùng có thể thêm database (mongoseDB, SQL,...) để quản lí việc thêm, xóa bài hát, tạo playlist cho từng cá nhân cụ thể.
  • Deploy bot lên một server nào đó.
  • Thêm các API, chức năng khác như lấy một bài thơ ngẫu nhiên nào đó. Có thể thêm (tạo) server để quản lí việc gọi API.
  • Tích hợp chatGPT vào cũng khá thú vị🤔

Test bot

bot-discord.js's People

Contributors

nxhawk avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.