droped travel as DiscordRPG now has its own notification
This commit is contained in:
parent
dcc002ac23
commit
adb31a48e5
4
bot.py
4
bot.py
|
@ -58,9 +58,7 @@ async def help(ctx):
|
||||||
" __14 seconds:__ {0}adv\n"
|
" __14 seconds:__ {0}adv\n"
|
||||||
" __300 seconds:__ {0}mine, {0}chop, {0}fish, {0}forage\n"
|
" __300 seconds:__ {0}mine, {0}chop, {0}fish, {0}forage\n"
|
||||||
" __600 seconds:__ {0}search\n"
|
" __600 seconds:__ {0}search\n"
|
||||||
" __various:__ {0}travel (you must of done {0}location "
|
"\n"
|
||||||
"in the same channel within the last 30s, you will get "
|
|
||||||
"pinged when you arive)\n\n"
|
|
||||||
"My commands:\n"
|
"My commands:\n"
|
||||||
" **{0}help** shows this message\n"
|
" **{0}help** shows this message\n"
|
||||||
" **{0}links** shows a message with links to add me to "
|
" **{0}links** shows a message with links to add me to "
|
||||||
|
|
21
drpg.py
21
drpg.py
|
@ -1,7 +1,7 @@
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import asyncio
|
import asyncio
|
||||||
from utils import read_adv, read_stats, read_travel, DEST_RE
|
from utils import read_adv, read_stats
|
||||||
|
|
||||||
|
|
||||||
class drpg:
|
class drpg:
|
||||||
|
@ -69,25 +69,6 @@ class drpg:
|
||||||
await self.bot.send_message(message.channel, out)
|
await self.bot.send_message(message.channel, out)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
elif message.embeds != []:
|
|
||||||
try:
|
|
||||||
user, destinations = read_travel(**message.embeds[0])
|
|
||||||
print(user)
|
|
||||||
def travel_check(message):
|
|
||||||
return message.author.id == '170915625722576896' and \
|
|
||||||
message.content.startswith(user)
|
|
||||||
travel = await self.bot.wait_for_message(timeout=30,
|
|
||||||
check=travel_check,
|
|
||||||
channel=message.channel)
|
|
||||||
user = message.server.get_member_named(user)
|
|
||||||
if travel is not None:
|
|
||||||
destination = DEST_RE.search(travel.content) \
|
|
||||||
.groups(0)[0]
|
|
||||||
await asyncio.sleep(destinations[destination])
|
|
||||||
m = f'{user.mention} you have arived at {destination}'
|
|
||||||
await self.bot.send_message(message.channel, m)
|
|
||||||
except Exception:
|
|
||||||
raise
|
|
||||||
elif message.server.me in message.mentions and \
|
elif message.server.me in message.mentions and \
|
||||||
'prefix' in message.content.lower():
|
'prefix' in message.content.lower():
|
||||||
m1 = '**The prefix for this server is currently set to:** {}'
|
m1 = '**The prefix for this server is currently set to:** {}'
|
||||||
|
|
13
utils.py
13
utils.py
|
@ -59,16 +59,3 @@ def read_stats(content):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
LOC_USR_RE = re.compile(r'(.+)\'s location')
|
|
||||||
CLEAN_DEST_RE = re.compile(r'([A-Za-z \']+) - (\d+)s')
|
|
||||||
|
|
||||||
def read_travel(title, fields, **kwargs):
|
|
||||||
if title.endswith('location') and fields[0]["name"] == "Kingdom":
|
|
||||||
rawdestinations = fields[1]["value"].split('\n')
|
|
||||||
desetinations = {i[0]: int(i[1])
|
|
||||||
for i in [CLEAN_DEST_RE.search(i).groups()
|
|
||||||
for i in rawdestinations]}
|
|
||||||
user = LOC_USR_RE.search(title).groups(0)[0]
|
|
||||||
return user, desetinations
|
|
||||||
|
|
||||||
DEST_RE = re.compile(r'started their journey to ([A-Za-z \']+)!')
|
|
||||||
|
|
Loading…
Reference in New Issue