from discord.ext import commands
from core.classes import Cog_Extension
import requests
import json
from datetime import datetime
from operator import itemgetter
import discord
from discord_slash.utils.manage_commands import create_option, create_choice
from discord_slash import cog_ext,SlashContext
from language import language as lang

lang = lang()
lang = lang.langpref()['worldState']

class worldState(Cog_Extension):
  tag = "Warframe"

  def timeConv(self,expiry):
    h = int(expiry[11:13]) + 8
    if h >= 24:
      h -=24
    m = expiry[14:16]
    m = ("0" if len(m) == 1 else "") + m
    s = expiry[17:19]
    s = ("0" if len(s) == 1 else "") + s
    return(str(h)+":"+m)
  
  @commands.command(name='POE',aliases=lang['poe.aliases'],brief=lang['poe.brief'],description=lang['poe.description'])
  async def eidolontime(self,ctx):
    html = requests.get('https://api.warframestat.us/pc/cetusCycle').text
    data = json.loads(html)
Exemple #2
0
from discord.ext import commands
from core.classes import Cog_Extension
import discord
from mwclient import Site
import json
from fuzzywuzzy import process
from discord_slash.utils.manage_commands import create_option, create_choice
from discord_slash import SlashContext, cog_ext
from language import language as lang

lang = lang()
lang = lang.langpref()['wiki']

with open('setting.json', 'r', encoding='utf8') as jfile:
    jdata = json.load(jfile)

zhURL = 'warframe.huijiwiki.com'
tcURL = 'warframe.fandom.com'
enURL = 'warframe.fandom.com'

zh = Site(zhURL, scheme='http')
tc = Site(tcURL, path='/zh-tw/', scheme='http')
en = Site(enURL, path='/', scheme='http')


class wiki(Cog_Extension):
    tag = "Warframe"

    @commands.command(name='update_wiki',
                      brief=lang['update_wiki.brief'],
                      description=lang['update_wiki.description'])
Exemple #3
0
import discord
from discord.ext import commands
from core.classes import Cog_Extension
import random
import json
from random import randint
import requests
import re
import asyncio
from discord_slash.utils.manage_commands import create_option, create_choice
from discord_slash import SlashContext, cog_ext
from language import language as lang

lang = lang()
lang = lang.langpref()['common']

with open('setting.json', 'r', encoding='utf8') as jfile:
    jdata = json.load(jfile)

emoji = requests.get(
    "http://gist.githubusercontent.com/Vexs/629488c4bb4126ad2a9909309ed6bd71/raw/416403f7080d1b353d8517dfef5acec9aafda6c3/emoji_map.json"
).text
emoji = json.loads(emoji)
emoji = {x: y for y, x in emoji.items()}


class common(Cog_Extension):
    tag = "common"

    @commands.command(name='ping',
                      aliases=lang['ping.aliases'],
Exemple #4
0
import discord
from discord.ext import commands
from core.classes import Cog_Extension
import os
import requests
import json
from discord_webhook import DiscordWebhook, DiscordEmbed
from language import language as lang
from fuzzywuzzy import process

lang = lang()
lang = lang.langpref()['rivenPrice']

temp = {}
localWeapons = json.loads(
    requests.get("http://api.warframe.market/v1/riven/items",
                 headers=lang['api.header']).text)
localWeapons = localWeapons['payload']['items']
for item in localWeapons:
    temp[item['item_name']] = item['url_name']
localWeapons = temp
temp = {}
Weapons = json.loads(
    requests.get("http://api.warframe.market/v1/riven/items").text)
Weapons = Weapons['payload']['items']
for item in Weapons:
    temp[item['item_name']] = item['url_name']
Weapons = temp
temp = {}
attrDict = json.loads(
    requests.get("http://api.warframe.market/v1/riven/attributes",
Exemple #5
0
from discord.ext import commands
from core.classes import Cog_Extension
import requests
import json
import discord
from discord_webhook import DiscordWebhook, DiscordEmbed
from discord_slash.utils.manage_commands import create_option, create_choice
from discord_slash import SlashContext, cog_ext
from language import language as lang

lang = lang()
lang = lang.langpref()['wfm']

with open('setting.json', 'r', encoding='utf8') as jfile:
    jdata = json.load(jfile)

localDict = requests.get("http://api.warframe.market/v1/items",
                         headers=lang['api.header'])
localDict = json.loads(localDict.text)
temp = {}
localDict = localDict['payload']['items']
for item in localDict:
    temp[item['item_name']] = item['url_name']
localDict = temp
enDict = requests.get("http://api.warframe.market/v1/items")
enDict = json.loads(enDict.text)
temp = {}
enDict = enDict['payload']['items']
for item in enDict:
    temp[item['item_name']] = item['url_name']
enDict = temp
Exemple #6
0
from discord.ext import commands
from core.classes import Cog_Extension
from core.time import time_info
from datetime import datetime, timedelta
import json
import os
import requests
import re
import discord
import asyncio
from language import language as lang

lang = lang()
lang = lang.langpref()['event']

with open('setting.json', 'r', encoding='utf8') as jfile:
    jdata = json.load(jfile)

emojimap = requests.get(
    "http://gist.githubusercontent.com/Vexs/629488c4bb4126ad2a9909309ed6bd71/raw/416403f7080d1b353d8517dfef5acec9aafda6c3/emoji_map.json"
).text
emojimap = json.loads(emojimap)
emojimap = {x: y for y, x in emojimap.items()}


class event(Cog_Extension):
    tag = "common"

    @commands.command(name="reactionRole",
                      aliases=["rr"],
                      brief="指定自動身份組訊息",
Exemple #7
0
import discord
from discord.ext import commands
from core.classes import Cog_Extension
import os
import requests
import json
import asyncio
from discord_slash import SlashContext,cog_ext
# import chinese_converter
from language import language as lang

lang = lang()
lang = lang.langpref()['baro']

rawDict = requests.get(lang['rawDict.URL'])
Dict = json.loads(rawDict.text)
Dict = Dict['messages']

class baro(Cog_Extension):
  tag = "Warframe"
  @commands.command(name='baro',aliases=lang['baro.aliases'],brief=lang['baro.brief'],description=lang['baro.description'])
  async def baro(self,ctx):
    url = requests.get("https://api.warframestat.us/pc/tc/voidTrader",headers={'Accept-Language':'zh','Cache-Control': 'no-cache'})
    html = json.loads(url.text)
    if html['active'] == True:
      message = "```"
      location = html['location']
      # location = chinese_converter.to_traditional(location)
      stay = html['endString']
      stay = stay.replace("d",lang['baro.time.day'])
      stay = stay.replace("h",lang['baro.time.hour'])
Exemple #8
0
import discord
from discord.ext import commands
import os
import json
import keep_alive
from datetime import datetime, timedelta
import requests
import asyncio
import sys
from discord_slash import SlashCommand, client
from discord_slash.utils.manage_commands import create_option, create_choice
from language import language as lang

lang = lang()
lang = lang.langpref()['main']
intents = discord.Intents.all()
#載入設定檔
with open('setting.json', 'r', encoding='utf8') as jfile:
    jdata = json.load(jfile)
bot = commands.Bot(command_prefix=commands.when_mentioned_or(
    jdata['command_prefix']),
                   intents=intents)
slash = SlashCommand(bot,
                     sync_commands=True,
                     override_type=True,
                     sync_on_cog_reload=True)
start_time = datetime.now()
version = "v2.4.3beta"


@bot.event