Skip to content

A simple custom bot that alerts when someone comes into the VC

Notifications You must be signed in to change notification settings

GiToon10100011/DiscordVCAlarmBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Discord Voice Channel Monitor Bot

This Discord bot monitors specified voice channels and sends notifications when users join, leave, or switch between them. It also includes an AFK mode feature that automatically responds to users who join your voice channel while you're away.

Features

  • πŸ”Š Voice Channel Monitoring: Get notified when users join, leave, or switch between specified voice channels
  • πŸ“± Multiple Notification Methods: Receive notifications via Discord DMs and ntfy.sh
  • 🚫 AFK Mode: Automatically respond to users who join your voice channel while you're away
  • πŸ”” Return Notifications: Automatically notifies users who joined while you were AFK when you return
  • πŸ“Š Status Command: Check current bot settings including AFK status, notification channels, and active users
  • βš™οΈ Customizable Settings: Set custom AFK messages and notification channels

Setup Instructions

Prerequisites

  • Node.js (v16.9.0 or higher)
  • A Discord account and a Discord bot token
  • A Discord server where you have permission to add bots

Step 1: Create a Discord Bot

  1. Go to the Discord Developer Portal
  2. Click "New Application" and give it a name
  3. Navigate to the "Bot" tab and click "Add Bot"
  4. Under the "Privileged Gateway Intents" section, enable:
    • Server Members Intent
    • Message Content Intent
  5. Copy your bot token (you'll need this later)

Step 2: Invite the Bot to Your Server

  1. Go to the "OAuth2" > "URL Generator" tab
  2. Select the following scopes:
    • bot
    • applications.commands
  3. Select the following bot permissions:
    • Read Messages/View Channels
    • Send Messages
    • Read Message History
    • Connect to Voice
  4. Copy the generated URL and open it in your browser to invite the bot to your server

Step 3: Set Up the Project

  1. Clone or download this repository
  2. Install dependencies:
    npm install
  3. Create a .env file in the project root with the following variables:
# Discord Configuration
DISCORD_TOKEN=your_discord_bot_token
DISCORD_USER_ID=your_discord_user_id
TARGET_VOICE_CHANNEL1_ID=first_voice_channel_id_to_monitor
TARGET_VOICE_CHANNEL2_ID=second_voice_channel_id_to_monitor
...
NOTIFICATION_CHANNEL_ID=channel_id_for_afk_notifications

# NTFY Configuration
NTFY_TOPIC=your_ntfy_topic_name

Step 4: Get the Required IDs

To find the IDs you need:

  1. Enable Developer Mode in Discord (User Settings > Advanced > Developer Mode)
  2. Right-click on a voice channel and select "Copy ID" to get the voice channel ID
  3. Right-click on your username and select "Copy ID" to get your user ID
  4. Right-click on a text channel and select "Copy ID" to get the notification channel ID

Step 5: Set Up NTFY

  1. Choose a unique topic name for your notifications
  2. Add this topic name to your .env file as NTFY_TOPIC
  3. Install the ntfy app on your mobile device
  4. Subscribe to your topic in the app

Step 6: Run the Bot

node index.js

Usage

AFK Mode

Use the /afk command to manage AFK mode:

  • /afk action:on - Enable AFK mode with the default message
  • /afk action:on message:Your custom message - Enable AFK mode with a custom message
  • /afk action:on channel:#channel-name - Enable AFK mode and set a specific notification channel
  • /afk action:off - Disable AFK mode

Notifications

The bot will automatically send notifications when:

  1. A user joins one of the monitored voice channels
  2. A user switches between monitored voice channels
  3. A user leaves a monitored voice channel

Notifications will be sent to:

  • Your Discord DMs
  • Your ntfy topic (which you can receive on mobile)

When AFK mode is enabled, the bot will also send a message in the specified text channel to notify users who join your voice channel that you're away.

Status Command

Use the /status command to check the current bot configuration:

  • Shows whether AFK mode is enabled or disabled
  • Displays the current notification channel
  • Shows your current AFK message
  • Lists all monitored voice channels
  • When AFK mode is active, shows users who joined during your absence

Customization

You can modify the following aspects of the bot:

  • Add more voice channels to monitor by adding them to the .env file
  • Change the notification format by editing the embed creation in the code
  • Customize the AFK message using the /afk command

Troubleshooting

  • If the bot doesn't respond to commands, make sure you've enabled the correct intents in the Discord Developer Portal
  • If you're not receiving notifications, check that your user ID is correctly set in the .env file
  • For ntfy issues, verify your topic name and check that you're subscribed to it in the app

License

This project is open source and available for anyone to use and modify.


λ””μŠ€μ½”λ“œ μŒμ„± 채널 λͺ¨λ‹ˆν„°λ§ 봇

이 λ””μŠ€μ½”λ“œ 봇은 μ§€μ •λœ μŒμ„± 채널을 λͺ¨λ‹ˆν„°λ§ν•˜κ³  μ‚¬μš©μžκ°€ μž…μž₯, 퇴μž₯ λ˜λŠ” 채널 κ°„ 이동할 λ•Œ μ•Œλ¦Όμ„ λ³΄λƒ…λ‹ˆλ‹€. λ˜ν•œ 자리λ₯Ό λΉ„μšΈ λ•Œ μŒμ„± 채널에 μž…μž₯ν•˜λŠ” μ‚¬μš©μžμ—κ²Œ μžλ™μœΌλ‘œ μ‘λ‹΅ν•˜λŠ” AFK λͺ¨λ“œ κΈ°λŠ₯도 ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

κΈ°λŠ₯

  • πŸ”Š μŒμ„± 채널 λͺ¨λ‹ˆν„°λ§: μ‚¬μš©μžκ°€ μ§€μ •λœ μŒμ„± 채널에 μž…μž₯, 퇴μž₯ λ˜λŠ” 이동할 λ•Œ μ•Œλ¦Ό λ°›κΈ°
  • πŸ“± λ‹€μ–‘ν•œ μ•Œλ¦Ό 방법: Discord DMκ³Ό ntfy.shλ₯Ό 톡해 μ•Œλ¦Ό λ°›κΈ°
  • 🚫 AFK λͺ¨λ“œ: 자리λ₯Ό λΉ„μšΈ λ•Œ μŒμ„± 채널에 μž…μž₯ν•˜λŠ” μ‚¬μš©μžμ—κ²Œ μžλ™μœΌλ‘œ 응닡
  • πŸ”” 볡귀 μ•Œλ¦Ό: AFK μƒνƒœμ—μ„œ λŒμ•„μ™”μ„ λ•Œ κ·Έλ™μ•ˆ μž…μž₯ν•œ μ‚¬μš©μžλ“€μ—κ²Œ μžλ™μœΌλ‘œ μ•Œλ¦Ό
  • πŸ“Š μƒνƒœ 확인 λͺ…λ Ήμ–΄: AFK μƒνƒœ, μ•Œλ¦Ό 채널, ν™œμ„± μ‚¬μš©μž λ“± ν˜„μž¬ 봇 μ„€μ • 확인
  • βš™οΈ 맞좀 μ„€μ •: μ‚¬μš©μž μ •μ˜ AFK λ©”μ‹œμ§€ 및 μ•Œλ¦Ό 채널 μ„€μ •

μ„€μΉ˜ 방법

ν•„μˆ˜ 쑰건

  • Node.js (v16.9.0 이상)
  • Discord 계정 및 Discord 봇 토큰
  • 봇을 μΆ”κ°€ν•  κΆŒν•œμ΄ μžˆλŠ” Discord μ„œλ²„

1단계: Discord 봇 생성

  1. Discord 개발자 ν¬ν„Έλ‘œ 이동
  2. "New Application"을 ν΄λ¦­ν•˜κ³  이름 μ§€μ •
  3. "Bot" νƒ­μœΌλ‘œ μ΄λ™ν•˜μ—¬ "Add Bot" 클릭
  4. "Privileged Gateway Intents" μ„Ήμ…˜μ—μ„œ λ‹€μŒ ν•­λͺ© ν™œμ„±ν™”:
    • Server Members Intent
    • Message Content Intent
  5. 봇 토큰 볡사 (λ‚˜μ€‘μ— ν•„μš”ν•¨)

2단계: μ„œλ²„μ— 봇 μ΄ˆλŒ€

  1. "OAuth2" > "URL Generator" νƒ­μœΌλ‘œ 이동
  2. λ‹€μŒ μŠ€μ½”ν”„ 선택:
    • bot
    • applications.commands
  3. λ‹€μŒ 봇 κΆŒν•œ 선택:
    • λ©”μ‹œμ§€ 읽기/채널 보기
    • λ©”μ‹œμ§€ 보내기
    • λ©”μ‹œμ§€ 기둝 읽기
    • μŒμ„± μ—°κ²°
  4. μƒμ„±λœ URL을 λ³΅μ‚¬ν•˜μ—¬ λΈŒλΌμš°μ €μ—μ„œ μ—΄μ–΄ 봇을 μ„œλ²„μ— μ΄ˆλŒ€

3단계: ν”„λ‘œμ νŠΈ μ„€μ •

  1. 이 μ €μž₯μ†Œλ₯Ό ν΄λ‘ ν•˜κ±°λ‚˜ λ‹€μš΄λ‘œλ“œ
  2. μ˜μ‘΄μ„± μ„€μΉ˜:
    npm install
  3. ν”„λ‘œμ νŠΈ λ£¨νŠΈμ— λ‹€μŒ λ³€μˆ˜κ°€ ν¬ν•¨λœ .env 파일 생성:
# Discord Configuration
DISCORD_TOKEN=λ””μŠ€μ½”λ“œ_봇_토큰
DISCORD_USER_ID=λ‹Ήμ‹ μ˜_λ””μŠ€μ½”λ“œ_μ‚¬μš©μž_ID
TARGET_VOICE_CHANNEL1_ID=λͺ¨λ‹ˆν„°λ§ν• _첫번째_μŒμ„±μ±„λ„_ID
TARGET_VOICE_CHANNEL2_ID=λͺ¨λ‹ˆν„°λ§ν• _λ‘λ²ˆμ§Έ_μŒμ„±μ±„λ„_ID
...
NOTIFICATION_CHANNEL_ID=AFK_μ•Œλ¦Όμš©_채널_ID

# NTFY Configuration
NTFY_TOPIC=λ‹Ήμ‹ μ˜_NTFY_ν† ν”½_이름

4단계: ν•„μš”ν•œ ID κ°€μ Έμ˜€κΈ°

ν•„μš”ν•œ IDλ₯Ό μ°ΎλŠ” 방법:

  1. Discordμ—μ„œ 개발자 λͺ¨λ“œ ν™œμ„±ν™” (μ‚¬μš©μž μ„€μ • > κ³ κΈ‰ > 개발자 λͺ¨λ“œ)
  2. μŒμ„± 채널을 μš°ν΄λ¦­ν•˜κ³  "ID 볡사"λ₯Ό μ„ νƒν•˜μ—¬ μŒμ„± 채널 ID κ°€μ Έμ˜€κΈ°
  3. μ‚¬μš©μž 이름을 μš°ν΄λ¦­ν•˜κ³  "ID 볡사"λ₯Ό μ„ νƒν•˜μ—¬ μ‚¬μš©μž ID κ°€μ Έμ˜€κΈ°
  4. ν…μŠ€νŠΈ 채널을 μš°ν΄λ¦­ν•˜κ³  "ID 볡사"λ₯Ό μ„ νƒν•˜μ—¬ μ•Œλ¦Ό 채널 ID κ°€μ Έμ˜€κΈ°

5단계: NTFY μ„€μ •

  1. μ•Œλ¦Όμ„ μœ„ν•œ κ³ μœ ν•œ ν† ν”½ 이름 선택
  2. 이 ν† ν”½ 이름을 .env νŒŒμΌμ— NTFY_TOPIC으둜 μΆ”κ°€
  3. λͺ¨λ°”일 기기에 ntfy μ•± μ„€μΉ˜
  4. μ•±μ—μ„œ ν† ν”½ ꡬ독

6단계: 봇 μ‹€ν–‰

node index.js

μ‚¬μš© 방법

AFK λͺ¨λ“œ

/afk λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜μ—¬ AFK λͺ¨λ“œ 관리:

  • /afk action:on - κΈ°λ³Έ λ©”μ‹œμ§€λ‘œ AFK λͺ¨λ“œ ν™œμ„±ν™”
  • /afk action:on message:μ‚¬μš©μž μ •μ˜ λ©”μ‹œμ§€ - μ‚¬μš©μž μ •μ˜ λ©”μ‹œμ§€λ‘œ AFK λͺ¨λ“œ ν™œμ„±ν™”
  • /afk action:on channel:#채널-이름 - AFK λͺ¨λ“œ ν™œμ„±ν™” 및 νŠΉμ • μ•Œλ¦Ό 채널 μ„€μ •
  • /afk action:off - AFK λͺ¨λ“œ λΉ„ν™œμ„±ν™”

μ•Œλ¦Ό

봇은 λ‹€μŒ μƒν™©μ—μ„œ μžλ™μœΌλ‘œ μ•Œλ¦Όμ„ λ³΄λƒ…λ‹ˆλ‹€:

  1. μ‚¬μš©μžκ°€ λͺ¨λ‹ˆν„°λ§ 쀑인 μŒμ„± 채널에 μž…μž₯ν•  λ•Œ
  2. μ‚¬μš©μžκ°€ λͺ¨λ‹ˆν„°λ§ 쀑인 μŒμ„± 채널 간에 이동할 λ•Œ
  3. μ‚¬μš©μžκ°€ λͺ¨λ‹ˆν„°λ§ 쀑인 μŒμ„± μ±„λ„μ—μ„œ 퇴μž₯ν•  λ•Œ

μ•Œλ¦Όμ€ λ‹€μŒ 경둜둜 μ „μ†‘λ©λ‹ˆλ‹€:

  • Discord DM
  • ntfy ν† ν”½ (λͺ¨λ°”μΌμ—μ„œ μˆ˜μ‹  κ°€λŠ₯)

AFK λͺ¨λ“œκ°€ ν™œμ„±ν™”λ˜λ©΄, 봇은 μ§€μ •λœ ν…μŠ€νŠΈ 채널에 λ©”μ‹œμ§€λ₯Ό 보내 μŒμ„± 채널에 μž…μž₯ν•œ μ‚¬μš©μžμ—κ²Œ 자리λ₯Ό λΉ„μ› μŒμ„ μ•Œλ¦½λ‹ˆλ‹€.

μƒνƒœ 확인 λͺ…λ Ήμ–΄

/status λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜μ—¬ ν˜„μž¬ 봇 μ„€μ • 확인:

  • AFK λͺ¨λ“œ ν™œμ„±ν™” μ—¬λΆ€ ν‘œμ‹œ
  • ν˜„μž¬ μ•Œλ¦Ό 채널 ν‘œμ‹œ
  • ν˜„μž¬ AFK λ©”μ‹œμ§€ ν‘œμ‹œ
  • λͺ¨λ“  λͺ¨λ‹ˆν„°λ§ 쀑인 μŒμ„± 채널 λͺ©λ‘ 확인
  • AFK λͺ¨λ“œκ°€ ν™œμ„±ν™”λœ 경우, λΆ€μž¬ 쀑 μž…μž₯ν•œ μ‚¬μš©μž ν‘œμ‹œ

μ»€μŠ€ν„°λ§ˆμ΄μ§•

λ‹€μŒκ³Ό 같은 λ΄‡μ˜ 츑면을 μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

  • .env νŒŒμΌμ— μΆ”κ°€ν•˜μ—¬ λͺ¨λ‹ˆν„°λ§ν•  μŒμ„± 채널 μΆ”κ°€
  • μ½”λ“œμ—μ„œ μž„λ² λ“œ 생성을 νŽΈμ§‘ν•˜μ—¬ μ•Œλ¦Ό ν˜•μ‹ λ³€κ²½
  • /afk λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜μ—¬ AFK λ©”μ‹œμ§€ μ‚¬μš©μž μ •μ˜

문제 ν•΄κ²°

  • 봇이 λͺ…령에 μ‘λ‹΅ν•˜μ§€ μ•ŠλŠ” 경우, Discord 개발자 ν¬ν„Έμ—μ„œ μ˜¬λ°”λ₯Έ μΈν…νŠΈλ₯Ό ν™œμ„±ν™”ν–ˆλŠ”μ§€ 확인
  • μ•Œλ¦Όμ„ λ°›μ§€ λͺ»ν•˜λŠ” 경우, .env νŒŒμΌμ— μ‚¬μš©μž IDκ°€ μ˜¬λ°”λ₯΄κ²Œ μ„€μ •λ˜μ–΄ μžˆλŠ”μ§€ 확인
  • ntfy 문제의 경우, ν† ν”½ 이름을 ν™•μΈν•˜κ³  μ•±μ—μ„œ ν•΄λ‹Ή 토픽을 κ΅¬λ…ν–ˆλŠ”μ§€ 확인

λΌμ΄μ„ΌμŠ€

이 ν”„λ‘œμ νŠΈλŠ” μ˜€ν”ˆ μ†ŒμŠ€μ΄λ©° λˆ„κ΅¬λ‚˜ μ‚¬μš©ν•˜κ³  μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

About

A simple custom bot that alerts when someone comes into the VC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published