Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 0ed6428

Browse files
authored
Merge pull request #98 from is-a-dev/developments
Fix bot
2 parents d859434 + ee9e40c commit 0ed6428

File tree

3 files changed

+59
-7
lines changed

3 files changed

+59
-7
lines changed

_orangcbot/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010

1111
import nextcord
12-
from nextcord import ApplicationError, Intents
12+
from nextcord import ApplicationError, Game, Intents
1313
from nextcord.ext import application_checks as ac
1414
from nextcord.ext import commands, help_commands # type: ignore
1515

@@ -81,6 +81,7 @@ def convert_none_to_0(key: Optional[ConvertibleToInt] = None) -> int:
8181
case_insensitive=True,
8282
owner_ids=owner_ids,
8383
allowed_mentions=nextcord.AllowedMentions.none(),
84+
activity=Game("Busy being a Barbie Girl"),
8485
)
8586
# @bot.event
8687
# async def on_command_error(ctx, error):

_orangcbot/extensions/nonsense.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import aiohttp
77
import nextcord
8-
from nextcord import HTTPException, Interaction, SlashOption, slash_command
8+
from nextcord import HTTPException, Interaction, Object, SlashOption, slash_command
9+
from nextcord.ext import application_checks as ac
910
from nextcord.ext import commands
1011

1112
from .converters import (
@@ -290,6 +291,23 @@ class NonsenseSlash(commands.Cog):
290291
def __init__(self, bot: commands.Bot) -> None:
291292
self._bot: commands.Bot = bot
292293

294+
@nextcord.slash_command()
295+
@ac.is_owner()
296+
async def make_degen(
297+
self,
298+
interaction: Interaction,
299+
user: nextcord.Member = SlashOption(
300+
description="The degen-like user.", required=True
301+
),
302+
reason=SlashOption(
303+
description="Why this person should be a degen? Idrk.", required=True
304+
),
305+
) -> None:
306+
await user.add_roles(Object(id=1238746465111642122), reason=reason)
307+
await interaction.send(
308+
f"Master, I have made {str(user)} to be a degenerate. I'm sorry for all your loss, Master."
309+
)
310+
293311
@nextcord.slash_command()
294312
async def ban(
295313
self,

_orangcbot/extensions/oneword.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4-
from typing import Final
4+
from typing import Final, cast
55

66
import nextcord
77
from nextcord.ext import commands
@@ -14,6 +14,12 @@ class Oneword(commands.Cog):
1414
def __init__(self, bot: commands.Bot) -> None:
1515
self._bot: commands.Bot = bot
1616

17+
async def check_if_sending_consecutive_messages(
18+
self, channel: nextcord.TextChannel
19+
):
20+
messages: list[nextcord.Message] = await channel.history(limit=2).flatten()
21+
return messages[1].author == messages[0].author
22+
1723
@commands.Cog.listener()
1824
async def on_message(self, message: nextcord.Message) -> None:
1925
if message.author.bot:
@@ -22,13 +28,28 @@ async def on_message(self, message: nextcord.Message) -> None:
2228
return # type: ignore[reportAttributeAccessIssue]
2329
if message.channel.id != ONEWORD_CHANNEL_ID:
2430
return
25-
if " " in message.content:
31+
ONEWORD_CHANNEL = cast( # noqa: F841
32+
nextcord.TextChannel, self._bot.get_channel(ONEWORD_CHANNEL_ID)
33+
)
34+
35+
# r = await self.check_if_sending_consecutive_messages(ONEWORD_CHANNEL)
36+
if " " in message.content or "\n" in message.content:
2637
await message.delete()
27-
r = await message.channel.send(
28-
"Message which have space(s) are not allowed."
38+
s = await message.channel.send(
39+
"Message which have space(s) or newlines are not allowed."
2940
)
3041
await asyncio.sleep(5)
31-
await r.delete()
42+
await s.delete()
43+
return
44+
45+
# if r:
46+
# await message.delete()
47+
# s = await message.channel.send("Nice try, kid.")
48+
# await asyncio.sleep(5)
49+
# await s.delete()
50+
# return
51+
52+
return
3253

3354
@commands.Cog.listener()
3455
async def on_message_edit(
@@ -48,6 +69,18 @@ async def on_message_edit(
4869

4970
@commands.Cog.listener()
5071
async def on_message_delete(self, message: nextcord.Message) -> None:
72+
# audit_log = await message.guild.audit_logs(limit=1).flatten()
73+
# audit_log_entry: nextcord.AuditLogEntry = audit_log[0]
74+
# try:
75+
# assert audit_log_entry.action == nextcord.AuditLogAction.message_delete
76+
# except AssertionError:
77+
# return
78+
# if (
79+
# (audit_log_entry.action == nextcord.AuditLogAction.message_delete)
80+
# and (audit_log_entry.user == message.guild.me)
81+
# and (audit_log_entry.extra.channel.id == ONEWORD_CHANNEL_ID) # type: ignore
82+
# ):
83+
# return
5184
if message.author.bot:
5285
return
5386
if " " in message.content:

0 commit comments

Comments
 (0)