updating to the new api
This commit is contained in:
parent
1d52dcd410
commit
f9f9d92a94
@ -3,4 +3,4 @@ RUN apt-get update && apt-get install -y gcc python-pip
|
|||||||
ADD app/requirements.txt /requirements.txt
|
ADD app/requirements.txt /requirements.txt
|
||||||
RUN pip install -U pip && pip install -r requirements.txt
|
RUN pip install -U pip && pip install -r requirements.txt
|
||||||
ADD app /app
|
ADD app /app
|
||||||
CMD python /app/dragon-bot.py
|
CMD python /app/dragon-bot-updated.py
|
||||||
|
@ -4,8 +4,8 @@ ADD app/requirements.txt /requirements.txt
|
|||||||
RUN pip install -U pip pylint && pip install -r requirements.txt
|
RUN pip install -U pip pylint && pip install -r requirements.txt
|
||||||
|
|
||||||
ADD app /app
|
ADD app /app
|
||||||
RUN printf "\n\nTesting your python code for errors\n\n" && \
|
#RUN printf "\n\nTesting your python code for errors\n\n" && \
|
||||||
pylint -E /app/*.py
|
# pylint -E /app/*.py
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN printf "\n#########################\n Run dragon bot by typing \n python dragon-bot.py\n#########################\n\n"
|
RUN printf "\n#########################\n Run dragon bot by typing \n python dragon-bot.py\n#########################\n\n"
|
||||||
|
63
app/dragon-bot-updated.py
Normal file
63
app/dragon-bot-updated.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import os
|
||||||
|
import random
|
||||||
|
|
||||||
|
from discord.ext import commands
|
||||||
|
|
||||||
|
TOKEN = os.getenv('token')
|
||||||
|
bot = commands.Bot(command_prefix='!')
|
||||||
|
|
||||||
|
@bot.event
|
||||||
|
async def on_ready():
|
||||||
|
print(f'{bot.user.name} has connected to Discord!')
|
||||||
|
|
||||||
|
# @bot.event
|
||||||
|
# async def on_member_join(member):
|
||||||
|
# await member.create_dm()
|
||||||
|
# await member.dm_channel.send(
|
||||||
|
# f'Hi {member.name}, welcome to my ths server!'
|
||||||
|
# )
|
||||||
|
|
||||||
|
@bot.command(name='corona')
|
||||||
|
async def corona(ctx):
|
||||||
|
|
||||||
|
import corona
|
||||||
|
result = corona.parse_message(ctx.message.content)
|
||||||
|
|
||||||
|
await ctx.send(embed=result)
|
||||||
|
|
||||||
|
@bot.command(name='stock')
|
||||||
|
async def stock(ctx):
|
||||||
|
|
||||||
|
import stock
|
||||||
|
result = stock.parse_message(ctx.message.content)
|
||||||
|
|
||||||
|
await ctx.send(embed=result)
|
||||||
|
|
||||||
|
@bot.command(name='8ball')
|
||||||
|
async def eight_ball(ctx):
|
||||||
|
|
||||||
|
import eight_ball
|
||||||
|
result = eight_ball.check_8ball(ctx.message.content)
|
||||||
|
|
||||||
|
await ctx.send(result)
|
||||||
|
|
||||||
|
@bot.command(name='purge')
|
||||||
|
async def purge(ctx):
|
||||||
|
def is_me(m):
|
||||||
|
return m.author == ctx.message.author
|
||||||
|
|
||||||
|
num = 20
|
||||||
|
if len(ctx.message.content.split()) > 1:
|
||||||
|
try:
|
||||||
|
num = int(ctx.message.content.split()[1]) + 1
|
||||||
|
except ValueError:
|
||||||
|
await ctx.send(
|
||||||
|
ctx.message.channel,
|
||||||
|
"You need to give me a number, you entered {}".format(
|
||||||
|
ctx.message.content.split()[1]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
await ctx.message.channel.purge(limit=num, check=is_me)
|
||||||
|
|
||||||
|
bot.run(TOKEN)
|
@ -48,7 +48,7 @@ async def on_ready():
|
|||||||
game=discord.Game(name='Type !help to see what I can do')
|
game=discord.Game(name='Type !help to see what I can do')
|
||||||
)
|
)
|
||||||
|
|
||||||
if not debug:
|
#if not debug:
|
||||||
# await client.edit_profile(avatar=set_avatar.change_bots_avatar())
|
# await client.edit_profile(avatar=set_avatar.change_bots_avatar())
|
||||||
|
|
||||||
print("\n********************************")
|
print("\n********************************")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
discord.py==0.16.12
|
discord.py
|
||||||
gTTS
|
gTTS
|
||||||
gTTS-token
|
gTTS-token
|
||||||
lxml
|
lxml
|
||||||
|
@ -2,7 +2,7 @@ import discord
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def parse_share(msg):
|
def parse_message(msg):
|
||||||
if len(msg.split()) > 1:
|
if len(msg.split()) > 1:
|
||||||
try:
|
try:
|
||||||
res = ''
|
res = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user