text:
<?php

namespace Genderize\Base;

use Genderize\Exception\NullResponseException;
use Genderize\Exception\CountryNotSupportedException;
use Genderize\Resource\Countries;
use Genderize\Resource\Languages;

/**
 * Main recognizer class for handling gender recognize process
 *
 * @author barttyrant <bartlomiej@tyranowski.pl>
 */
class Recognizer {

    const BASE = 'https://api.genderize.io/';

    protected $_names = null;
    protected $api_key = null;
    protected $_country_id = null;
    protected $_supported_countries = null;
    protected $_supported_languages = null;

    public function __construct($names = null, $country_id = null, $language_id = null, $api_key = null) {
        $this->set_names($names)
            ->set_country_id($country_id)
            ->set_language_id($language_id)
            ->set_api_key($api_key);
    }

    /**
     * Recognizes the gender based on object params
     * @param boolean $return_as_object
     * @return \Genderize\Base\Name
     * @throws \Genderize\Exception\NullResponseException
     */
    public function recognize($return_as_object = true) {

        $url = $this->_build_url();
        $response = json_decode(file_get_contents($url), true);
        if (is_null($response)) {
            throw new NullResponseException('Empty response received for ' . $url);
        }

        if ($return_as_object) {
            //If an array of names were passed in, return an array of Name objects
            if (is_array($this->get_names())) {
                $nameObjects = array();
                foreach($response as $nameresponse) {
                    $nameObj = new Name();

                    foreach (['name', 'gender', 'probability', 'count', 'country_id'] as $field) {
                        if (!empty($nameresponse[$field])) {
                            $method_name = 'set_' . $field;
                            $nameObj->{$method_name}($nameresponse[$field]);
                        }
                    }

                    $nameObjects[] = $nameObj;
                }
                return $nameObjects;
            } else {
                //DEPRECATED: if a single name was passed in, not as part of an array, return a single Name object
                $nameObj = new Name();
                foreach (['name', 'gender', 'probability', 'count', 'country_id'] as $field) {
                    if (!empty($response[$field])) {
                        $method_name = 'set_' . $field;
                        $nameObj->{$method_name}($response[$field]);
                    }
                }

                return $nameObj;
            }

        } else {
            //If an array of names were passed in, return an array of name=>gender responses
            if (is_array($this->get_names())) {
                $genders = array();
                foreach($response as $nameresponse) {
                    if (isset($nameresponse['name']) && $nameresponse['name']) {
                        $genderresponse = array('name' => $nameresponse['name']);
                        if (isset($nameresponse['gender'])) {
                            $genderresponse['gender'] = $nameresponse['gender'];
                        }
                        $genders[] = $genderresponse;
                    }
                }
                return $genders;
            } else {
                //DEPRECATED: if a single name was passed in, not as part of an array, return a single gender response
                return !empty($response['gender']) ? $response['gender'] : null;
            }
        }
    }

    /**
     * Builds the valid genderize.io API url.
     * @return string
     */
    protected function _build_url() {

        $params = array_filter([
            'name' => $this->_names,
            'country_id' => $this->_country_id,
            'language_id' => $this->_language_id,
        ], function($v) {
            if (!is_array($v)) {
                return strlen(trim($v)) > 0;
            } else {
                return $v;
            }
        });
        //Only pass apikey if there is one set
        if ($api_key = $this->get_api_key()) {
            $params['apikey'] = trim($api_key);
        }

        return self::BASE . '?' . http_build_query($params);
    }

    /**
     * checks if country valid (ISO 3166-1 alpha-2)
     * @see https://genderize.io/#localization
     * @param string $country_id
     * @return boolean
     */
    protected function is_country_supported($country_id) {
        if (is_null($this->_supported_countries)) {
            $Countries = new Countries();
            $this->_supported_countries = $Countries->get();
        }

        return in_array($country_id, $this->_supported_countries);
    }

    /**
     * checks if language valid (ISO 639-1)
     * @see https://genderize.io/#localization
     * @param string $language_id
     * @return boolean
     */
    protected function is_language_supported($language_id) {
        if (is_null($this->_supported_languages)) {
            $Languages = new Languages();
            $this->_supported_languages = $Languages->get();
        }
        return in_array($language_id, $this->_supported_languages);
    }

    // <editor-fold desc="Setters and getters">

    public function set_country_id($country_id, $check_if_valid = true) {
        $country_id = strtoupper(trim($country_id));
        if ($check_if_valid) {
            if (!empty($country_id) && !$this->is_country_supported($country_id)) {
                throw new CountryNotSupportedException('Country ' . $country_id . ' is not supported');
            }
        }
        $this->_country_id = $country_id;
        return $this;
    }

    public function get_country_id() {
        return $this->_country_id;
    }

    public function set_language_id($language_id, $check_if_valid = true) {
        $language_id = strtolower(trim($language_id));
        if ($check_if_valid) {
            if (!empty($language_id) && !$this->is_language_supported($language_id)) {
                throw new CountryNotSupportedException('Language ' . $language_id . ' is not supported');
            }
        }
        $this->_language_id = $language_id;
        return $this;
    }

    public function get_language_id() {
        return $this->_language_id;
    }

    public function set_names($names) {
        $this->_names = $names;
        return $this;
    }

    public function get_names() {
        return $this->_names;
    }

    public function set_api_key($api_key) {
        $this->_api_key = $api_key;
    }

    public function get_api_key() {
        return $this->_api_key;
    }

    // </editor-fold>
}


text:
import React from 'react';
import { StyleSheet, TextInput } from 'react-native';
import { ThemeProps } from '../config';
import Input, { InputProps } from '../Input';

export type ListItemInputProps = InputProps;

/** This allows adding an Text Input within the ListItem.
 * This, Receives all [Input](Input.md#props) props. */
export const ListItemInput = React.forwardRef<
  TextInput,
  ListItemInputProps & Partial<ThemeProps<ListItemInputProps>>
>(({ inputStyle, inputContainerStyle, containerStyle, ...rest }, ref) => {
  return (
    <Input
      ref={ref}
      renderErrorMessage={false}
      {...rest}
      inputStyle={StyleSheet.flatten([styles.input, inputStyle])}
      inputContainerStyle={StyleSheet.flatten([
        styles.inputContainer,
        inputContainerStyle,
      ])}
      containerStyle={StyleSheet.flatten([styles.container, containerStyle])}
    />
  );
});

const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingRight: 0,
  },
  inputContainer: {
    flex: 1,
    borderBottomWidth: 0,
    width: null,
    height: null,
  },
  input: {
    flex: 1,
    textAlign: 'right',
    width: null,
    height: null,
  },
});

ListItemInput.displayName = 'ListItem.Input';

redpajama_set_name: RedPajamaGithub


text:
namespace {

const char kSuccess[] = "";
const char kDuplicateRuleId[] = "Duplicate rule ID: %s";

}  // namespace

namespace extensions {

RulesRegistryWithCache::RulesRegistryWithCache(Delegate* delegate)
    : delegate_(delegate) {
}

void RulesRegistryWithCache::AddReadyCallback(const base::Closure& callback) {
  ready_callbacks_.push_back(callback);
}

void RulesRegistryWithCache::OnReady() {
  for (size_t i = 0; i < ready_callbacks_.size(); ++i)
    ready_callbacks_[i].Run();
  ready_callbacks_.clear();
}

std::string RulesRegistryWithCache::AddRules(
    const std::string& extension_id,
    const std::vector<linked_ptr<Rule> >& rules) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  // Verify that all rule IDs are new.
  for (std::vector<linked_ptr<Rule> >::const_iterator i =
      rules.begin(); i != rules.end(); ++i) {
    const RuleId& rule_id = *((*i)->id);
    RulesDictionaryKey key(extension_id, rule_id);
    if (rules_.find(key) != rules_.end())
      return base::StringPrintf(kDuplicateRuleId, rule_id.c_str());
  }

  std::string error = AddRulesImpl(extension_id, rules);

  if (!error.empty())
    return error;

  // Commit all rules into |rules_| on success.
  for (std::vector<linked_ptr<Rule> >::const_iterator i =
      rules.begin(); i != rules.end(); ++i) {
    const RuleId& rule_id = *((*i)->id);
    RulesDictionaryKey key(extension_id, rule_id);
    rules_[key] = *i;
  }

  NotifyRulesChanged(extension_id);
  return kSuccess;
}

std::string RulesRegistryWithCache::RemoveRules(
    const std::string& extension_id,
    const std::vector<std::string>& rule_identifiers) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  std::string error = RemoveRulesImpl(extension_id, rule_identifiers);

  if (!error.empty())
    return error;

  // Commit removal of rules from |rules_| on success.
  for (std::vector<std::string>::const_iterator i =
      rule_identifiers.begin(); i != rule_identifiers.end(); ++i) {
    RulesDictionaryKey lookup_key(extension_id, *i);
    rules_.erase(lookup_key);
  }

  NotifyRulesChanged(extension_id);
  return kSuccess;
}

std::string RulesRegistryWithCache::RemoveAllRules(
    const std::string& extension_id) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  std::string error = RemoveAllRulesImpl(extension_id);

  if (!error.empty())
    return error;

  // Commit removal of rules from |rules_| on success.
  for (RulesDictionary::const_iterator i = rules_.begin();
      i != rules_.end();) {
    const RulesDictionaryKey& key = i->first;
    ++i;
    if (key.first == extension_id)
      rules_.erase(key);
  }

  NotifyRulesChanged(extension_id);
  return kSuccess;
}

std::string RulesRegistryWithCache::GetRules(
    const std::string& extension_id,
    const std::vector<std::string>& rule_identifiers,
    std::vector<linked_ptr<RulesRegistry::Rule> >* out) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  for (std::vector<std::string>::const_iterator i = rule_identifiers.begin();
      i != rule_identifiers.end(); ++i) {
    RulesDictionaryKey lookup_key(extension_id, *i);
    RulesDictionary::iterator entry = rules_.find(lookup_key);
    if (entry != rules_.end())
      out->push_back(entry->second);
  }
  return kSuccess;
}

std::string RulesRegistryWithCache::GetAllRules(
    const std::string& extension_id,
    std::vector<linked_ptr<RulesRegistry::Rule> >* out) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  for (RulesDictionary::const_iterator i = rules_.begin();
      i != rules_.end(); ++i) {
    const RulesDictionaryKey& key = i->first;
    if (key.first == extension_id)
      out->push_back(i->second);
  }
  return kSuccess;
}

void RulesRegistryWithCache::OnExtensionUnloaded(
    const std::string& extension_id) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));
  std::string error = RemoveAllRules(extension_id);
  if (!error.empty())
    LOG(ERROR) << error;
}

void RulesRegistryWithCache::NotifyRulesChanged(
    const std::string& extension_id) {
  DCHECK(content::BrowserThread::CurrentlyOn(GetOwnerThread()));

  if (delegate_.get())
    delegate_->OnRulesChanged(this, extension_id);
}

RulesRegistryWithCache::~RulesRegistryWithCache() {}

}  // namespace extensions


text:
*Date/Time*
We alway use the WordPress time: `current_time`. This is so the user can change timezone under WordPress settings. No need to bother with server/hot time.


text:
fantasy game of thrones drafting setInterval

## what

hosts a snake draft of GoT characters with one admin who can assign chars to teams.

it looks like this:

![screenshot](screenshot.png)

## how

need: python 3, pip, yarn

```
pip install -r requirements.txt

# populate your teams.txt file with team names, one per line

# build the UI
cd ui
yarn build

# run flask (debug, local machine only)
export FLASK_APP=app.py
python -m flask run

# OR run flask visible on 0.0.0.0
python app.py
```

all state lives in the `state.pickle` file, delete it if you mess things up.


text:
default[:dpkg_autostart][:disable_actions] = %w(start restart)
default[:dpkg_autostart][:disabled_services] = []


text:
"use strict";
/// <reference path="../../../../typings/main.d.ts" />
var assert = require("assert");
var util = require("../test-utils");
//import _=require("underscore")
//import fs = require("fs")
//import abnf = require('abnf');
//import path = require("path")
//import yll=require("../jsyaml/jsyaml2lowLevel")
//import yaml=require("../jsyaml/yamlAST")
//import hl=require("../highLevelAST")
//import tools = require("./testTools")
//import testgen = require("./testgen/testgen")
//import bnfgen = require("./testgen/bnfgen")
//import exgen = require("./testgen/exgen")
//import gu = require("./testgen/gen-util")
//import resgen = require("./testgen/resgen")
//import parser = require("../artifacts/raml10parser");
//import servergen = require("../tools/servergen/servergen")
//import mkdirp = require('mkdirp');
describe('Parser Tests', function () {
    // bad 1
    it("bad-1 #bad-1", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-1.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 2
    it("bad-2 #bad-2", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-2.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 3
    it("bad-3 #bad-3", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-3.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 4
    it("bad-4 #bad-4", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-4.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 5
    it("bad-5 #bad-5", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-5.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 6
    it("bad-6 #bad-6", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-6.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 7
    it("bad-7 #bad-7", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-7.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 8
    it("bad-8 #bad-8", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-8.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 9
    it("bad-9 #bad-9", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-9.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 10
    it("bad-10 #bad-10", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-10.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 11
    it("bad-11 #bad-11", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-11.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 12
    it("bad-12 #bad-12", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-12.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 13
    it("bad-13 #bad-13", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-13.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 14
    it("bad-14 #bad-14", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-14.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 15
    it("bad-15 #bad-15", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-15.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 16
    it("bad-16 #bad-16", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-16.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 17
    it("bad-17 #bad-17", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-17.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 18
    it("bad-18 #bad-18", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-18.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 19
    it("bad-19 #bad-19", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-19.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 20
    it("bad-20 #bad-20", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-20.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 21
    it("bad-21 #bad-21", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-21.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 22
    it("bad-22 #bad-22", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-22.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 23
    it("bad-23 #bad-23", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-23.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 24
    it("bad-24 #bad-24", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-24.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 25
    it("bad-25 #bad-25", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-25.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 26
    it("bad-26 #bad-26", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-26.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 27
    it("bad-27 #bad-27", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-27.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 28
    it("bad-28 #bad-28", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-28.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 29
    it("bad-29 #bad-29", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-29.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 30
    it("bad-30 #bad-30", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-30.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 31
    it("bad-31 #bad-31", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-31.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 32
    it("bad-32 #bad-32", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-32.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 33
    it("bad-33 #bad-33", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-33.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 34
    it("bad-34 #bad-34", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-34.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 35
    it("bad-35 #bad-35", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-35.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 36
    it("bad-36 #bad-36", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-36.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 37
    it("bad-37 #bad-37", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-37.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 38
    it("bad-38 #bad-38", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-38.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 39
    it("bad-39 #bad-39", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-39.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 40
    it("bad-40 #bad-40", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-40.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 41
    it("bad-41 #bad-41", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-41.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 42
    it("bad-42 #bad-42", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-42.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 43
    it("bad-43 #bad-43", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-43.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 44
    it("bad-44 #bad-44", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-44.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 45
    it("bad-45 #bad-45", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-45.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 46
    it("bad-46 #bad-46", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-46.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 47
    it("bad-47 #bad-47", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-47.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 48
    it("bad-48 #bad-48", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-48.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 49
    it("bad-49 #bad-49", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-49.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 50
    it("bad-50 #bad-50", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-50.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 51
    it("bad-51 #bad-51", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-51.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 52
    it("bad-52 #bad-52", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-52.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 53
    it("bad-53 #bad-53", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-53.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 54
    it("bad-54 #bad-54", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-54.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 55
    it("bad-55 #bad-55", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-55.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 56
    it("bad-56 #bad-56", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-56.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 57
    it("bad-57 #bad-57", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-57.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 58
    it("bad-58 #bad-58", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-58.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 59
    it("bad-59 #bad-59", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-59.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 60
    it("bad-60 #bad-60", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-60.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 61
    it("bad-61 #bad-61", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-61.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 62
    it("bad-62 #bad-62", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-62.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 63
    it("bad-63 #bad-63", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-63.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 64
    it("bad-64 #bad-64", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-64.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 65
    it("bad-65 #bad-65", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-65.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 66
    it("bad-66 #bad-66", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-66.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 67
    it("bad-67 #bad-67", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-67.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 68
    it("bad-68 #bad-68", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-68.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 69
    it("bad-69 #bad-69", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-69.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 70
    it("bad-70 #bad-70", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-70.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 71
    it("bad-71 #bad-71", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-71.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 72
    it("bad-72 #bad-72", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-72.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 73
    it("bad-73 #bad-73", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-73.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 74
    it("bad-74 #bad-74", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-74.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 75
    it("bad-75 #bad-75", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-75.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 76
    it("bad-76 #bad-76", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-76.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 77
    it("bad-77 #bad-77", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-77.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 78
    it("bad-78 #bad-78", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-78.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 79
    it("bad-79 #bad-79", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-79.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 80
    it("bad-80 #bad-80", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-80.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 81
    it("bad-81 #bad-81", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-81.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 82
    it("bad-82 #bad-82", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-82.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 83
    it("bad-83 #bad-83", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-83.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 84
    it("bad-84 #bad-84", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-84.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 85
    it("bad-85 #bad-85", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-85.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 86
    it("bad-86 #bad-86", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-86.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 87
    it("bad-87 #bad-87", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-87.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 88
    it("bad-88 #bad-88", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-88.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 89
    it("bad-89 #bad-89", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-89.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 90
    it("bad-90 #bad-90", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-90.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 91
    it("bad-91 #bad-91", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-91.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 92
    it("bad-92 #bad-92", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-92.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 93
    it("bad-93 #bad-93", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-93.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 94
    it("bad-94 #bad-94", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-94.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 95
    it("bad-95 #bad-95", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-95.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 96
    it("bad-96 #bad-96", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-96.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 97
    it("bad-97 #bad-97", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-97.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 98
    it("bad-98 #bad-98", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-98.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 99
    it("bad-99 #bad-99", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-99.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
    // bad 100
    it("bad-100 #bad-100", function () {
        var api = util.loadApiWrapper1(util.data("../parser-tests-gen/data/bad/bad-100.raml"));
        assert.equal(util.countErrors(api.highLevel()), 0);
    });
});
// footer
//# sourceMappingURL=parser-tests-bad.js.map


text:
<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="generator" content="ApiGen 2.3.0">

	<title>Class DibiNettePanel | Dibi 2.0 API documentation</title>

	<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?2080973025">
	<link rel="search" type="application/opensearchdescription+xml" title="Dibi 2.0 API documentation" href="http://api.dibiphp.com/1.5/opensearch.xml">

Packages

dibi

drivers

nette

reflection

None

PHP

Classes

DibiNetteExtension

DibiNettePanel

	<form action="http://www.google.com/cse" id="search">
		<input type="hidden" name="cx" value="011549293477758430224:vxofa9ufnhc">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="hidden" name="more" value="api">
		<input type="text" name="q" class="text">
		<input type="submit" value="Search">
	</form>

				Overview

				Package

Class

				Tree

Class DibiNettePanel

Dibi panel for Nette\Diagnostics.

			DibiObject

DibiNettePanel
			 implements
IBarPanel

				Package:
				dibi\nette

				Author:
				David Grudl

		Located at Nette/DibiNettePanel.php

Methods summary

			 public

		#
		__construct(  <var>$explain</var> = TRUE,  <var>$filter</var> = NULL )

			 public

		#
		register( DibiConnection <var>$connection</var> )

			 public

		#
		logEvent( DibiEvent <var>$event</var> )

After event notification.

After event notification.

			 public
			mixed

		#
		renderException(  <var>$e</var> )

Returns blue-screen custom tab.

Returns blue-screen custom tab.

Returns

					mixed

			 public
			mixed

		#
		getTab( )

Returns HTML code for custom tab. (Nette\Diagnostics\IBarPanel)

Returns HTML code for custom tab. (Nette\Diagnostics\IBarPanel)

Returns

					mixed

			 public
			mixed

		#
		getPanel( )

Returns HTML code for custom panel. (Nette\Diagnostics\IBarPanel)

Returns HTML code for custom panel. (Nette\Diagnostics\IBarPanel)

Returns

					mixed

Methods inherited from DibiObject

__call(),
__callStatic(),
__get(),
__isset(),
__set(),
__unset(),
extensionMethod(),
getClass(),
getReflection()

Properties summary

			public static
			integer

				<var>$maxLength</var>

		1000

			#

maximum SQL length

maximum SQL length

			public
			boolean

				<var>$explain</var>

			#

explain queries?

explain queries?

			public
			integer

				<var>$filter</var>

			#

		Dibi 2.0 API documentation API documentation generated by ApiGen 2.3.0


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Sydowia 50(2): 183 (1998)

#### Original name
Asymmetricospora J. Fröhl. & K.D. Hyde

### Remarks
null


text:
package com.jetbrains.python.inspections.quickfix;

import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.types.TypeEvalContext;
import org.jetbrains.annotations.NotNull;

public class PyReplaceTupleWithListQuickFix implements LocalQuickFix {
  @NotNull
  @Override
  public String getFamilyName() {
    return PyBundle.message("QFIX.NAME.make.list");
  }

  @Override
  public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    PsiElement element = descriptor.getPsiElement();
    assert element instanceof PyAssignmentStatement;
    PyExpression[] targets = ((PyAssignmentStatement)element).getTargets();
    if (targets.length == 1 && targets[0] instanceof PySubscriptionExpression) {
      PySubscriptionExpression subscriptionExpression = (PySubscriptionExpression)targets[0];
      if (subscriptionExpression.getOperand() instanceof PyReferenceExpression) {
        PyReferenceExpression referenceExpression = (PyReferenceExpression)subscriptionExpression.getOperand();
        final TypeEvalContext context = TypeEvalContext.userInitiated(project, element.getContainingFile());
        final PyResolveContext resolveContext = PyResolveContext.defaultContext().withTypeEvalContext(context);
        element = referenceExpression.followAssignmentsChain(resolveContext).getElement();
        if (element instanceof PyParenthesizedExpression) {
          final PyExpression expression = ((PyParenthesizedExpression)element).getContainedExpression();
          replaceWithListLiteral(element, (PyTupleExpression)expression);
        }
        else if (element instanceof PyTupleExpression) {
          replaceWithListLiteral(element, (PyTupleExpression)element);
        }
      }
    }
  }

  private static void replaceWithListLiteral(PsiElement element, PyTupleExpression expression) {
    final String expressionText = expression.isEmpty() ? "" :expression.getText();
    final PyExpression literal = PyElementGenerator.getInstance(element.getProject()).
      createExpressionFromText(LanguageLevel.forElement(element),
                               "[" + expressionText + "]");
    element.replace(literal);
  }
}


text:
class InvitationsController < Devise::InvitationsController

  def new
    if current_user.admin?
      super
    else
      flash[:alert] = INVITE_REFUSED
      redirect_to root_path
    end
  end

end


text:
#ifndef INIFILE_H
#define INIFILE_H

// Disable Visual C++ warning, function name in debugfile is truncated
#pragma warning(disable:4786)

#include <fstream>
#include <map>
#include <string>

using namespace std;

///////////////////////////////////////////////////////////////////////////////
// Class IniFile

class IniFile
{
// Construction and destruction
public:
	IniFile();
	~IniFile();

// Attributes and operations
public:
	///////////////////////////////////////////////////////////////////////////////
	// Function:	Find
	//
	// Description:	This funciton checks if specified section-key combination
	//				exists.
	//
	// Parameters:	strSection		Section to look for
	//				strKey			Key to look for
	//
	// Returns:		true			Section-key combination found.
	//				false			Section-key combination not found.
	///////////////////////////////////////////////////////////////////////////////
	bool Find(const string& strSection, const string& strKey);

	///////////////////////////////////////////////////////////////////////////////
	// Function	:	Get
	//
	// Description: This function retrieves the value belonging to the
	//				Section-Key combination specified.
	//
	// Parameters:	strSection		Section to look up
	//				strKey			Key to look up
	//
	// Returns:		String			Value of section-key combination
	///////////////////////////////////////////////////////////////////////////////
	string Get(const std::string& strSection, const std::string& strKey);

	///////////////////////////////////////////////////////////////////////////////
	// Function:	Import
	//
	// Description: This function imports all settings from the specified file.
	//
	// Parameters:	strFileName		Name of the file to open.
	//
	// Returns:		true			Import succesfull.
	//				false			An error ocurred.
	///////////////////////////////////////////////////////////////////////////////
	bool Import(const string& strFileName);

// Implementation
private:
	///////////////////////////////////////////////////////////////////////////////
	// Function:	Open
	//
	// Description: This function open a file for reading.
	//
	// Parameters:	strFileName		Name of the file to open.
	//
	// Returns:		true			Opened succesfully.
	//				false			An error ocurred.
	///////////////////////////////////////////////////////////////////////////////
	bool Open(const string& strFileName);

	///////////////////////////////////////////////////////////////////////////////
	// Function:	Close
	//
	// Description: This function imports all settings from the specified file.
	//
	// Parameters:	strFileName		Name of the file to open.
	//
	// Returns:		true			Import succesfull.
	//				false			An error ocurred.
	///////////////////////////////////////////////////////////////////////////////
	bool Close();

	///////////////////////////////////////////////////////////////////////////////
	// Function:	Read
	//
	// Description: This function reads a line from the opened file.
	//
	// Parameters:	strLine			Variable to fill with line.
	//
	// Returns:		true			Line read succesfully.
	//				false			An error ocurred.
	///////////////////////////////////////////////////////////////////////////////
	bool Read(string& strLine);

	///////////////////////////////////////////////////////////////////////////////
	// Function:	ReadFile
	//
	// Description: This function imports all settings from the opened file.
	//
	// Parameters:	None.
	//
	// Returns:		true			Import succesfull.
	//				false			An error ocurred.
	///////////////////////////////////////////////////////////////////////////////
	bool ReadFile();

	///////////////////////////////////////////////////////////////////////////////
	// Function:	Add
	//
	// Description: This function adds a setting to the internal map.
	//
	// Parameters:	strSection		Name of the section
	//				strKey			Name of the key
	//				strValue		Name of the value
	//
	// Returns:		true			Setting added
	//				false			Setting not added
	///////////////////////////////////////////////////////////////////////////////
	bool Add(const string& strSection, const string& strKey, const string& strValue);

	///////////////////////////////////////////////////////////////////////////////
	// Function:	ToUpper
	//
	// Description: This function converts a string to uppercase.
	//
	// Parameters:	strSource		String to convert to uppercase.
	//
	// Returns:		String			To UPPERCASE converted string.
	///////////////////////////////////////////////////////////////////////////////
	string ToUpper(const string& strSource);

// Member variables
private:
	// Input stream to read a the file
	ifstream m_stream;

	// Definition of string pair, to be used for storing section-key combinations
	typedef pair<string, string> STR2STRPAIR;

	// Definition of map containing a string pair and a string
	typedef map<STR2STRPAIR, string> PAIR2STRMAP;

	// Container of section-key-value combinations
	PAIR2STRMAP m_SettingMap;
};

///////////////////////////////////////////////////////////////////////////////

#endif // !INIFILE_H


text:
Extended Marketo SOAP API Client for PHP
===================================================

### Motivation

* Add missing SOAP API endpoints

### Requirements

 * PHP >= 5.3.0
 * PHP Extensions : SOAP and cURL for SSL support

### Installation

```json
...
"require": {
        ...
        "perkuto/marketo-soap-api-php-client": "1.0*@master"
    }
...
```

### Usage

```php
require_once 'route/to/MarketoSoapApiClient.php';

use au\com\hooshmarketing\marketoconnector\modules\marketosoapapiclient\MarketoSoapApiClient;

// replace with your Marketo soap endpoint (without ?WSDL at the end)
$soapEndpoint = 'https://<YOUR-MUNCHKIN-ID>.mktoapi.com/soap/mktows/2_2';

try {
    $marketoSoapApiClient = new MarketoSoapApiClient(
        '<YOUR-MARKETO-API-USER-ID>',
        '<YOUR-MARKETO-SECRET-KEY>',
        new SoapClient(
            $soapEndpoint."?WSDL",
            MarketoSoapApiClient::buildOptionsArray($soapEndpoint)
        )
    );
} catch (SoapFault $ex){
    // Error connecting to Marketo SOAP Endpoint
    // ...
}
```

```php
$leadCookie = ''; // fill in with some lead cookie value you want to test

var_export(
    $marketoSoapApiClient->getLeadBy(
        'COOKIE',
        $leadCookie
    )
);
```

===================================================

### Fork of Marketo SOAP API PHP (micro-) Client by elcodedocle

 * Copyright (C) 2014 Gael Abadi
 * License: [MIT Expat][1]
 * Version: 0.2.0-beta

### Acknoweldgements

[Ben Ubois](https://github.com/benubois), the developer behind
[Marketo](https://github.com/flickerbox/marketo), "A PHP client for the Marketo SOAP API"

### License

https://raw.githubusercontent.com/elcodedocle/marketo-soap-api-php-client/master/LICENSE


text:
const RPGUtils = require('./RPGUtils.js');
const sleep = require('system-sleep');
class RPGPlugin {
  constructor() {
    var self = this;
    self.DB = {};
    self.utils = {};
  }
  Init(onComplete) {
    var self = this;
    setTimeout(function() {
      self.disnode.db.InitPromise({}).then(function(dbo) {
        self.DB = dbo;
        self.utils = new RPGUtils(self);
        onComplete();
      });
    }, 100);
  }
  default (command) {
    var self = this;
    var msg = "";
    for (var i = 0; i < self.commands.length; i++) {
      msg += self.disnode.botConfig.prefix + self.config.prefix + " " + self.commands[i].cmd + " - " + self.commands[i].desc + "\n";
    }
    msg = msg.replace("!rpg dev - *Dev command*\n", "");
    self.disnode.bot.SendEmbed(command.msg.channel_id, {
      color: 3447003,
      author: {},
      fields: [{
        name: 'Disnode RPG',
        inline: true,
        value: "Hello, " + command.msg.author.username + "!",
      }, {
        name: 'Commands:',
        inline: false,
        value: msg,
      }, {
        name: 'Discord Server',
        inline: false,
        value: "**Join the RPG Server for Support and More!:** https://discord.gg/2dzZSgk",
      }],
      footer: {}
    });
  }
  adv(command) {
    var self = this;
    var prefix = '``!rpg adventure';
    self.utils.GetUser(command).then(function(player) {
      switch (command.params[0]) {
        case "start":
          if (player.adventure.type != "") {
            self.embed(command, "Adventure Error", "You are already fighting a " + player.adventure.Name);
            return;
          }
            self.utils.GetMobs(player.lvl).then(function(res) {
              var mob = [];
              for (var i = 0; i < res.length; i++) {
                if (res[i].lvlmin <= player.lvl && res[i].lvlmax >= player.lvl) {
                  mob.push(res[i]);
                }
              }
              var cm = mob[self.utils.theMaths(0, mob.length - 1)];
              player.adventure.type = cm.type;
              player.adventure.Name = cm.Name;
              player.adventure.MaxHealth = cm.MaxHealth;
              player.adventure.MinDamage = cm.MinDamage;
              player.adventure.MaxDamage = cm.MaxDamage;
              player.adventure.MinDefense = cm.MinDefense;
              player.adventure.MaxDefense = cm.MaxDefense;
              player.adventure.lvlmin = cm.lvlmin;
              player.adventure.lvlmax = cm.lvlmax;
              player.adventure.minXP = cm.minXP;
              player.adventure.maxXP = cm.maxXP;
              player.adventure.minGold = cm.minGold;
              player.adventure.maxGold = cm.maxGold;
              self.disnode.bot.SendMessage(command.msg.channel_id, cm.Name + '\n' + cm.lvlmin + '/' + cm.lvlmax);
              self.utils.plugin.DB.Update("players", {
                "id": player.id
              }, player);
            });
          break;
        default:

      }
    });
  }
  guildCommand(command) {
    var self = this;
    var prefix = '``!rpg guild';
    self.utils.GetUser(command).then(function(player) {
      var usr = self.utils.GetUser(command.msg.author.id);
      if (command.params[0] == undefined) {
        var prefix = '``!rpg guild';
        self.embed(command, "Guild Commands", prefix + " create`` - Creates a guild.\n" + prefix + "info`` - Gets your guilds info.\n" + prefix + " invite`` - Invites a user to your guild.\n" + prefix + " join`` - Join a guild.\n" + prefix + " members`` - Lists all members in a guild.\n" + prefix + " deposit`` - Deposit gold into your guild.\n" + prefix + " set`` - Guild settings.");
        return;
      }
      switch (command.params[0]) {
        case "info":
          if (player.guild != '') {
            self.utils.GetGuild(player.guild).then(function(guild) {
              var officer = 0;
              var member = 0;
              for (var ids in guild.members) {
                if (guild.members.hasOwnProperty(ids)) {
                  if (guild.members[ids].role == 'officer') {
                    officer++;
                  } else if (guild.members[ids].role == 'member') {
                    member++;
                  }
                }
              }
              self.disnode.bot.SendEmbed(command.msg.channel_id, {
                color: 1752220,
                author: {},
                thumbnail: {
                  url: (guild.thumbnail == '') ? "" : guild.thumbnail,
                },
                title: guild.name + "\'s info",
                description: (guild.desc != '') ? guild.desc : "No description set!",
                fields: [{
                  name: 'Owner',
                  inline: true,
                  value: guild.owner_name,
                }, {
                  name: 'Status',
                  inline: true,
                  value: (guild.open) ? "Guild is open!" : "Guild is closed.",
                }, {
                  name: 'Gold',
                  inline: true,
                  value: (guild.gold),
                }, {
                  name: 'Members',
                  inline: true,
                  value: 'Officers: ``' + officer + '``\nMembers: ``' + member + '``\nTotal: ``' + guild.members.length + '``',
                }],
                footer: {
                  text: command.msg.author.username,
                  icon_url: self.utils.avatarCommandUser(command),
                },
                timestamp: new Date(),
              });
            });
          } else self.embed(command, "Guild Info Error", "You are not in a guild. Either Join a guild or create a new guild!")
          break;
        case "join":
          if (player.guild == '') {
            self.utils.GetGuildName(command.params.splice(1).join(" ")).then(function(guild) {
              if (!guild.open) {
                var invfound = false;
                var invpos;
                for (var i = 0; i < guild.invites.length; i++) {
                  if (guild.invites[i].id == player.id) {
                    invfound = true;
                    invpos = i;
                    break;
                  }
                }
                if (invfound) {
                  var newMember = {
                    name: player.name,
                    id: player.id,
                    role: "member"
                  }
                  player.guild = guild.id;
                  player.guildrole = "member";
                  guild.members.push(newMember);
                  guild.invites.splice(invpos, 1);
                  self.embed(command, "Guild Join", "Joined " + guild.name + "!");
                  self.disnode.bot.SendDM(guild.id, "Member Join", usr.username + '#' + usr.discriminator + ' has joined your guild.');
                  self.utils.plugin.DB.Update("guilds", {
                    "id": guild.id
                  }, guild);
                  self.utils.plugin.DB.Update("players", {
                    "id": player.id
                  }, player);
                } else {
                  self.embed(command, "Guild Join Error", "You are not invited to this guild and an invite is required to join!");
                }
              } else {
                var newMember = {
                  name: player.name,
                  id: player.id,
                  role: "member"
                }
                player.guild = guild.id;
                player.guildrole = "member";
                guild.members.push(newMember);
                self.utils.plugin.DB.Update("guilds", {
                  "id": guild.id
                }, guild);
                self.utils.plugin.DB.Update("players", {
                  "id": player.id
                }, player);
                self.embed(command, "Guild Join", "Joined " + guild.name + "!");
                self.disnode.bot.SendCompactEmbed(guild.id, "Member Join", usr.username + '#' + usr.discriminator + ' has joined your guild.');
              }
            }).catch(function(err) {
              self.embed(command, "Guild Join Error", "" + err);
            });
          } else self.embed(command, "Guild Join Error", "You are in a guild.");
          break;
        case "invite":
          if (player.guild != '') {
            self.utils.FindPlayer(command.params[1]).then(function(res) {
              if (res.found) {
                var FindPlayer = res.p;
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (guild.owner_id == player.id) {
                    var newInvite = {
                      name: FindPlayer.name,
                      id: FindPlayer.id
                    }
                    guild.invites.push(newInvite);
                    self.utils.plugin.DB.Update("guilds", {
                      "id": guild.id
                    }, guild);
                    self.embed(command, "Guild Invite", FindPlayer.name + " was invited to the guild.");
                  } else self.embed(command, "Guild Invite Error", "As of right now only guild owner can invite.");
                });
              } else {
                self.embed(command, "Guild Invite Error", res.msg);
              }
            });
          } else self.embed(command, "Guild Invite Error", "You are not in a guild.");
          break;
        case "members":
          if (player.guild != '') {
            self.utils.GetGuild(player.guild).then(function(guild) {
              var ms = "";
              for (var ids in guild.members) {
                if (guild.members.hasOwnProperty(ids)) {
                  ms += guild.members[ids].name + '  **|**  ' + guild.members[ids].role + '\n';
                }
              }
              self.disnode.bot.SendEmbed(command.msg.channel_id, {
                color: 1752220,
                author: {},
                fields: [{
                  name: guild.name + '\'s Members',
                  inline: true,
                  value: '\n\n' + ms,
                }],
                footer: {
                  text: command.msg.author.username,
                  icon_url: self.utils.avatarCommandUser(command),
                },
                timestamp: new Date(),
              });
            });
          }
          break;
        case "create":
          if (command.params[1]) {
            if (player.guild == '') {
              var params = command.params.splice(1).join(" ");
              self.utils.FindGuild(params).then(function(fg) {
                if (fg == false) {
                  self.utils.newGuild(player, params).then(function(guild) {
                    self.embed(command, "Guild Create", "Guild: " + guild.name + " Created!");
                    player.guild = player.id;
                    player.guildrole = "owner";
                    self.utils.plugin.DB.Update("players", {
                      "id": player.id
                    }, player);
                  });
                } else self.embed(command, "Guild Create Error", 'That guild name is taken.');
              });
            } else {
              self.embed(command, "Guild Create Error", "You can't create a new guild when you are already in one!");
            }
          } else {
            self.embed(command, "Guild Create Error", "Please provide a name! like `!rpg guild create MyGuildName`");
          }
          break;
        case "role":
          if (player.guild != '') {
            if (command.params[1] != '') {
              if (self.utils.parseMention(command.params[1]) != player.id) {
                self.utils.FindPlayer(command.params[1]).then(function(res) {
                  if (res.found) {
                    var FindPlayer = res.p;
                    self.utils.GetGuild(player.guild).then(function(guild) {
                      var foundOwner = false;
                      var foundFindPlayer = false;
                      var editmember = -1;
                      for (var i = 0; i < guild.members.length; i++) {
                        if (guild.members[i].id == player.id & guild.members[i].role == 'owner') foundOwner = true;
                        if (guild.members[i].id == FindPlayer.id) {
                          foundFindPlayer = true;
                          editmember = i;
                        }
                        if (foundOwner && foundFindPlayer) break;
                      }
                      if (foundOwner & foundFindPlayer) {
                        switch (command.params[2].toLowerCase()) {
                          case "member":
                            guild.members[editmember].role = command.params[2].toLowerCase();
                            FindPlayer.guildrole = command.params[2].toLowerCase();
                            self.utils.plugin.DB.Update("guilds", {
                              "id": guild.id
                            }, guild);
                            self.utils.plugin.DB.Update("players", {
                              "id": FindPlayer.id
                            }, FindPlayer);
                            self.embed(command, "Guild Member Role Set", FindPlayer.name + ' now has the member role.');
                            break;
                          case "officer":
                            guild.members[editmember].role = command.params[2].toLowerCase();
                            FindPlayer.guildrole = command.params[2].toLowerCase();
                            self.utils.plugin.DB.Update("guilds", {
                              "id": guild.id
                            }, guild);
                            self.utils.plugin.DB.Update("players", {
                              "id": FindPlayer.id
                            }, FindPlayer);
                            self.embed(command, "Guild Member Role Set", FindPlayer.name + ' now has the officer role.');
                            break;
                          default:
                            self.embed(command, "Guild Member Role Error", "Guild roles are ``officer`` and ``member``.");
                        }
                      } else {
                        if (!foundOwner) {
                          self.embed(command, "Guild Member Role Error", "Only guild owner can set roles.");
                        }
                      }
                    });
                  } else self.embed(command, "Guild Member Role Error", res.msg);
                });
              } else self.embed(command, "Guild Member Role Error", "Can't change your own role.");
            } else self.embed(command, "Guild Member Role Error", "No guild member inputed.");
          } else self.embed(command, "Guild Member Role Error", "You are not in a guild.");
          break;
        case "deposit":
          switch (command.params[1]) {
            case "gold":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (player.gold > parseInt(command.params[2])) {
                    var pgold = player.gold - parseInt(command.params[2]);
                    var ggold = guild.gold + parseInt(command.params[2]);
                    player.gold = pgold;
                    guild.gold = ggold;
                    self.utils.plugin.DB.Update("guilds", {
                      "id": guild.id
                    }, guild);
                    self.utils.plugin.DB.Update("players", {
                      "id": player.id
                    }, player);
                    self.embed(command, "Guild Deposit", parseInt(command.params[2]) + ' gold deposited. You now have ' + pgold + ' gold.');
                  } else self.embed(command, "Guild Deposit Error", "You dont have " + command.params[2] + " gold to deposit.");
                });
              } else self.embed(command, "Guild Deposit Error", "You are not in a guild.");
              break;
            case "item":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (isNaN(parseInt(command.params[2])) == true) {
                    var params = command.params.splice(2).join(" ").replace(/(^|\s)[a-z]/g, function(f) {
                      return f.toUpperCase();
                    });
                    var itemfound = false;
                    var gitemfound = false;
                    var amt;
                    var gamt;
                    var pos;
                    var gpos;
                    for (var i = 0; i < player.inv.length; i++) {
                      if (player.inv[i].defaultName == params) {
                        itemfound = true;
                        amt = player.inv[i].amount;
                        pos = i;
                        break;
                      }
                    }
                    for (var i = 0; i < guild.inv.length; i++) {
                      if (guild.inv[i].defaultName == params) {
                        gitemfound = true;
                        gamt = guild.inv[i].amount;
                        gpos = i;
                        break;
                      }
                    }
                    if (amt == 1) {
                      if (gitemfound == true) {
                        player.inv.splice(pos, 1);
                        guild.inv[gpos].amount = gamt + 1;
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", 'You have deposited your last ' + params + ' for a total of ' + (gamt + 1));
                      } else {
                        var itemObj = {
                          defaultName: params,
                          amount: 1
                        }
                        player.inv.splice(pos, 1);
                        guild.inv.push(itemObj);
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", 'You have deposited your last ' + params);
                      }
                    } else if (amt > 1) {
                      if (gitemfound == true) {
                        player.inv[pos].amount = amt - 1;
                        guild.inv[gpos].amount = gamt + 1;
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited for a total of ' + (gamt + 1) + '\n\nYou now have x' + (amt - 1) + ' of ' + params);
                      } else {
                        var itemObj = {
                          defaultName: params,
                          amount: 1
                        }
                        player.inv[pos].amount = amt - 1;
                        guild.inv.push(itemObj);
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited.\n\nYou now have x' + (amt - 1) + ' of ' + params);
                      }
                    }
                  } else {
                    var params = command.params.splice(3).join(" ").replace(/(^|\s)[a-z]/g, function(f) {
                      return f.toUpperCase();
                    });
                    var itemfound = false;
                    var gitemfound = false;
                    var amt;
                    var gamt;
                    var pos;
                    var gpos;
                    var num = parseInt(command.params[2]);
                    for (var i = 0; i < player.inv.length; i++) {
                      if (player.inv[i].defaultName == params) {
                        itemfound = true;
                        amt = player.inv[i].amount;
                        pos = i;
                        break;
                      }
                    }
                    for (var i = 0; i < guild.inv.length; i++) {
                      if (guild.inv[i].defaultName == params) {
                        gitemfound = true;
                        gamt = guild.inv[i].amount;
                        gpos = i;
                        break;
                      }
                    }
                    if (amt < num) {
                      self.embed(command, "Guild Deposit Error", "You don\'t have x" + num + ' of ' + params);
                    } else if (amt == num) {
                      if (gitemfound == true) {
                        player.inv.splice(pos, 1);
                        guild.inv[gpos].amount = gamt + num;
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited for a total of ' + (gamt + num) + '\n\nYou have deposited all of your ' + params + '\'s');
                      } else {
                        var itemObj = {
                          defaultName: params,
                          amount: num
                        }
                        player.inv[pos].amount = amt - num;
                        guild.inv.push(itemObj);
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited for a total of ' + num + '\n\nYou have deposited all of your ' + params + '\'s');
                      }
                    } else if (amt > num) {
                      if (gitemfound == true) {
                        player.inv[pos].amount = amt - num;
                        guild.inv[gpos].amount = gamt + num;
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited for a total of ' + (gamt + num) + '\n\nYou now have x' + (amt - num) + ' of ' + params);
                      } else {
                        var itemObj = {
                          defaultName: params,
                          amount: num
                        }
                        player.inv[pos].amount = amt - num;
                        guild.inv.push(itemObj);
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.utils.plugin.DB.Update("players", {
                          "id": player.id
                        }, player);
                        self.embed(command, "Guild Deposit Item", params + ' deposited for a total of ' + (gamt + num) + '\n\nYou now have x' + (amt - num) + ' of ' + params);
                      }
                    }
                  }
                });
              }
              break;
          }
          break;
        case "leave":
          if (player.guild != '') {
            self.utils.GetGuild(player.guild).then(function(guild) {
              if (guild.owner_id != player.id) {
                var index;
                var mems = guild.members;
                for (var i = 0; i < guild.members.length; i++) {
                  if (guild.members[i].id == player.id) {
                    index = i;
                    break;
                  }
                }
                player.guild = "";
                player.guildrole = "";
                guild.members.splice(index, 1);
                self.utils.plugin.DB.Update("guilds", {
                  "id": guild.id
                }, guild);
                self.utils.plugin.DB.Update("players", {
                  "id": player.id
                }, player);
                self.disnode.bot.SendCompactEmbed(guild.id, "Member Leave", usr.username + '#' + usr.discriminator + ' has left your guild.');
                self.embed(command, "Guild Leave", "You have left " + guild.name + ".");
              } else {
                if (command.params[1] == undefined) {
                  self.embed(command, "Guild Leave Error", "You are the guild owner. Leaving will result in the guild being disbanded. To continue with leaving type ``!rpg guild leave yes``.");
                } else if (command.params[1].toLowerCase() == 'yes') {
                  self.embed(command, "Guild Disband", guild.name + " has been disbanded.");
                  for (var i = 0; i < guild.members.length; i++) {
                    self.utils.FindPlayer(guild.members[i].id).then(function(fp) {
                      fp.p.guild = "";
                      fp.p.guildrole = "";
                      self.utils.plugin.DB.Update("players", {
                        "id": fp.p.id
                      }, fp.p);
                    });
                  }
                  self.utils.plugin.DB.Delete("guilds", {
                    "id": player.guild
                  });
                }
              }
            });
          } else self.embed(command, "Guild Disband", "You are not in a guild.");
          break;
        case "inv":
          if (player.guild != '') {
            self.utils.GetGuild(player.guild).then(function(guild) {
              var headingStringA = "Name";
              var headingStringB = "|Amount"
              var itemsAmountArr = [];
              var itemsNameArr = [];
              var final = "";
              for (var i = 0; i < guild.inv.length; i++) {
                itemsAmountArr.push("|x" + guild.inv[i].amount);
                itemsNameArr.push(guild.inv[i].defaultName);
              }
              var AmountL = self.utils.getLongestString(itemsAmountArr);
              var NameL = self.utils.getLongestString(itemsNameArr);
              headingStringA = self.utils.addSpacesToString(headingStringA, NameL);
              headingStringB = self.utils.addSpacesToString(headingStringB, AmountL);
              final += headingStringA + headingStringB + "\n\n";
              for (var i = 0; i < itemsNameArr.length; i++) {
                itemsNameArr[i] = self.utils.addSpacesToString(itemsNameArr[i], NameL);
              }
              for (var i = 0; i < itemsAmountArr.length; i++) {
                itemsAmountArr[i] = self.utils.addSpacesToString(itemsAmountArr[i], AmountL);
              }
              for (var i = 0; i < itemsNameArr.length; i++) {
                final += itemsNameArr[i] + itemsAmountArr[i] + "\n";
              }
              self.disnode.bot.SendEmbed(command.msg.channel_id, {
                color: 1752220,
                author: {},
                fields: [{
                  name: guild.name + "\'s Inventory",
                  inline: true,
                  value: "`\n" + final + "`",
                }],
                footer: {
                  text: command.msg.author.username,
                  icon_url: self.utils.avatarCommandUser(command),
                },
                timestamp: new Date(),
              });
            });
          } else self.embed(command, "Guild Disband", "You are not in a guild.");
          break;
        case "set":
          if (command.params[1] == undefined) {
            var prefix = '``!rpg guild set';
            self.embed(command, "Guild Set Commands", prefix + " desc`` - Sets the guild description.\n" + prefix + " open`` - Sets the guild joining status.\n" + prefix + " thumbnail`` - Sets the guild thumbnail.\n" + prefix + " name`` - Sets the guilds name.");
            return;
          }
          switch (command.params[1]) {
            case "desc":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (guild.owner_id == player.id) {
                    var params = command.params.splice(2).join(" ");
                    guild.desc = params;
                    self.utils.plugin.DB.Update("guilds", {
                      "id": guild.id
                    }, guild);
                    self.embed(command, "Guild Desc Set", (params != '') ? "New Desc: ``" + params + "``" : "Guild description is cleared.");
                  } else self.embed(command, "Guild Desc Error", "Only guild owner can set desc.");
                });
              } else self.embed(command, "Guild Desc Error", "You are not in a guild.");
              break;
            case "open":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (guild.owner_id == player.id) {
                    if (command.params[2] == 'true') {
                      guild.open = true;
                      self.utils.plugin.DB.Update("guilds", {
                        "id": guild.id
                      }, guild);
                      self.embed(command, "Guild Open Set", 'Guild is now set to open.');
                    } else if (command.params[2] == 'false') {
                      guild.open = false;
                      self.utils.plugin.DB.Update("guilds", {
                        "id": guild.id
                      }, guild);
                      self.embed(command, "Guild Open Set", 'Guild is now set to closed.');
                    } else self.embed(command, "Guild Open Error", "Input has to be ``true``or ``false``.");
                  } else self.embed(command, "Guild Open Error", "You are not the guild owner.");
                });
              } else self.embed(command, "Guild Open Error", "You are not in a guild.");
              break;
            case "thumbnail":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  if (guild.owner_id == player.id) {
                    self.disnode.platform.GetUserUltra(command.msg.author.usernameID).then(function(role) {
                      if (role) {
                        guild.thumbnail = command.params[2];
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.embed(command, "Guild Thumbnail Set", 'The guilds thumbnail has been set.');
                      } else self.embed(command, "Guild Thumbnail Error", 'This is an [Ultra](https://disnodeteam.com/#/ultra) setting.');
                    });
                  } else self.embed(command, "Guild Thumbnail Error", 'You are not the guild owner.');
                });
              } else self.embed(command, "Guild Thumbnail Error", "You are not in a guild.");
              break;
            case "name":
              if (player.guild != '') {
                self.utils.GetGuild(player.guild).then(function(guild) {
                  var params = command.params.splice(2).join(" ");
                  if (guild.owner_id == player.id) {
                    self.utils.FindGuild(params).then(function(fg) {
                      if (fg == false) {
                        guild.name = params;
                        self.utils.plugin.DB.Update("guilds", {
                          "id": guild.id
                        }, guild);
                        self.embed(command, "Guild Name Set", 'New name: ``' + params + '``.');
                      } else self.embed(command, "Guild Name Set Error", 'That guild name is taken.');
                    });
                  } else self.embed(command, "Guild Name Set Error", 'You are not the guild owner.');
                });
              } else self.embed(command, "Guild Name Set Error", "You are not in a guild.");
              break
          }

      }
    });
  }
  gather(command) {
    var self = this;
    self.utils.GetUser(command).then(function(player) {
      switch (command.params[0]) {
        case "mine":
          var timeoutInfo = self.utils.checkTimeout(player, 5);
          if (player.dev) timeoutInfo = self.utils.checkTimeout(player, 0);
          if (!timeoutInfo.pass) {
            self.embed(command, "Cooldown", "You have to wait ``" + timeoutInfo.remain + "`` before mining again.");
            return;
          }
          self.utils.GetGather("mine", self.utils.theMaths(0, 2)).then(function(res) {
            var itemfound = false;
            var amt;
            var pos;
            for (var i = 0; i < player.inv.length; i++) {
              if (player.inv[i].defaultName == res.Name) {
                itemfound = true;
                amt = player.inv[i].amount;
                pos = i;
                break;
              }
            }
            var drop = self.utils.theMaths(res.minDrop, res.maxDrop);
            var xp = self.utils.theMaths(res.minXP, res.maxXP);
            if (itemfound == false) {
              var newItem = {
                defaultName: res.Name,
                amount: drop
              }
              player.inv.push(newItem);
              player.xp += xp;
              self.utils.checkLV(player, command.msg.channel_id);
              self.utils.plugin.DB.Update("players", {
                "id": player.id
              }, player);
              self.embed(command, "Mine Result", "You got " + drop + " " + res.Name + " and " + xp + " XP");
            } else {
              player.inv[pos].amount += drop;
              player.xp += xp;
              self.utils.checkLV(player, command.msg.channel_id);
              self.utils.plugin.DB.Update("players", {
                "id": player.id
              }, player);
              self.embed(command, "Mine Result", "You got " + drop + " " + res.Name + " and " + xp + " XP");
            }
          });
          self.utils.updatePlayerLastMessage(player);
          break;

      }
    })
  }
  player(command) {
    var self = this;
    self.utils.GetUser(command).then(function(player) {
      switch (command.params[0]) {
        case 'inv':
          var headingStringA = "Name";
          var headingStringB = "|Amount"
          var itemsAmountArr = [];
          var itemsNameArr = [];
          var final = "";
          for (var i = 0; i < player.inv.length; i++) {
            itemsAmountArr.push("|x" + player.inv[i].amount);
            itemsNameArr.push(player.inv[i].name);
          }
          var AmountL = self.utils.getLongestString(itemsAmountArr);
          var NameL = self.utils.getLongestString(itemsNameArr);
          headingStringA = self.utils.addSpacesToString(headingStringA, NameL);
          headingStringB = self.utils.addSpacesToString(headingStringB, AmountL);
          final += headingStringA + headingStringB + "\n\n";
          for (var i = 0; i < itemsNameArr.length; i++) {
            itemsNameArr[i] = self.utils.addSpacesToString(itemsNameArr[i], NameL);
          }
          for (var i = 0; i < itemsAmountArr.length; i++) {
            itemsAmountArr[i] = self.utils.addSpacesToString(itemsAmountArr[i], AmountL);
          }
          for (var i = 0; i < itemsNameArr.length; i++) {
            final += itemsNameArr[i] + itemsAmountArr[i] + "\n";
          }
          self.disnode.bot.SendEmbed(command.msg.channel_id, {
            color: 1752220,
            author: {},
            fields: [{
              name: player.name + "\'s Inventory",
              inline: true,
              value: "`\n" + final + "`",
            }],
            footer: {
              text: command.msg.author.username,
              icon_url: self.utils.avatarCommandUser(command),
            },
            timestamp: new Date(),
          });
          break;
        case 'stats':
          var bprefix = self.disnode.botConfig.prefix;
          var pprefix = self.config.prefix;
          if (command.params[1]) {
            self.utils.FindPlayer(command.params[1]).then(function(res) {
              if (res.found) {
                self.disnode.bot.SendEmbed(command.msg.channel_id, {
                  color: 1752220,
                  author: {},
                  title: res.p.name + "\'s stats",
                  description: "To see your inventory type ``" + bprefix + "" + pprefix + " inv``.",
                  fields: [{
                    name: 'Health',
                    inline: true,
                    value: (res.p.chealth) + "/" + (res.p.thealth) + " HP",
                  }, {
                    name: 'Gold',
                    inline: true,
                    value: (res.p.gold),
                  }, {
                    name: 'Level ' + res.p.lvl,
                    inline: true,
                    value: res.p.xp + '/' + res.p.nextlvl + ' XP',
                  }],
                  footer: {
                    text: command.msg.author.username,
                    icon_url: self.utils.avatarCommandUser(command),
                  },
                  timestamp: new Date(),
                });
              } else {
                self.disnode.bot.SendCompactEmbed(command.msg.channel_id, "Error", res.msg);
              }
            });
          } else {
            self.disnode.bot.SendEmbed(command.msg.channel_id, {
              color: 1752220,
              author: {},
              title: player.name + "\'s stats",
              description: "To see your inventory type ``" + bprefix + "" + pprefix + " inv``.",
              fields: [{
                name: 'Health',
                inline: true,
                value: (player.chealth) + "/" + (player.thealth) + " HP",
              }, {
                name: 'Gold',
                inline: true,
                value: (player.gold),
              }, {
                name: 'Level ' + player.lvl,
                inline: true,
                value: player.xp + '/' + player.nextlvl + ' XP',
              }],
              footer: {
                text: command.msg.author.username,
                icon_url: self.utils.avatarCommandUser(command),
              },
              timestamp: new Date(),
            });
          }
          break;
        case 'skills':
          switch (command.params[1]) {
            case "assign":

              break;
            default:
              self.disnode.bot.SendEmbed(command.msg.channel_id, {
                color: 1752220,
                author: {},
                fields: [{
                  name: player.name + "\'s skills",
                  inline: true,
                  value: 'Strength: ``' + player.skills.strength + '``\nDefense: ``' + player.skills.defense + '``\nLuck: ``' + player.skills.luck + '``\nCharisma: ``' + player.skills.charisma + '``\nUnassigned: ``' + player.skills.points + '``',
                }],
                footer: {
                  text: command.msg.author.username,
                  icon_url: self.utils.avatarCommandUser(command),
                },
                timestamp: new Date(),
              });
              break;
          }
          break;
        case 'equipped':
          var wpos;
          var hpos;
          var bpos;
          var gpos;
          var spos;
          for (var i = 0; i < player.equipped.length; i++) {
            if (player.equipped[i].type == 'weapon') {
              wpos = i;
            }
            if (player.equipped[i].type == 'breastplate') {
              bpos = i;
            }
            if (player.equipped[i].type == 'helmet') {
              hpos = i;
            }
            if (player.equipped[i].type == 'greaves') {
              gpos = i;
            }
            if (player.equipped[i].type == 'shield') {
              spos = i;
            }
          }
          self.disnode.bot.SendEmbed(command.msg.channel_id, {
            color: 1752220,
            author: {},
            title: player.name + "\'s Equipped Items",
            thumbnail: {
              url: 'https://cdn.discordapp.com/attachments/324059500556320774/324393831602716672/inventory.png'
            },
            fields: [{
              name: 'Helmet',
              inline: true,
              value: player.equipped[hpos].name,
            }, {
              name: 'Breastplate',
              inline: true,
              value: player.equipped[bpos].name,
            }, {
              name: 'Greaves',
              inline: true,
              value: player.equipped[gpos].name,
            }, {
              name: 'Shield',
              inline: true,
              value: player.equipped[spos].name,
            }, {
              name: 'Weapon',
              inline: true,
              value: player.equipped[wpos].name,
            }],
            footer: {
              text: command.msg.author.username,
              icon_url: self.utils.avatarCommandUser(command),
            },
            timestamp: new Date(),
          });
          break;
        case 'equip':
          var ipos;
          var invfound = false;
          var params = command.params.splice(1).join(" ").replace(/(^|\s)[a-z]/g, function(f) {
            return f.toUpperCase();
          });
          for (var i = 0; i < player.inv.length; i++) {
            if (player.inv[i].name == params) {
              ipos = i;
              invfound = true;
            }
          }
          if (invfound) {
            var epos;
            var item = player.inv[ipos].type;
            for (var i = 0; i < player.equipped.length; i++) {
              if (player.equipped[i].type == item) {
                epos = i;
              }
            }
            var equipobj = player.equipped[epos];
            var invobj = player.inv[ipos];
            player.inv.push(equipobj);
            player.equipped.push(invobj);
            player.inv.splice(ipos, 1);
            player.equipped.splice(epos, 1);
            self.utils.plugin.DB.Update("players", {
              "id": player.id
            }, player);
            self.embed(command, "Item Equip", params + ' has been equipped.');
          } else self.embed(command, "Item Equip Error", params + ' is not in your inv.');
          break;
        default:
          var prefix = '``!rpg player';
          self.embed(command, "Player Commands", prefix + " stats`` - Stats of you or a user.\n" + prefix + " inv`` - Gets your inventory.\n" + prefix + " skills`` - Skill related commands.\n" + prefix + " equipped`` - Shows what gear you have equipped.");
      }
    });
  }
  itemInfo(command) {
    var self = this;
    var prefix = self.disnode.botConfig.prefix + self.config.prefix;
    if (command.params[0] == undefined) {
      self.disnode.bot.SendEmbed(command.msg.channel_id, {
        color: 1752220,
        author: {},
        fields: [{
          name: 'Info',
          inline: true,
          value: "``" + prefix + " info [breastplate/greatsword/greaves/helmet/shortsword/health] [name]`` - Get Item Info",
        }],
        footer: {
          text: command.msg.author.username,
          icon_url: self.utils.avatarCommandUser(command),
        },
        timestamp: new Date(),
      });
    } else {
      console.log(command.params);
      var type = command.params[0];
      command.params.splice(0, 1);
      var itemL = command.params.join(" ");
      console.log(type + " : " + itemL);
      self.utils.getItem(type, itemL).then(function(item) {
        var embedFields = [];
        embedFields.push({
          name: 'Item Name',
          inline: true,
          value: item.name,
        });
        embedFields.push({
          name: 'Item Level',
          inline: true,
          value: item.lvl,
        });
        embedFields.push({
          name: 'Item Worth (Buy/Sell)',
          inline: true,
          value: item.buy + "/" + item.sell,
        });
        switch (item.type) {
          case "weapon":
            embedFields.push({
              name: 'Min Damage/Max Damage',
              inline: true,
              value: item.minDamage + "/" + item.maxDamage,
            });
            break;
          case "greaves":
            embedFields.push({
              name: 'Min Defense/Max Defense',
              inline: true,
              value: item.minDefense + "/" + item.maxDefense,
            });
            break;
          case "helmet":
            embedFields.push({
              name: 'Min Defense/Max Defense',
              inline: true,
              value: item.minDefense + "/" + item.maxDefense,
            });
            break;
          case "breastplate":
            embedFields.push({
              name: 'Min Defense/Max Defense',
              inline: true,
              value: item.minDefense + "/" + item.maxDefense,
            });
            break;
          case "health":
            embedFields.push({
              name: 'Healing Power',
              inline: true,
              value: item.heal,
            });
            break;
        }
        self.disnode.bot.SendEmbed(command.msg.channel_id, {
          color: 1752220,
          author: {},
          title: "Item Info",
          fields: embedFields,
          footer: {
            text: command.msg.author.username,
            icon_url: self.utils.avatarCommandUser(command),
          },
          timestamp: new Date(),
        });
      }).catch(function(err) {
        self.embed(command, "Error", "" + err);
      })
    }
  }
  storelist(command) {
    var self = this;
    var prefix = self.disnode.botConfig.prefix + self.config.prefix;
    if (command.params[0] == undefined) {
      self.disnode.bot.SendEmbed(command.msg.channel_id, {
        color: 1752220,
        author: {},
        fields: [{
          name: 'Info',
          inline: true,
          value: "``" + prefix + " list [breastplate/greatsword/greaves/helmet/shortsword/health]`` - Get Items",
        }],
        footer: {
          text: command.msg.author.username,
          icon_url: self.utils.avatarCommandUser(command),
        },
        timestamp: new Date(),
      });
    } else {
      self.utils.getItems(command.params[0]).then(function(items) {
        var Name = "";
        var cost = "";
        for (var i = 0; i < items.length; i++) {
          Name += items[i].name + "\n";
          cost += items[i].buy + " Gold\n";
        }
        cost = cost.replace("0 Gold", "Free");
        cost = cost.replace("null Gold", "Unavailable");
        self.disnode.bot.SendEmbed(command.msg.channel_id, {
          color: 1752220,
          author: {},
          title: "Item List",
          fields: [{
            name: 'Item Name',
            inline: true,
            value: Name,
          }, {
            name: 'Amount',
            inline: true,
            value: cost,
          }],
          footer: {
            text: command.msg.author.username,
            icon_url: self.utils.avatarCommandUser(command),
          },
          timestamp: new Date(),
        });
      }).catch(function(err) {
        self.embed(command, "Error", "" + err);
      });
    }
  }
  devCommand(command) {
    var self = this;
    self.utils.GetUser(command).then(function(player) {
      if (player.dev) {
        switch (command.params[0]) {
          case "eval":
            try {
              var codes = command.msg.message.split("dev eval ")[1];
              var results = eval("(() => { " + codes + " })();");
              if (results === "[object Object]") {
                results = JSON.stringify(results, null, 4);
              }
              if (typeof results !== 'string')
                results = require('util').inspect(results);
              self.disnode.bot.SendMessage(command.msg.channel_id, "```json\n" + results + "```")
            } catch (errors) {
              self.disnode.bot.SendMessage(command.msg.channel_id, errors)
            }
            break;
          case "player":
            switch (command.params[1]) {
              case "get":
                self.utils.FindPlayer(command.params[2]).then(function(res) {
                  if (res.found) {
                    self.disnode.bot.SendMessage(command.msg.channel_id, "```json\n" + JSON.stringify(res.p, false, 2) + "```");
                  } else {
                    self.disnode.bot.SendCompactEmbed(command.msg.channel_id, "Error", res.msg, 16772880);
                  }
                });
                break;
              case "set":
                switch (command.params[2]) {
                  case "lvl":
                    self.utils.FindPlayer(command.params[3]).then(function(res) {
                      if (res.found) {
                        res.p.lvl = parseInt(command.params[4]);
                        self.utils.plugin.DB.Update("players", {
                          "id": res.p.id
                        }, res.p);
                        self.disnode.bot.SendCompactEmbed(command.msg.channel_id, "Complete", res.p.name + " lvl set to " + command.params[4], 3447003);
                      } else {
                        self.disnode.bot.SendCompactEmbed(command.msg.channel_id, "Error", res.msg, 16772880);
                      }
                    });
                    break;
                }
                break;
            }
            break;
          case "changelog":
            self.disnode.bot.SendEmbed('323358134993289216', {
              color: 1752220,
              author: {},
              fields: [{
                name: 'Changelog ' + self.disnode.botConfig.version,
                inline: true,
                value: '```fix\n' + self.utils.ChangeLog() + '\n```',
              }],
              footer: {},
              timestamp: new Date(),
            });
            break;
        }
      }
    });
  }
  embed(command, title, body) {
    var self = this;
    self.disnode.bot.SendEmbed(command.msg.channel_id, {
      color: 1752220,
      author: {},
      fields: [{
        name: title,
        inline: true,
        value: body,
      }],
      footer: {
        text: command.msg.author.username,
        icon_url: self.utils.avatarCommandUser(command),
      },
      timestamp: new Date(),
    });
  }
}
module.exports = RPGPlugin;


text:
//
//  TableSpannerAlg.h
//  Span2dTable
//
//  Created by u on 2014-02-06.
//  Copyright (c) 2014 yes. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface TableSpannerAlg : NSObject

/**
 * Converts the input table with the span info into a 2d array. Check out the
 * tests for usage examples.
 *
 * Assumption: the input data is correct (that is, the first row defines the
 *      width of the table)!
 * Assumption: all numbers are distinct!
 * Assumption: no zeroes in input data!
 */
- (NSArray *)tableForData:(NSArray *)data andSpanInfo:(NSDictionary *)spanInfo;

@end


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>app07_check</title>

	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

app07_check

		ブラウザでindex.htmlを表示しているか、Electronで表示しているかをjavascriptno
		中で見分けるテスト。

message