mirror of
https://github.com/alterware/aw-bot.git
synced 2026-10-24 11:18:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da5aecc342
|
||
|
|
6565993e7f
|
||
|
|
6586d899cc
|
||
|
|
bdf4b47e62
|
||
|
|
6829f551f5
|
||
|
|
4c37d2eed3
|
||
|
|
6668035306 | ||
|
|
b52990fef6 | ||
|
|
6127c53bfb | ||
|
|
f09adb7dba | ||
|
|
d2ba77dc3f | ||
|
|
2ff05f7593 | ||
|
|
8f8f4c21f7 | ||
|
|
232bcefc8d | ||
|
|
7f5c3844db | ||
|
|
ee66c930ca | ||
|
|
da39d52de4 | ||
|
|
a22f2ca943 | ||
|
|
de9b11c6d8 | ||
|
|
bf1b41ecbb | ||
|
|
a7e2a1fa3f | ||
|
|
b1be58f500 | ||
|
|
e1f0b4bcca | ||
|
|
8f30d047a3 | ||
|
|
f26a175941 | ||
|
|
8743513fbc | ||
|
|
b0e252751f | ||
|
|
94beb8e501 | ||
|
|
7310d18b5d | ||
|
|
fc42aa4013 | ||
|
|
1c8b5bf1c3 | ||
|
|
850cde7c8f |
No files matched your search
@@ -19,19 +19,19 @@ jobs:
|
|||||||
lfs: true
|
lfs: true
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3.7.0
|
uses: docker/setup-qemu-action@v4.1.0
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3.12.0
|
uses: docker/setup-buildx-action@v4.1.0
|
||||||
|
|
||||||
- name: Log in to DockerHub
|
- name: Log in to DockerHub
|
||||||
uses: docker/login-action@v3.7.0
|
uses: docker/login-action@v4.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- id: meta
|
- id: meta
|
||||||
uses: docker/metadata-action@v5.10.0
|
uses: docker/metadata-action@v6.1.0
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
alterware/aw-bot
|
alterware/aw-bot
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6.18.0
|
uses: docker/build-push-action@v7.2.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|||||||
@@ -25,12 +25,23 @@ SPAM_ROLE_ID = 1350511935677927514
|
|||||||
ADMIN_ROLE_ID = 1112364483915042908
|
ADMIN_ROLE_ID = 1112364483915042908
|
||||||
GROK_ROLE_ID = 1362837967919386916
|
GROK_ROLE_ID = 1362837967919386916
|
||||||
|
|
||||||
|
MW2_CHANNEL = 1145458108190163014
|
||||||
|
MW3_CHANNEL = 1145459504436220014
|
||||||
|
GHOST_CHANNEL_ID = 1145469106133401682
|
||||||
|
AW_CHANNEL_ID = 1145469136919613551
|
||||||
|
DEPRECATED_SUPPORT_CHANNELS = [
|
||||||
|
AW_CHANNEL_ID,
|
||||||
|
MW2_CHANNEL,
|
||||||
|
MW3_CHANNEL,
|
||||||
|
]
|
||||||
|
deprecated_support_last_response_time = None
|
||||||
|
|
||||||
ALLOWED_CHANNELS = [
|
ALLOWED_CHANNELS = [
|
||||||
1112048063448617142, # off-topic
|
1112048063448617142, # off-topic
|
||||||
1119371841711112314, # vip-channel
|
1119371841711112314, # vip-channel
|
||||||
1382808781032914975, # launcher-support
|
1382808781032914975, # launcher-support
|
||||||
1180796301953212537, # bo3-support
|
1180796301953212537, # bo3-support
|
||||||
1145459504436220014, # mw3-support
|
MW3_CHANNEL, # mw3-support
|
||||||
]
|
]
|
||||||
|
|
||||||
# Discord embed limits
|
# Discord embed limits
|
||||||
@@ -98,6 +109,26 @@ async def handle_at_everyone(message):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
async def handle_deprecated_support_channel(message):
|
||||||
|
global deprecated_support_last_response_time
|
||||||
|
|
||||||
|
if message.channel.id in DEPRECATED_SUPPORT_CHANNELS:
|
||||||
|
now = aware_utcnow()
|
||||||
|
if (
|
||||||
|
deprecated_support_last_response_time is None
|
||||||
|
or now - deprecated_support_last_response_time >= timedelta(minutes=180)
|
||||||
|
):
|
||||||
|
deprecated_support_last_response_time = now
|
||||||
|
await message.reply(
|
||||||
|
"Do not ask for support in this channel because the client is no longer "
|
||||||
|
"working. See our announcement channel.",
|
||||||
|
mention_author=True,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def fetch_image_from_message(message):
|
def fetch_image_from_message(message):
|
||||||
image_object = None
|
image_object = None
|
||||||
for attachment in message.attachments:
|
for attachment in message.attachments:
|
||||||
@@ -471,6 +502,9 @@ async def handle_message(message, bot):
|
|||||||
|
|
||||||
await is_message_a_duplicate(message)
|
await is_message_a_duplicate(message)
|
||||||
|
|
||||||
|
if await handle_deprecated_support_channel(message):
|
||||||
|
return
|
||||||
|
|
||||||
if (
|
if (
|
||||||
"http" in message.content
|
"http" in message.content
|
||||||
and not message.embeds
|
and not message.embeds
|
||||||
|
|||||||
@@ -5,30 +5,30 @@ import discord
|
|||||||
from bot.log import logger
|
from bot.log import logger
|
||||||
|
|
||||||
MP3_PATH = "sounds/hello.mp3"
|
MP3_PATH = "sounds/hello.mp3"
|
||||||
|
_locks: dict[int, asyncio.Lock] = {}
|
||||||
|
|
||||||
|
|
||||||
async def handle_voice_state_update(member, before, after, bot):
|
async def handle_voice_state_update(member, before, after, bot):
|
||||||
# Ignore bot users
|
|
||||||
if member.bot:
|
if member.bot:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if the member joined a new voice channel
|
|
||||||
if after.channel and (before.channel != after.channel):
|
if after.channel and (before.channel != after.channel):
|
||||||
voice_channel = after.channel
|
voice_channel = after.channel
|
||||||
|
guild_id = voice_channel.guild.id
|
||||||
|
lock = _locks.setdefault(guild_id, asyncio.Lock())
|
||||||
|
|
||||||
try:
|
if lock.locked():
|
||||||
# Join the voice channel
|
return # a connect for this guild is already in flight
|
||||||
vc = await voice_channel.connect()
|
|
||||||
|
|
||||||
# Play the MP3 file
|
async with lock:
|
||||||
vc.play(discord.FFmpegPCMAudio(MP3_PATH))
|
# bail if we're already connected to this guild's voice
|
||||||
|
if voice_channel.guild.voice_client is not None:
|
||||||
# Wait for playback to finish
|
return
|
||||||
while vc.is_playing():
|
try:
|
||||||
await asyncio.sleep(1)
|
vc = await voice_channel.connect()
|
||||||
|
vc.play(discord.FFmpegPCMAudio(MP3_PATH))
|
||||||
# Disconnect
|
while vc.is_playing():
|
||||||
await vc.disconnect()
|
await asyncio.sleep(1)
|
||||||
|
await vc.disconnect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Error while connecting to a voice channel: %s", e)
|
logger.error("Error while connecting to a voice channel: %s", e)
|
||||||
@@ -16,10 +16,6 @@ OFFTOPIC_CHANNEL = 1112048063448617142
|
|||||||
SPAM_ROLE_ID = 1350511935677927514
|
SPAM_ROLE_ID = 1350511935677927514
|
||||||
|
|
||||||
COD_GAMES = {
|
COD_GAMES = {
|
||||||
10180: {"name": "Modern Warfare 2 (2009)", "channel": 1145458108190163014},
|
|
||||||
42680: {"name": "Modern Warfare 3 (2011)", "channel": 1145459504436220014},
|
|
||||||
209160: {"name": "Call of Duty: Ghosts", "channel": 1145469106133401682},
|
|
||||||
209650: {"name": "Call of Duty: Advanced Warfare", "channel": 1145469136919613551},
|
|
||||||
311210: {"name": "Call of Duty: Black Ops 3", "channel": 1180796251529293844},
|
311210: {"name": "Call of Duty: Black Ops 3", "channel": 1180796251529293844},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
discord.py
|
discord.py
|
||||||
requests
|
requests
|
||||||
|
davey
|
||||||
audioop-lts
|
audioop-lts
|
||||||
python-dotenv
|
python-dotenv
|
||||||
pynacl
|
pynacl
|
||||||
|
|||||||
Reference in new issue
Block a user