diff --git a/__pycache__/chatterbot.cpython-311.pyc b/__pycache__/chatterbot.cpython-311.pyc new file mode 100644 index 0000000..3e6a12b Binary files /dev/null and b/__pycache__/chatterbot.cpython-311.pyc differ diff --git a/__pycache__/news.cpython-311.pyc b/__pycache__/news.cpython-311.pyc index 8d2bf1c..3c6e916 100644 Binary files a/__pycache__/news.cpython-311.pyc and b/__pycache__/news.cpython-311.pyc differ diff --git a/bot.py b/bot.py index 75c3a81..c965a59 100644 --- a/bot.py +++ b/bot.py @@ -5,6 +5,7 @@ # pip install google-api-python-client # pip install pyowm # pip install ffmpeg-python +# pip install openai import discord import requests import json @@ -16,11 +17,18 @@ from joke import * import os from dotenv import load_dotenv +from discord.ext import commands load_dotenv() -intents = discord.Intents().all() +intents = discord.Intents().all() +intents_bot = discord.Intents.default() +# intents.typing = False +# intents.presences = False +intents_bot.message_content = True client = discord.Client(intents=intents) +bot = commands.Bot(command_prefix='$', intents=intents_bot) + appreciate=['thanks','Thanks','WellDone','well done'] def get_quotes(): @@ -29,6 +37,7 @@ def get_quotes(): quote=json_data[0]['q']+"-"+json_data[0]['a'] return quote + @client.event async def on_ready(): print('Successfully connected') @@ -111,4 +120,25 @@ async def on_message(message): joke = get_joke() await message.channel.send(joke) + # Moderation + if message.content.startswith('$warn'): + temp_member = message.content[5:].strip() + tempmember = discord.utils.get(message.guild.members, mention=temp_member) + if message.author.guild_permissions.kick_members: + await message.channel.send(f'{tempmember}-{temp_member} Warning!! Make Sure That you are following the discord rules, Other wise you will be kicked.') + else: + await message.channel.send("You don't have permission to warn members.") + + if message.content.startswith('$ban'): + if message.author.guild_permissions.ban_members: + tempmember = message.content[4:].strip() + tempmember = discord.utils.get(message.guild.members, mention=tempmember) + if tempmember is not None: + await tempmember.ban(reason='nothing') + await message.channel.send(f'{tempmember} has been banned.') + else: + await message.channel.send("User not found or not mentioned correctly.") + else: + await message.channel.send("You don't have permission to ban members.") + client.run(os.getenv('env_bot_token')) \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..94a1730 --- /dev/null +++ b/dockerfile @@ -0,0 +1,11 @@ +FROM python:3.9 + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD ["python", "bot.py"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c5fe78b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,37 @@ +aiohttp==3.8.4 +aiosignal==1.3.1 +async-timeout==4.0.2 +attrs==23.1.0 +cachetools==5.3.1 +certifi==2023.5.7 +charset-normalizer==3.1.0 +colorama==0.4.6 +discord.py==2.3.1 +ffmpeg-python==0.2.0 +frozenlist==1.3.3 +future==0.18.3 +geojson==2.5.0 +google-api-core==2.11.1 +google-api-python-client==2.91.0 +google-auth==2.21.0 +google-auth-httplib2==0.1.0 +googleapis-common-protos==1.59.1 +httplib2==0.22.0 +idna==3.4 +multidict==6.0.4 +openai==0.27.8 +protobuf==4.23.3 +pyasn1==0.5.0 +pyasn1-modules==0.3.0 +pyowm==3.3.0 +pyparsing==3.1.0 +PySocks==1.7.1 +python-dotenv==1.0.0 +requests==2.31.0 +rsa==4.9 +six==1.16.0 +tqdm==4.65.0 +uritemplate==4.1.1 +urllib3==1.26.16 +yarl==1.9.2 +youtube-dl==2021.12.17