Skip to content

Commit

Permalink
Added some feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank-0407 committed Jul 3, 2023
1 parent 499e840 commit 54e1590
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
Binary file added __pycache__/chatterbot.cpython-311.pyc
Binary file not shown.
Binary file modified __pycache__/news.cpython-311.pyc
Binary file not shown.
32 changes: 31 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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():
Expand All @@ -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')
Expand Down Expand Up @@ -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'))
11 changes: 11 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
37 changes: 37 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 54e1590

Please sign in to comment.